From 1854459fef368dfc8ca870792e7e3b065a2241c6 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 15 Dec 2018 20:03:43 -0500 Subject: Cosmetic cleanup of coq-smie, coq-syntax, and coq-abbrev. Fix a few more cl.el leftovers. Get rid of remaining use of iso-2022. Use SMIE unconditionally. * coq/coq-abbrev.el: Use lexical-binding. (coq-install-abbrevs): Delete, only keep the relevant contents. (proof-defstringset-fn): Remove. Fold changes into the main version. * coq/coq-indent.el (coq-find-real-start): Use forward-comment. * coq/coq-smie.el: Use lexical-binding. Assume `smie` is available. (coq--string-suffix-p): Rename from coq-string-suffix-p. Use string-suffix-p for it when available. (string-suffix-p): Never define here. Change all users to use coq--string-suffix-p instead. (coq-smie-.-deambiguate): Use forward-comment. Remove unused var `beg`. (coq-backward-token-fast-nogluing-dot-friends) (coq-forward-token-fast-nogluing-dot-friends): Remove unused var `tok-other`. (coq-smie-search-token-backward): Remove unused var `p`. (coq-smie-:=-deambiguate, coq-smie-backward-token): Prefer char-before over looking-back. (coq-smie-rules): Use `pcase` over deprecated cl's `case`. * coq/coq-syntax.el: Use lexical-binding. (coq-count-match): Rewrite so it doesn't do needless heap-allocation. (coq-module-opening-p, coq-section-command-p, coq-goal-command-str-p): Use case-fold-search rather than proof-string-match. (coq-goal-command-regexp): Forward-declare. (coq-save-command-regexp-strict): Move before first use. (coq-reserved-regexp): Use a single \_< ... \_>. (coq-detect-hyps-positions): Limit search for looking-back. * coq/coq.el: Remove SMIE declarations since SMIE is always used. (coq-use-smie): Remove, unused. (coq-smie): Always require. * generic/pg-pbrpm.el: Fix leftover cl.el uses. * generic/proof-utils.el (proof-defstringset-fn): Fix copy&paste error in the docstring, improve interactive prompt. * lib/maths-menu.el: Use utf-8 and lexical-binding. --- generic/proof-utils.el | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'generic/proof-utils.el') diff --git a/generic/proof-utils.el b/generic/proof-utils.el index 1568b2f0..4a15301a 100644 --- a/generic/proof-utils.el +++ b/generic/proof-utils.el @@ -589,25 +589,23 @@ The name of the defined function is returned." `(proof-deffloatset-fn (quote ,var) (quote ,othername))) (defun proof-defstringset-fn (var &optional othername) - "Define a function -toggle for setting an integer customize setting VAR. -Args as for the macro `proof-defstringset', except will be evaluated." + "Define a function OTHERNAME for setting an string customize setting VAR. +OTHERNAME defaults to `VAR-stringset'." (eval - `(defun ,(if othername othername - (intern (concat (symbol-name var) "-stringset"))) (arg) - ,(concat "Set `" (symbol-name var) "' to ARG. -This function simply uses customize-set-variable to set the variable. + `(defun ,(or othername + (intern (concat (symbol-name var) "-stringset"))) + (arg) + ,(concat "Set `" (symbol-name var) "' to ARG. +This function simply uses `customize-set-variable' to set the variable. It was constructed with `proof-defstringset-fn'.") - (interactive ,(format "sValue for %s (a string): " - (symbol-name var))) - (customize-set-variable (quote ,var) arg)))) - -(defmacro proof-defstringset (var &optional othername) - "The setting function uses customize-set-variable to change the variable. -OTHERNAME gives an alternative name than the default -stringset. -The name of the defined function is returned." - `(proof-defstringset-fn (quote ,var) (quote ,othername))) - - + (interactive (list + (read-string + (format "Value for %s (default %s): " + (symbol-name (quote ,var)) + (symbol-value (quote ,var))) + nil nil + (symbol-value (quote ,var))))) + (customize-set-variable (quote ,var) arg)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; -- cgit v1.2.3