From e5cc6cf40887970e79c578ecbae00d79c288ccac Mon Sep 17 00:00:00 2001 From: Erik Martin-Dorel Date: Sat, 4 May 2019 00:31:10 +0200 Subject: proof-assistant-format: Support format character "%l" a.k.a. lambda This patch allows one to load the `coq-diffs' option at Coq startup, provided the ambient Coq version is >= 8.10. This additional "lambda" format is needed because [Set Diffs "on".] is neither: - a boolean setting from Coq side (there are three possible values) - a string setting from Emacs side (it is implemented as a radio/symbol option) - a cross-version compatible Coq setting. --- generic/proof-menu.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'generic/proof-menu.el') diff --git a/generic/proof-menu.el b/generic/proof-menu.el index ba3d05ff..c17d4e95 100644 --- a/generic/proof-menu.el +++ b/generic/proof-menu.el @@ -1005,7 +1005,8 @@ We first clear the dynamic settings from `proof-assistant-settings'." (cons "%b" '(proof-assistant-format-bool curvalue)) (cons "%i" '(proof-assistant-format-int curvalue)) (cons "%f" '(proof-assistant-format-float curvalue)) - (cons "%s" '(proof-assistant-format-string curvalue))) + (cons "%s" '(proof-assistant-format-string curvalue)) + (cons "%l" '(proof-assistant-format-lambda curvalue))) "Table to use with `proof-format' for formatting CURVALUE for assistant. NB: variable `curvalue' is dynamically scoped (used in `proof-assistant-format').") @@ -1021,9 +1022,12 @@ NB: variable `curvalue' is dynamically scoped (used in `proof-assistant-format') (defun proof-assistant-format-string (value) (funcall proof-assistant-format-string-fn value)) +(defun proof-assistant-format-lambda (value) + (funcall value)) + (defun proof-assistant-format (string curvalue) "Replace a format characters in STRING by formatted CURVALUE. -Format character is one of %b, %i, %f, or %s. +Format character is one of %b, %i, %f, %s, or %l. Formatting suitable for current proof assistant, controlled by `proof-assistant-format-table' which see. Finally, apply `proof-assistant-setting-format' if non-nil. -- cgit v1.2.3