]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/auctex/tex-fold.el
Get "make -k" to go through
[gnu-emacs-elpa] / packages / auctex / tex-fold.el
index 8856895041f26b79cab169d3719c2aa3f48533ee..0b8de3a002b9e67051705dd5be5c1e33089b9508 100644 (file)
@@ -1,7 +1,6 @@
 ;;; tex-fold.el --- Fold TeX macros.
 
-;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Free Software
-;;   Foundation, Inc.
+;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <angeli@caeruleus.net>
 ;; Maintainer: auctex-devel@gnu.org
@@ -764,21 +763,21 @@ Return non-nil if a removal happened, nil otherwise."
 Replace them with the respective macro argument."
   (let ((spec-list (split-string spec "||"))
        (delims '((?{ . ?}) (?[ . ?]) (?< . ?>) (?\( . ?\))))
-       index success)
+       match-end success)
     (catch 'success
       ;; Iterate over alternatives.
       (dolist (elt spec-list)
-       (setq spec elt
-             index nil)
+       (setq spec elt)
        ;; Find and expand every placeholder.
-       (while (and (string-match "\\([[{<]\\)\\([1-9]\\)\\([]}>]\\)" elt index)
-                   ;; Does the closing delim match the opening one?
+       (while (and (string-match "\\([[{<]\\)\\([1-9]\\)\\([]}>]\\)" elt
+                                 match-end)
+                   ;; Does the closing delim fit to the opening one?
                    (string-equal
                     (match-string 3 elt)
                     (char-to-string
                      (cdr (assq (string-to-char (match-string 1 elt))
                                 delims)))))
-         (setq index (match-end 0))
+         (setq match-end (match-beginning 0))
          (let ((arg (car (save-match-data
                            ;; Get the argument.
                            (TeX-fold-macro-nth-arg
@@ -789,7 +788,6 @@ Replace them with the respective macro argument."
            (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))
@@ -884,10 +882,9 @@ Remove the respective properties from the overlay OV."
                        (and (boundp 'global-disable-point-adjustment)
                             global-disable-point-adjustment)
                        ;; See preview.el on how to make this configurable.
-                       (memq this-command
-                             (list (key-binding [left]) (key-binding [right])
-                                   'backward-char 'forward-char
-                                   'mouse-set-point)))
+                       (memq this-command (list (key-binding [left])
+                                                (key-binding [right])
+                                                'mouse-set-point)))
                ;; Open new overlays.
                (dolist (ol (nconc (when (and TeX-fold-unfold-around-mark
                                              (boundp 'mark-active)