aboutsummaryrefslogtreecommitdiff
path: root/generic/proof-syntax.el
diff options
context:
space:
mode:
authorDavid Aspinall2000-12-14 18:56:55 +0000
committerDavid Aspinall2000-12-14 18:56:55 +0000
commitcbf3ddcba2fcbb4c601607cb2702433f1bb7a20b (patch)
treec840d4af95efa4c5f25e64ed17c840bfe669605c /generic/proof-syntax.el
parent308268ce68ed6b9e86e47abd3a597767f609c09b (diff)
Generalise proof-format-filename
Diffstat (limited to 'generic/proof-syntax.el')
-rw-r--r--generic/proof-syntax.el36
1 files changed, 26 insertions, 10 deletions
diff --git a/generic/proof-syntax.el b/generic/proof-syntax.el
index 5f5eeb1a..7d1aef50 100644
--- a/generic/proof-syntax.el
+++ b/generic/proof-syntax.el
@@ -187,25 +187,41 @@ may be a string or sexp evaluated to get a string."
string)
(defun proof-format-filename (string filename)
- "Format STRING by replacing %e, %r by escaped version of FILENAME.
+ "Format STRING by replacing quoted chars by escaped version of FILENAME.
%e uses the canonicalized expanded version of filename (including
directory, using default-directory -- see `expand-file-name').
%r uses the unadjusted (possibly relative) version of FILENAME.
+%m ('module') uses the basename of the file, without directory
+or extension.
+
%s means the same as %e.
Using %e can avoid problems with dumb proof assistants who don't
-understand ~, for example."
- (proof-format
- (list (cons "%s" (proof-format proof-shell-filename-escapes
- (expand-file-name filename)))
- (cons "%e" (proof-format proof-shell-filename-escapes
- (expand-file-name filename)))
- (cons "%r" (proof-format proof-shell-filename-escapes
- filename)))
- string))
+understand ~, for example.
+
+For all these cases, the escapes in `proof-shell-filename-escapes'
+are processed.
+
+If STRING is in fact a function, instead invoke it on FILENAME and
+return the resulting (string) value."
+ (cond
+ ((functionp string)
+ (funcall string filename))
+ (t
+ (proof-format
+ (list (cons "%s" (proof-format proof-shell-filename-escapes
+ (expand-file-name filename)))
+ (cons "%e" (proof-format proof-shell-filename-escapes
+ (expand-file-name filename)))
+ (cons "%r" (proof-format proof-shell-filename-escapes
+ filename))
+ (cons "%m" (proof-format proof-shell-filename-escapes
+ (file-name-nondirectory
+ (file-name-sans-extension filename)))))
+ string))))
;;