yatex
changeset 451:2011de73a671 dev
Who owes the incompatibility of string-to-int?
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Tue, 21 Feb 2017 15:46:12 +0859 |
parents | 8871fe9f563b |
children | 2d9589a786d1 |
files | yahtml.el yatex.el yatexadd.el yatexgen.el yatexlib.el yatexsec.el |
diffstat | 6 files changed, 40 insertions(+), 31 deletions(-) [+] |
line diff
1.1 --- a/yahtml.el Wed Jan 18 07:49:03 2017 +0900 1.2 +++ b/yahtml.el Tue Feb 21 15:46:12 2017 +0859 1.3 @@ -3,7 +3,7 @@ 1.4 ;;; Last modified Thu Jan 5 17:45:36 2017 on firestorm 1.5 ;;; $Id$ 1.6 1.7 -(defconst yahtml-revision-number "1.79" 1.8 +(defconst yahtml-revision-number "1.79.2" 1.9 "Revision number of running yahtml.el") 1.10 1.11 ;;; Commentary: 1.12 @@ -1302,7 +1302,7 @@ 1.13 (cons "align" alg)) 1.14 (if (string< "" brd) 1.15 (cons "border" 1.16 - (format "%dpx" (string-to-int brd)))))))) 1.17 + (format "%dpx" (YaTeX-str2int brd)))))))) 1.18 (concat 1.19 (yahtml-make-optional-argument "border" brd) 1.20 (yahtml-make-optional-argument "align" alg)))))) 1.21 @@ -1524,7 +1524,7 @@ 1.22 (append 1.23 (if (string< "" b) 1.24 (list 1.25 - (cons "border" (format "%dpx solid" (string-to-int b))) 1.26 + (cons "border" (format "%dpx solid" (YaTeX-str2int b))) 1.27 (cons "border-collapse" "collapse"))) 1.28 (if (string< "" a) 1.29 (cond 1.30 @@ -2995,7 +2995,7 @@ 1.31 (progn 1.32 (skip-chars-forward "\"' \t\n") 1.33 (looking-at "[0-9]+"))) 1.34 - (setq cols (+ (string-to-int (YaTeX-match-string 0)) cols)) 1.35 + (setq cols (+ (YaTeX-str2int (YaTeX-match-string 0)) cols)) 1.36 (setq cols (1+ cols))) 1.37 (goto-char rb) 1.38 (setq p (point))) 1.39 @@ -3095,7 +3095,7 @@ 1.40 (let ((f (if (string= "" (YaTeX-match-string 1)) 1.41 YaTeX-current-file-name 1.42 (YaTeX-match-string 1))) 1.43 - (l (string-to-int (or (YaTeX-match-string 2) 1.44 + (l (YaTeX-str2int (or (YaTeX-match-string 2) 1.45 (YaTeX-match-string 3))))) 1.46 (if sit (sit-for 1)) 1.47 (forward-line -1)
2.1 --- a/yatex.el Wed Jan 18 07:49:03 2017 +0900 2.2 +++ b/yatex.el Tue Feb 21 15:46:12 2017 +0859 2.3 @@ -8,7 +8,7 @@ 2.4 ;;; Code: 2.5 (require 'comment) 2.6 (require 'yatexlib) 2.7 -(defconst YaTeX-revision-number "1.79.1" 2.8 +(defconst YaTeX-revision-number "1.79.2" 2.9 "Revision number of running yatex.el") 2.10 2.11 ;---------- Local variables ---------- 2.12 @@ -1310,7 +1310,7 @@ 2.13 (car (where-is-internal 'YaTeX-make-begin-end)))) 2.14 (point)) 2.15 (put 'YaTeX-insert-braces 'begend-guide 2.16 - (+ 1 (string-to-int ;increment counter of beg-end guidance 2.17 + (+ 1 (YaTeX-str2int ;increment counter of beg-end guidance 2.18 (prin1-to-string 2.19 (get 'YaTeX-insert-braces 'begend-guide))))))))) 2.20 env macro not-literal b e)
3.1 --- a/yatexadd.el Wed Jan 18 07:49:03 2017 +0900 3.2 +++ b/yatexadd.el Tue Feb 21 15:46:12 2017 +0859 3.3 @@ -571,19 +571,19 @@ 3.4 (Y (substring ts -4)) 3.5 (y (substring ts -2)) 3.6 (b (substring ts 0 3)) 3.7 - (d (format "%d" (string-to-int (substring ts 4 6)))) 3.8 + (d (format "%d" (YaTeX-str2int (substring ts 4 6)))) 3.9 (H (substring ts 7 9)) 3.10 (M (substring ts 10 12)) 3.11 (S (substring ts 13 15)) 3.12 - (HMS (+ (* 10000 (string-to-int H)) 3.13 - (* 100 (string-to-int M)) 3.14 - (string-to-int S))) 3.15 + (HMS (+ (* 10000 (YaTeX-str2int H)) 3.16 + (* 100 (YaTeX-str2int M)) 3.17 + (YaTeX-str2int S))) 3.18 (talphabex (YaTeX::ref-alphabex HMS)) 3.19 (mnames "JanFebMarAprMayJunJulAugSepOctNovDec") 3.20 (m (format "%02d" (/ (string-match b mnames) 3))) 3.21 - (ymd (+ (* 10000 (string-to-int y)) 3.22 - (* 100 (string-to-int m)) 3.23 - (string-to-int d))) 3.24 + (ymd (+ (* 10000 (YaTeX-str2int y)) 3.25 + (* 100 (YaTeX-str2int m)) 3.26 + (YaTeX-str2int d))) 3.27 (dalphabex (YaTeX::ref-alphabex ymd))) 3.28 (YaTeX-replace-formats 3.29 (or format YaTeX-ref-default-label-string)
4.1 --- a/yatexgen.el Wed Jan 18 07:49:03 2017 +0900 4.2 +++ b/yatexgen.el Tue Feb 21 15:46:12 2017 +0859 4.3 @@ -1,6 +1,6 @@ 4.4 ;;; yatexgen.el --- YaTeX add-in function generator(rev.5) 4.5 4.6 -;;; (c)1991-1995,1999,2000 by HIROSE Yuuji.[yuuji@yatex.org] 4.7 +;;; (c)1991-1995,1999,2000,2017 by HIROSE Yuuji.[yuuji@yatex.org] 4.8 ;;; Last modified Sun Dec 21 14:04:49 2014 on firestorm 4.9 ;;; $Id$ 4.10 4.11 @@ -582,6 +582,6 @@ 4.12 (YaTeX-generate-option-type command) 4.13 (YaTeX-generate-argument-type 4.14 command 4.15 - (string-to-int (read-string "How many arguments?: ")))) nil)) 4.16 + (YaTeX-str2int (read-string "How many arguments?: ")))) nil)) 4.17 4.18 (provide 'yatexgen)
5.1 --- a/yatexlib.el Wed Jan 18 07:49:03 2017 +0900 5.2 +++ b/yatexlib.el Tue Feb 21 15:46:12 2017 +0859 5.3 @@ -1,16 +1,25 @@ 5.4 ;;; yatexlib.el --- YaTeX and yahtml common libraries -*- coding: sjis -*- 5.5 ;;; 5.6 ;;; (c)1994-2017 by HIROSE Yuuji.[yuuji@yatex.org] 5.7 -;;; Last modified Thu Jan 5 17:46:13 2017 on firestorm 5.8 +;;; Last modified Sat Jan 28 15:59:00 2017 on firestorm 5.9 ;;; $Id$ 5.10 5.11 ;;; Code: 5.12 + 5.13 +;; High-precedence compatible function 5.14 +(fset 'YaTeX-str2int 5.15 + (if (fboundp 'string-to-number) 5.16 + (function 5.17 + (lambda (string &optional base) 5.18 + (ceiling (string-to-number string base)))) 5.19 + 'string-to-int)) 5.20 + 5.21 ;; General variables 5.22 (defvar YaTeX-dos (memq system-type '(ms-dos windows-nt OS/2))) 5.23 (defvar YaTeX-macos (memq system-type '(darwin))) 5.24 -(defvar YaTeX-emacs-19 (>= (string-to-int emacs-version) 19)) 5.25 -(defvar YaTeX-emacs-20 (>= (string-to-int emacs-version) 20)) 5.26 -(defvar YaTeX-emacs-21 (>= (string-to-int emacs-version) 21)) 5.27 +(defvar YaTeX-emacs-19 (>= (YaTeX-str2int emacs-version) 19)) 5.28 +(defvar YaTeX-emacs-20 (>= (YaTeX-str2int emacs-version) 20)) 5.29 +(defvar YaTeX-emacs-21 (>= (YaTeX-str2int emacs-version) 21)) 5.30 (defvar YaTeX-user-completion-table 5.31 (if YaTeX-dos "~/_yatexrc" "~/.yatexrc") 5.32 "*Default filename in which user completion table is saved.") 5.33 @@ -559,7 +568,7 @@ 5.34 (if (numberp height) 5.35 (+ height 2) 5.36 (/ (* (YaTeX-screen-height) 5.37 - (string-to-int height)) 5.38 + (YaTeX-str2int height)) 5.39 100))) 5.40 (- (YaTeX-screen-height) window-min-height 1)) 5.41 window-min-height)))) 5.42 @@ -1037,7 +1046,7 @@ 5.43 (cons env m0))) ;else, return meaningful values 5.44 (store-match-data md))))))) 5.45 5.46 -(defun YaTeX-goto-corresponding-environment (&optional allow-mismatch noerr) 5.47 +(defun YaTeX-goto-corresponding-environment (&optional allow-mismatch noerr bg) 5.48 "Go to corresponding begin/end enclosure. 5.49 Optional argument ALLOW-MISMATCH allows mismatch open/clese. Use this 5.50 for \left(, \right). 5.51 @@ -1049,14 +1058,14 @@ 5.52 (m1 (match-beginning 1)) ;environment in \begin{} 5.53 (m2 (match-beginning 2)) ;environment in \end{} 5.54 (m3 (match-beginning 3))) ;environment in \[ \] \( \) 5.55 - ;(setq env (regexp-quote (buffer-substring p (match-beginning 0)))) 5.56 + ;(setq env (regexp-quote (buffer-substring p (match-beginning 0)))) 5.57 (if (cond 5.58 (m1 ;if begin{xxx} 5.59 (setq env 5.60 (if allow-mismatch YaTeX-struct-name-regexp 5.61 (regexp-quote (buffer-substring m1 (match-end 1))))) 5.62 - ; (setq regexp (concat "\\(\\\\end{" env "}\\)\\|" 5.63 - ; "\\(\\\\begin{" env "}\\)")) 5.64 + ; (setq regexp (concat "\\(\\\\end{" env "}\\)\\|" 5.65 + ; "\\(\\\\begin{" env "}\\)")) 5.66 (setq regexp 5.67 (concat 5.68 "\\(" 5.69 @@ -1071,8 +1080,8 @@ 5.70 (setq env 5.71 (if allow-mismatch YaTeX-struct-name-regexp 5.72 (regexp-quote (buffer-substring m2 (match-end 2))))) 5.73 - ; (setq regexp (concat "\\(\\\\begin{" env "}\\)\\|" 5.74 - ; "\\(\\\\end{" env "}\\)")) 5.75 + ; (setq regexp (concat "\\(\\\\begin{" env "}\\)\\|" 5.76 + ; "\\(\\\\end{" env "}\\)")) 5.77 (setq regexp 5.78 (concat 5.79 "\\(" 5.80 @@ -1110,7 +1119,7 @@ 5.81 (funcall 5.82 (if noerr 'message 'error) 5.83 "Corresponding environment `%s' not found." env) 5.84 - (sit-for 1) 5.85 + (or bg (sit-for 1)) 5.86 nil)))))) 5.87 5.88 (defun YaTeX-end-environment ()
6.1 --- a/yatexsec.el Wed Jan 18 07:49:03 2017 +0900 6.2 +++ b/yatexsec.el Tue Feb 21 15:46:12 2017 +0859 6.3 @@ -1,6 +1,6 @@ 6.4 ;;; yatexsec.el --- YaTeX sectioning browser 6.5 ;;; 6.6 -;;; (c) 1994-2013 by HIROSE Yuuji [yuuji@yatex.org] 6.7 +;;; (c) 1994-2017 by HIROSE Yuuji [yuuji@yatex.org] 6.8 ;;; Last modified Sun Dec 21 14:16:35 2014 on firestorm 6.9 ;;; $Id$ 6.10 6.11 @@ -134,7 +134,7 @@ 6.12 (and ln (string< "" ln) 6.13 (progn 6.14 (goto-char (point-min)) 6.15 - (forward-line (max 0 (- (string-to-int ln) 2))) 6.16 + (forward-line (max 0 (- (YaTeX-str2int ln) 2))) 6.17 (and 6.18 (search-forward ptn nil t) 6.19 (goto-char (match-beginning 0))))) 6.20 @@ -345,7 +345,7 @@ 6.21 (set-buffer secbuf) 6.22 (goto-char (point-max)) 6.23 (while (re-search-backward pattern nil t) 6.24 - (if (< ln (string-to-int (YaTeX-match-string 1))) nil 6.25 + (if (< ln (YaTeX-str2int (YaTeX-match-string 1))) nil 6.26 (beginning-of-line) 6.27 (search-forward YaTeX-ec) 6.28 (looking-at YaTeX-TeX-token-regexp)