auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] Changes to auctex/tex-fold.el,v


From: Ralf Angeli
Subject: [AUCTeX-diffs] Changes to auctex/tex-fold.el,v
Date: Wed, 20 Apr 2011 20:09:29 +0000

CVSROOT:        /cvsroot/auctex
Module name:    auctex
Changes by:     Ralf Angeli <angeli>    11/04/20 20:09:28

Index: tex-fold.el
===================================================================
RCS file: /cvsroot/auctex/auctex/tex-fold.el,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -b -r1.67 -r1.68
--- tex-fold.el 23 Jan 2011 18:52:21 -0000      1.67
+++ tex-fold.el 20 Apr 2011 20:09:28 -0000      1.68
@@ -1,6 +1,7 @@
 ;;; tex-fold.el --- Fold TeX macros.
 
-;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Free Software
+;;   Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
@@ -763,21 +764,21 @@
 Replace them with the respective macro argument."
   (let ((spec-list (split-string spec "||"))
        (delims '((?{ . ?}) (?[ . ?]) (?< . ?>) (?\( . ?\))))
-       match-end success)
+       index success)
     (catch 'success
       ;; Iterate over alternatives.
       (dolist (elt spec-list)
-       (setq spec elt)
+       (setq spec elt
+             index nil)
        ;; Find and expand every placeholder.
-       (while (and (string-match "\\([[{<]\\)\\([1-9]\\)\\([]}>]\\)" elt
-                                 match-end)
-                   ;; Does the closing delim fit to the opening one?
+       (while (and (string-match "\\([[{<]\\)\\([1-9]\\)\\([]}>]\\)" elt index)
+                   ;; Does the closing delim match the opening one?
                    (string-equal
                     (match-string 3 elt)
                     (char-to-string
                      (cdr (assq (string-to-char (match-string 1 elt))
                                 delims)))))
-         (setq match-end (match-beginning 0))
+         (setq index (match-end 0))
          (let ((arg (car (save-match-data
                            ;; Get the argument.
                            (TeX-fold-macro-nth-arg
@@ -788,6 +789,7 @@
            (when arg (setq success t))
            ;; Replace the placeholder in the string.
            (setq elt (replace-match (or arg TeX-fold-ellipsis) nil t elt)
+                 index (+ index (- (length elt) (length spec)))
                  spec elt)))
        (when success (throw 'success nil))))
     spec))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]