yatex
changeset 414:0863123199f0 dev
Treat () and Zenkaku-paren chars as non-parens in YaTeX-on-section-command-p
author | HIROSE Yuuji <yuuji@koeki-u.ac.jp> |
---|---|
date | Wed, 08 Jul 2015 13:30:56 +0900 |
parents | 368a86a179ff |
children | f0b90aee0390 |
files | yatex.el |
diffstat | 1 files changed, 21 insertions(+), 5 deletions(-) [+] |
line diff
1.1 --- a/yatex.el Wed Jul 08 09:16:35 2015 +0900 1.2 +++ b/yatex.el Wed Jul 08 13:30:56 2015 +0900 1.3 @@ -1,6 +1,6 @@ 1.4 ;;; yatex.el --- Yet Another tex-mode for emacs //野鳥// -*- coding: sjis -*- 1.5 ;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org] 1.6 -;;; Last modified Fri Feb 13 20:40:56 2015 on firestorm 1.7 +;;; Last modified Wed Jul 8 13:29:03 2015 on duke 1.8 ;;; $Id$ 1.9 ;;; The latest version of this software is always available at; 1.10 ;;; http://www.yatex.org/ 1.11 @@ -612,6 +612,18 @@ 1.12 (modify-syntax-entry ?\\ "/" YaTeX-mode-syntax-table) 1.13 (modify-syntax-entry ?~ " " YaTeX-mode-syntax-table)) 1.14 1.15 +(defvar YaTeX-mode-syntax-table-nonparen nil 1.16 + "Syntax table for yatex-mode with normal parentheses treated white spaces") 1.17 +(if YaTeX-mode-syntax-table-nonparen nil 1.18 + (setq YaTeX-mode-syntax-table-nonparen 1.19 + (make-syntax-table YaTeX-mode-syntax-table)) 1.20 + (let ((zenparens "()()「」『』【】《》") (i 0) s) 1.21 + (while (string-match "." zenparens i) 1.22 + (setq s (substring zenparens (match-beginning 0) (match-end 0)) 1.23 + i (1+ i)) 1.24 + (modify-syntax-entry 1.25 + (string-to-char s) " " YaTeX-mode-syntax-table-nonparen)))) 1.26 + 1.27 ;---------- Provide YaTeX-mode ---------- 1.28 ;;; 1.29 ;; Major mode definition 1.30 @@ -2064,10 +2076,14 @@ 1.31 (goto-char (match-beginning 0)) 1.32 (throw 'found t)) 1.33 ;;If inside of parentheses, try to escape. 1.34 - (while (and (not (= (preceding-char) ?\])) ;skip optional arg 1.35 - (condition-case err 1.36 - (progn (up-list -1) t) 1.37 - (error nil)))) 1.38 + (unwind-protect 1.39 + (progn 1.40 + (set-syntax-table YaTeX-mode-syntax-table-nonparen) 1.41 + (while (and (not (= (preceding-char) ?\])) ;skip optional arg 1.42 + (condition-case err 1.43 + (progn (up-list -1) t) 1.44 + (error nil))))) 1.45 + (set-syntax-table YaTeX-mode-syntax-table)) 1.46 (while (equal (preceding-char) ?\]) (backward-list)) 1.47 ;;(2) search command directly 1.48 (skip-chars-forward "^{}[]")