aboutsummaryrefslogtreecommitdiff
path: root/generic
diff options
context:
space:
mode:
authorDavid Aspinall2000-05-29 15:28:20 +0000
committerDavid Aspinall2000-05-29 15:28:20 +0000
commit080babbb0f361885e9b502ee56dec14351104a37 (patch)
treeface1b113b4e8a621abb70f98e0b01280f249ba5 /generic
parentf249d8f89389970c848e2e5964f3340adbfd75dc (diff)
Generalized proof-format to allow sexps in replacement.
Diffstat (limited to 'generic')
-rw-r--r--generic/proof-syntax.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/generic/proof-syntax.el b/generic/proof-syntax.el
index 2ad0a40d..fd316eb0 100644
--- a/generic/proof-syntax.el
+++ b/generic/proof-syntax.el
@@ -144,14 +144,21 @@ may assign this function to `after-change-function'."
;; Added for version 3.1 to help quote funny characters in filenames.
;;
+;;;###autoload
(defun proof-format (alist string)
- "Format a string by matching regexps in ALIST against STRING"
+ "Format a string by matching regexps in ALIST against STRING.
+ALIST contains (REGEXP . REPLACEMENT) pairs where REPLACEMENT
+may be a string or sexp evaluated to get a string."
(while alist
(let ((idx 0))
(while (string-match (car (car alist)) string idx)
(setq string
(concat (substring string 0 (match-beginning 0))
- (cdr (car alist))
+ (cond
+ ((stringp (cdr (car alist)))
+ (cdr (car alist)))
+ (t
+ (eval (cdr (car alist)))))
(substring string (match-end 0))))
(setq idx (+ (match-beginning 0) (length (cdr (car alist)))))))
(setq alist (cdr alist)))