changeset 420:8f804c8339bb dev

merged
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 12 Jul 2015 10:07:08 +0900
parents 510106cf15fb (current diff) 465d80a913e4 (diff)
children e37af485338a 5e7b06dcab9c 9219b8c610f8
files
diffstat 1 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/yatex.el	Sun Jul 12 10:06:47 2015 +0900
+++ b/yatex.el	Sun Jul 12 10:07:08 2015 +0900
@@ -1,6 +1,6 @@
 ;;; yatex.el --- Yet Another tex-mode for emacs //野鳥// -*- coding: sjis -*-
 ;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Fri Feb 13 20:40:56 2015 on firestorm
+;;; Last modified Wed Jul  8 13:41:17 2015 on duke
 ;;; $Id$
 ;;; The latest version of this software is always available at;
 ;;; http://www.yatex.org/
@@ -612,6 +612,18 @@
   (modify-syntax-entry ?\\ "/" YaTeX-mode-syntax-table)
   (modify-syntax-entry ?~ " " YaTeX-mode-syntax-table))
 
+(defvar YaTeX-mode-syntax-table-nonparen nil
+  "Syntax table for yatex-mode with normal parentheses treated white spaces")
+(if YaTeX-mode-syntax-table-nonparen nil
+  (setq YaTeX-mode-syntax-table-nonparen
+	(make-syntax-table YaTeX-mode-syntax-table))
+  (let ((zenparens "()()「」『』【】[]{}《》〈〉〔〕") (i 0) s)
+    (while (string-match "." zenparens i)
+      (setq s (substring zenparens (match-beginning 0) (match-end 0))
+	    i (1+ i))
+      (modify-syntax-entry
+       (string-to-char s) " " YaTeX-mode-syntax-table-nonparen))))
+
 ;---------- Provide YaTeX-mode ----------
 ;;;
 ;; Major mode definition
@@ -2064,10 +2076,14 @@
 	       (goto-char (match-beginning 0))
 	       (throw 'found t))
 	  ;;If inside of parentheses, try to escape.
-	  (while (and (not (= (preceding-char) ?\])) ;skip optional arg
-		      (condition-case err
-			  (progn (up-list -1) t)
-			(error nil))))
+	  (unwind-protect
+	      (progn
+		(set-syntax-table YaTeX-mode-syntax-table-nonparen)
+		(while (and (not (= (preceding-char) ?\])) ;skip optional arg
+			    (condition-case err
+				(progn (up-list -1) t)
+			      (error nil)))))
+	    (set-syntax-table YaTeX-mode-syntax-table))
 	  (while (equal (preceding-char) ?\]) (backward-list))
 	  ;;(2) search command directly
 	  (skip-chars-forward "^{}[]")

yatex.org