From 9a25320acf24020fc0e2b97589f9d996f3d1d4fb Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 13 Dec 2018 22:57:15 -0500 Subject: Fix remaining uses of CL; Make files more declarative MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Emacs occasionally loads Elisp files just to get more info (e.g. for C-h f), so loading a file should "no effect". Fix the most obvious such effects: the splash screen and the autotests by moving those effects into a function. * coq/coq-autotest.el: Make it declarative. Use lexical-binding. (coq-autotest): New function holding the code that used to be at top-level. * generic/proof.el: Use lexical-binding. Don't call proof-splash-message just because we're being loaded. * generic/proof-script.el: Use lexical-scoping; fix all warnings. (pg-show-all-portions): Simplify the code with a closure. (proof-activate-scripting): Declare activated-interactively as dyn-scoped. (proof--splash-done): New var. (proof-mode): Call proof-splash-message upon first use. * generic/proof-splash.el (proof-splash-message): Don't check byte-compile-current-file now that we're only called when the mode is activated. * acl2/acl2.el (auto-mode-alist): Use `add-to-list` and \'. * coq/coq-db.el (coq-build-menu-from-db-internal): Avoid silly O(N²). * coq/coq-seq-compile.el: * coq/coq-par-test.el: * coq/coq-par-compile.el: Fix leftover uses of CL's `assert`. * generic/proof-utils.el: * generic/pg-movie.el: * etc/testsuite/pg-test.el: * coq/coq-syntax.el: Fix leftover uses of CL's `incf`. * generic/pg-autotest.el: Fix leftover uses of CL's `decf`. * obsolete/plastic/plastic.el (plastic-preprocessing): Fix leftover use of CL's `loop`. * generic/pg-user.el (proof-add-completions): Do nothing if no proof-assistant is set yet (i.e. during byte-compilation). (byte-compile-current-file): No need to test this any more. * generic/proof-syntax.el (proof-regexp-alt-list): Use mapconcat. Remove unnecessary "\\(?:...\\)". (proof-regexp-alt): Redefine in terms of proof-regexp-alt-list. --- coq/coq-db.el | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'coq/coq-db.el') diff --git a/coq/coq-db.el b/coq/coq-db.el index 36812c4c..7e59bffb 100644 --- a/coq/coq-db.el +++ b/coq/coq-db.el @@ -25,7 +25,7 @@ (eval-when-compile (require 'cl-lib)) ;decf -(require 'proof-config) ; for proof-face-specs, a macro +(require 'proof-config) (require 'proof-syntax) ; for proof-ids-to-regexp (require 'holes) @@ -187,7 +187,7 @@ Used by `coq-build-menu-from-db', which you should probably use instead. See (let ((l db) (res ()) (size lgth) (keybind-abbrev (substitute-command-keys " \\[expand-abbrev]"))) (while (and l (> size 0)) - (let* ((hd (car l)) + (let* ((hd (pop l)) (menu (nth 0 hd)) ; e1 = menu entry (abbrev (nth 1 hd)) ; e2 = abbreviation (complt (nth 2 hd)) ; e3 = completion @@ -209,10 +209,9 @@ Used by `coq-build-menu-from-db', which you should probably use instead. See ;;insertion function if present otherwise insert completion (if insertfn insertfn `(holes-insert-and-expand ,complt)) t))) - (setq res (nconc res (list menu-entry)))));; append *in place* - (setq l (cdr l)) + (push menu-entry res))) (cl-decf size))) - res)) + (nreverse res))) (defun coq-build-title-menu (db size) @@ -289,10 +288,9 @@ See `coq-syntax-db' for DB structure." ;;A new face for tactics which fail when they don't kill the current goal (defface coq-solve-tactics-face - (proof-face-specs - (:foreground "red") ; pour les fonds clairs - (:foreground "red1") ; pour les fonds foncés - ()) ; pour le noir et blanc + `((((background light)) :foreground "red") + (((background dark)) :foreground "red1") + ()) ; pour le noir et blanc "Face for names of closing tactics in proof scripts." :group 'proof-faces) -- cgit v1.2.3