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: Fri, 30 May 2008 19:59:08 +0000

CVSROOT:        /cvsroot/auctex
Module name:    auctex
Changes by:     Ralf Angeli <angeli>    08/05/30 19:59:07

Index: tex-fold.el
===================================================================
RCS file: /cvsroot/auctex/auctex/tex-fold.el,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- tex-fold.el 3 Feb 2008 14:53:33 -0000       1.60
+++ tex-fold.el 30 May 2008 19:59:07 -0000      1.61
@@ -88,7 +88,8 @@
        "textbf" "textsc" "textup")))
   "List of display strings and macros to fold."
   :type '(repeat (group (choice (string :tag "Display String")
-                               (integer :tag "Number of argument" :value 1))
+                               (integer :tag "Number of argument" :value 1)
+                               (function :tag "Function to execute"))
                        (repeat :tag "Macros" (string))))
   :group 'TeX-fold)
 
@@ -711,10 +712,21 @@
   (let* ((ov-start (overlay-start ov))
         (ov-end (overlay-end ov))
         (spec (overlay-get ov 'TeX-fold-display-string-spec))
-        (computed (if (stringp spec)
-                      spec
-                    (or (TeX-fold-macro-nth-arg spec ov-start ov-end)
-                        "[Error: No content found]")))
+        (computed (cond
+                   ((stringp spec) spec)
+                   ((functionp spec)
+                    (let ((arg-list nil)
+                          (n 1)
+                          (arg ""))
+                      (while (setq arg (TeX-fold-macro-nth-arg n ov-start 
ov-end))
+                        (add-to-list 'arg-list (car arg) t)
+                        (setq n (1+ n)))
+                      (or (condition-case nil
+                              (apply spec arg-list)
+                            (error nil))
+                          "[Error: No content or function found]")))
+                   (t (or (TeX-fold-macro-nth-arg spec ov-start ov-end)
+                          "[Error: No content found]"))))
         (display-string (if (listp computed) (car computed) computed))
         (face (when (listp computed) (cadr computed))))
     ;; Cater for zero-length display strings.




reply via email to

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