yatex
changeset 198:768ff443ef84 dev
More accurate check for YaTeX-get-macro-at-point.
author | yuuji@gentei.org |
---|---|
date | Tue, 10 Jan 2012 15:24:37 +0900 |
parents | 3842e55025aa |
children | 76fe4e01931d |
files | yatex.el |
diffstat | 1 files changed, 16 insertions(+), 8 deletions(-) [+] |
line diff
1.1 --- a/yatex.el Tue Jan 10 14:12:51 2012 +0900 1.2 +++ b/yatex.el Tue Jan 10 15:24:37 2012 +0900 1.3 @@ -2,7 +2,7 @@ 1.4 ;;; Yet Another tex-mode for emacs - //–ì’¹// 1.5 ;;; yatex.el rev. 1.74.7 1.6 ;;; (c)1991-2012 by HIROSE Yuuji.[yuuji@yatex.org] 1.7 -;;; Last modified Tue Jan 10 13:27:32 2012 on firestorm 1.8 +;;; Last modified Tue Jan 10 15:22:08 2012 on firestorm 1.9 ;;; $Id$ 1.10 ;;; The latest version of this software is always available at; 1.11 ;;; http://www.yatex.org/ 1.12 @@ -1215,13 +1215,21 @@ 1.13 (interactive "d") 1.14 (save-excursion 1.15 (goto-char (setq p (or p (point)))) 1.16 - (cond 1.17 - ((and (not (bobp)) 1.18 - (string-match "[a-zA-Z]" (char-to-string (preceding-char)))) 1.19 - (skip-chars-backward "a-zA-Z") 1.20 - (if (and (= (preceding-char) ?\\) 1.21 - (looking-at "\\([a-z]+\\)")) 1.22 - (YaTeX-buffer-substring (point) p)))))) 1.23 + (let ((token (substring (substring YaTeX-TeX-token-regexp 1) 0 -2)) 1.24 + bsend) 1.25 + (and (not (bobp)) 1.26 + (or (looking-at YaTeX-TeX-token-regexp) 1.27 + (string-match 1.28 + YaTeX-TeX-token-regexp (char-to-string (preceding-char)))) 1.29 + (progn 1.30 + (skip-chars-backward token) 1.31 + (equal (preceding-char) ?\\)) 1.32 + (save-excursion 1.33 + (setq bsend (point)) 1.34 + (skip-chars-backward "\\\\") ;emacs18 doesn't return distance 1.35 + (/= (% (- bsend (point)) 2) 0)) ;consider \\ 1.36 + (looking-at YaTeX-TeX-token-regexp) 1.37 + (YaTeX-match-string 0))))) 1.38 1.39 (defun YaTeX-insert-braces (arg &optional open close) 1.40 (interactive "p")