diff options
| author | David Aspinall | 2000-03-22 12:45:35 +0000 |
|---|---|---|
| committer | David Aspinall | 2000-03-22 12:45:35 +0000 |
| commit | b1e72f62ada72021ce4c4c124ff0c54d19010847 (patch) | |
| tree | 23ed0dbf65109979854f23cc71295f4db15ce580 | |
| parent | 59412ffa7c58e14121aab37a55882cd5be03cd65 (diff) | |
Added utility functions proof-format, proof-format-filename.
| -rw-r--r-- | generic/proof-syntax.el | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/generic/proof-syntax.el b/generic/proof-syntax.el index 07591a06..798e2727 100644 --- a/generic/proof-syntax.el +++ b/generic/proof-syntax.el @@ -136,5 +136,32 @@ may assign this function to `after-change-function'." (append (delq 'proof-zap-commas-region after-change-functions) '(proof-zap-commas-region)))) +;; +;; Functions for doing something like "format" but with customizable +;; control characters. +;; + +(defun proof-format (alist string) + "Format a string by matching regexps in ALIST against 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)) + (substring string (match-end 0)))) + (setq idx (+ (match-beginning 0) (length (cdr (car alist))))))) + (setq alist (cdr alist))) + string) + +(defun proof-format-filename (string filename) + "Format STRING by replacing %s or %e by expanded version of FILENAME. +%e is special form meaning use proof-shell-string-escapes." + (proof-format + (list (cons "%s" (expand-file-name filename)) + (cons "%e" (proof-format proof-shell-string-escapes + (expand-file-name filename)))) + string)) + (provide 'proof-syntax) |
