yatex
diff yatexlib.el @ 463:a4d49700b1c5
Artument error fixed
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Wed, 31 May 2017 21:56:49 +0859 |
parents | 7a9d30752353 |
children | 723f136edde5 |
line diff
1.1 --- a/yatexlib.el Thu Jan 05 17:49:05 2017 +0900 1.2 +++ b/yatexlib.el Wed May 31 21:56:49 2017 +0859 1.3 @@ -1,16 +1,25 @@ 1.4 ;;; yatexlib.el --- YaTeX and yahtml common libraries -*- coding: sjis -*- 1.5 ;;; 1.6 ;;; (c)1994-2017 by HIROSE Yuuji.[yuuji@yatex.org] 1.7 -;;; Last modified Thu Jan 5 17:46:13 2017 on firestorm 1.8 +;;; Last modified Sat Jan 28 15:59:00 2017 on firestorm 1.9 ;;; $Id$ 1.10 1.11 ;;; Code: 1.12 + 1.13 +;; High-precedence compatible function 1.14 +(fset 'YaTeX-str2int 1.15 + (if (fboundp 'string-to-number) 1.16 + (function 1.17 + (lambda (string &optional base) 1.18 + (ceiling (string-to-number string base)))) 1.19 + 'string-to-int)) 1.20 + 1.21 ;; General variables 1.22 (defvar YaTeX-dos (memq system-type '(ms-dos windows-nt OS/2))) 1.23 (defvar YaTeX-macos (memq system-type '(darwin))) 1.24 -(defvar YaTeX-emacs-19 (>= (string-to-int emacs-version) 19)) 1.25 -(defvar YaTeX-emacs-20 (>= (string-to-int emacs-version) 20)) 1.26 -(defvar YaTeX-emacs-21 (>= (string-to-int emacs-version) 21)) 1.27 +(defvar YaTeX-emacs-19 (>= (YaTeX-str2int emacs-version) 19)) 1.28 +(defvar YaTeX-emacs-20 (>= (YaTeX-str2int emacs-version) 20)) 1.29 +(defvar YaTeX-emacs-21 (>= (YaTeX-str2int emacs-version) 21)) 1.30 (defvar YaTeX-user-completion-table 1.31 (if YaTeX-dos "~/_yatexrc" "~/.yatexrc") 1.32 "*Default filename in which user completion table is saved.") 1.33 @@ -559,7 +568,7 @@ 1.34 (if (numberp height) 1.35 (+ height 2) 1.36 (/ (* (YaTeX-screen-height) 1.37 - (string-to-int height)) 1.38 + (YaTeX-str2int height)) 1.39 100))) 1.40 (- (YaTeX-screen-height) window-min-height 1)) 1.41 window-min-height)))) 1.42 @@ -1037,7 +1046,7 @@ 1.43 (cons env m0))) ;else, return meaningful values 1.44 (store-match-data md))))))) 1.45 1.46 -(defun YaTeX-goto-corresponding-environment (&optional allow-mismatch noerr) 1.47 +(defun YaTeX-goto-corresponding-environment (&optional allow-mismatch noerr bg) 1.48 "Go to corresponding begin/end enclosure. 1.49 Optional argument ALLOW-MISMATCH allows mismatch open/clese. Use this 1.50 for \left(, \right). 1.51 @@ -1049,14 +1058,14 @@ 1.52 (m1 (match-beginning 1)) ;environment in \begin{} 1.53 (m2 (match-beginning 2)) ;environment in \end{} 1.54 (m3 (match-beginning 3))) ;environment in \[ \] \( \) 1.55 - ;(setq env (regexp-quote (buffer-substring p (match-beginning 0)))) 1.56 + ;(setq env (regexp-quote (buffer-substring p (match-beginning 0)))) 1.57 (if (cond 1.58 (m1 ;if begin{xxx} 1.59 (setq env 1.60 (if allow-mismatch YaTeX-struct-name-regexp 1.61 (regexp-quote (buffer-substring m1 (match-end 1))))) 1.62 - ; (setq regexp (concat "\\(\\\\end{" env "}\\)\\|" 1.63 - ; "\\(\\\\begin{" env "}\\)")) 1.64 + ; (setq regexp (concat "\\(\\\\end{" env "}\\)\\|" 1.65 + ; "\\(\\\\begin{" env "}\\)")) 1.66 (setq regexp 1.67 (concat 1.68 "\\(" 1.69 @@ -1071,8 +1080,8 @@ 1.70 (setq env 1.71 (if allow-mismatch YaTeX-struct-name-regexp 1.72 (regexp-quote (buffer-substring m2 (match-end 2))))) 1.73 - ; (setq regexp (concat "\\(\\\\begin{" env "}\\)\\|" 1.74 - ; "\\(\\\\end{" env "}\\)")) 1.75 + ; (setq regexp (concat "\\(\\\\begin{" env "}\\)\\|" 1.76 + ; "\\(\\\\end{" env "}\\)")) 1.77 (setq regexp 1.78 (concat 1.79 "\\(" 1.80 @@ -1110,7 +1119,7 @@ 1.81 (funcall 1.82 (if noerr 'message 'error) 1.83 "Corresponding environment `%s' not found." env) 1.84 - (sit-for 1) 1.85 + (or bg (sit-for 1)) 1.86 nil)))))) 1.87 1.88 (defun YaTeX-end-environment ()