From 90a543e630012cc58c175d5bf3ffd42bb156c6b6 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Mon, 30 Nov 2020 22:44:09 +0100 Subject: Decrease code duplication in byte-compiler free-vars warning * lisp/emacs-lisp/bytecomp.el (byte-compile-free-vars-warn): New defun extracted from... (byte-compile-variable-ref, byte-compile-variable-set): ...here. --- lisp/emacs-lisp/bytecomp.el | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 9ece8ec6f02..a20f3634560 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3432,6 +3432,27 @@ for symbols generated by the byte compiler itself." (push var byte-compile-bound-variables) (byte-compile-dynamic-variable-op 'byte-varbind var)) +(defun byte-compile-free-vars-warn (var &optional assignment) + "Warn if symbol VAR refers to a free variable. +VAR must not be lexically bound. +If optional argument ASSIGNMENT is non-nil, this is treated as an +assignment (i.e. `setq'). " + (unless (or (not (byte-compile-warning-enabled-p 'free-vars var)) + (boundp var) + (memq var byte-compile-bound-variables) + (memq var (if assignment + byte-compile-free-assignments + byte-compile-free-references))) + (let* ((varname (prin1-to-string var)) + (desc (if assignment "assignment" "reference")) + (suggestions (help-uni-confusable-suggestions varname))) + (byte-compile-warn "%s to free variable `%s'%s" + desc varname + (if suggestions (concat "\n " suggestions) ""))) + (push var (if assignment + byte-compile-free-assignments + byte-compile-free-references)))) + (defun byte-compile-variable-ref (var) "Generate code to push the value of the variable VAR on the stack." (byte-compile-check-variable var 'reference) @@ -3440,15 +3461,7 @@ for symbols generated by the byte compiler itself." ;; VAR is lexically bound (byte-compile-stack-ref (cdr lex-binding)) ;; VAR is dynamically bound - (unless (or (not (byte-compile-warning-enabled-p 'free-vars var)) - (boundp var) - (memq var byte-compile-bound-variables) - (memq var byte-compile-free-references)) - (let* ((varname (prin1-to-string var)) - (suggestions (help-uni-confusable-suggestions varname))) - (byte-compile-warn "reference to free variable `%s'%s" varname - (if suggestions (concat "\n " suggestions) ""))) - (push var byte-compile-free-references)) + (byte-compile-free-vars-warn var) (byte-compile-dynamic-variable-op 'byte-varref var)))) (defun byte-compile-variable-set (var) @@ -3459,15 +3472,7 @@ for symbols generated by the byte compiler itself." ;; VAR is lexically bound. (byte-compile-stack-set (cdr lex-binding)) ;; VAR is dynamically bound. - (unless (or (not (byte-compile-warning-enabled-p 'free-vars var)) - (boundp var) - (memq var byte-compile-bound-variables) - (memq var byte-compile-free-assignments)) - (let* ((varname (prin1-to-string var)) - (suggestions (help-uni-confusable-suggestions varname))) - (byte-compile-warn "assignment to free variable `%s'%s" varname - (if suggestions (concat "\n " suggestions) ""))) - (push var byte-compile-free-assignments)) + (byte-compile-free-vars-warn var t) (byte-compile-dynamic-variable-op 'byte-varset var)))) (defmacro byte-compile-get-constant (const) -- cgit v1.2.3 From ace6eba036e64ff9eee6965951c48d0634b9c696 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Tue, 1 Dec 2020 13:34:17 +0100 Subject: Fix byte-compiler warning for failed uses of lexical vars * lisp/emacs-lisp/bytecomp.el (byte-compile-form): Fix byte-compiler warning for failed uses of lexical vars. (Bug#44980) * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp--define-warning-file-test): Don't prefix tests with 'warn'. (bytecomp/error-lexical-var-with-add-hook\.el) (bytecomp/error-lexical-var-with-remove-hook\.el) (bytecomp/error-lexical-var-with-run-hook-with-args-until-failure\.el) (bytecomp/error-lexical-var-with-run-hook-with-args-until-success\.el) (bytecomp/error-lexical-var-with-run-hook-with-args\.el) (bytecomp/error-lexical-var-with-symbol-value\.el): New tests. * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-symbol-value.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-success.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-failure.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-remove-hook.el: * test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-add-hook.el: New files. --- lisp/emacs-lisp/bytecomp.el | 2 +- .../error-lexical-var-with-add-hook.el | 4 ++++ .../error-lexical-var-with-remove-hook.el | 4 ++++ ...al-var-with-run-hook-with-args-until-failure.el | 3 +++ ...al-var-with-run-hook-with-args-until-success.el | 3 +++ .../error-lexical-var-with-run-hook-with-args.el | 3 +++ .../error-lexical-var-with-symbol-value.el | 4 ++++ test/lisp/emacs-lisp/bytecomp-tests.el | 26 +++++++++++++++++++--- 8 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-add-hook.el create mode 100644 test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-remove-hook.el create mode 100644 test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-failure.el create mode 100644 test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-success.el create mode 100644 test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args.el create mode 100644 test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-symbol-value.el (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index a20f3634560..879f08a09f6 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3203,7 +3203,7 @@ for symbols generated by the byte compiler itself." run-hook-with-args-until-failure)) (pcase (cdr form) (`(',var . ,_) - (when (assq var byte-compile-lexical-variables) + (when (memq var byte-compile-lexical-variables) (byte-compile-report-error (format-message "%s cannot use lexical var `%s'" fn var)))))) ;; Warn about using obsolete hooks. diff --git a/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-add-hook.el b/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-add-hook.el new file mode 100644 index 00000000000..5f390898e6a --- /dev/null +++ b/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-add-hook.el @@ -0,0 +1,4 @@ +;;; -*- lexical-binding: t; -*- +(let ((foo nil)) + (add-hook 'foo #'next-line) + foo) diff --git a/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-remove-hook.el b/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-remove-hook.el new file mode 100644 index 00000000000..eaa625eba1c --- /dev/null +++ b/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-remove-hook.el @@ -0,0 +1,4 @@ +;;; -*- lexical-binding: t; -*- +(let ((foo nil)) + (remove-hook 'foo #'next-line) + foo) diff --git a/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-failure.el b/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-failure.el new file mode 100644 index 00000000000..7a116ad464b --- /dev/null +++ b/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-failure.el @@ -0,0 +1,3 @@ +;;; -*- lexical-binding: t; -*- +(let ((foo nil)) + (run-hook-with-args-until-failure 'foo)) diff --git a/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-success.el b/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-success.el new file mode 100644 index 00000000000..96d10a343df --- /dev/null +++ b/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args-until-success.el @@ -0,0 +1,3 @@ +;;; -*- lexical-binding: t; -*- +(let ((foo nil)) + (run-hook-with-args-until-success 'foo #'next-line)) diff --git a/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args.el b/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args.el new file mode 100644 index 00000000000..bb9101bd070 --- /dev/null +++ b/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-run-hook-with-args.el @@ -0,0 +1,3 @@ +;;; -*- lexical-binding: t; -*- +(let ((foo nil)) + (run-hook-with-args 'foo)) diff --git a/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-symbol-value.el b/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-symbol-value.el new file mode 100644 index 00000000000..5f390898e6a --- /dev/null +++ b/test/lisp/emacs-lisp/bytecomp-resources/error-lexical-var-with-symbol-value.el @@ -0,0 +1,4 @@ +;;; -*- lexical-binding: t; -*- +(let ((foo nil)) + (add-hook 'foo #'next-line) + foo) diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index bea9663d241..d9052da5436 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -548,7 +548,7 @@ Subtests signal errors if something goes wrong." (should (equal (funcall 'def) -1))) (defmacro bytecomp--define-warning-file-test (file re-warning &optional reverse) - `(ert-deftest ,(intern (format "bytecomp-warn/%s" file)) () + `(ert-deftest ,(intern (format "bytecomp/%s" file)) () :expected-result ,(if reverse :failed :passed) (with-current-buffer (get-buffer-create "*Compile-Log*") (let ((inhibit-read-only t)) (erase-buffer)) @@ -556,9 +556,29 @@ Subtests signal errors if something goes wrong." (ert-info ((buffer-string) :prefix "buffer: ") (should (re-search-forward ,re-warning)))))) -(bytecomp--define-warning-file-test "warn-free-setq.el" "free.*foo") +(bytecomp--define-warning-file-test "error-lexical-var-with-add-hook.el" + "add-hook.*lexical var") -(bytecomp--define-warning-file-test "warn-free-variable-reference.el" "free.*bar") +(bytecomp--define-warning-file-test "error-lexical-var-with-remove-hook.el" + "remove-hook.*lexical var") + +(bytecomp--define-warning-file-test "error-lexical-var-with-run-hook-with-args-until-failure.el" + "args-until-failure.*lexical var") + +(bytecomp--define-warning-file-test "error-lexical-var-with-run-hook-with-args-until-success.el" + "args-until-success.*lexical var") + +(bytecomp--define-warning-file-test "error-lexical-var-with-run-hook-with-args.el" + "args.*lexical var") + +(bytecomp--define-warning-file-test "error-lexical-var-with-symbol-value.el" + "symbol-value.*lexical var") + +(bytecomp--define-warning-file-test "warn-free-setq.el" + "free.*foo") + +(bytecomp--define-warning-file-test "warn-free-variable-reference.el" + "free.*bar") (bytecomp--define-warning-file-test "warn-obsolete-defun.el" "foo-obsolete.*obsolete function.*99.99") -- cgit v1.2.3 From ed1730718f17832d8ee22ea79bedcfa37eedbfb5 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 2 Dec 2020 10:19:16 +0100 Subject: Remove specific byte-compiler warnings for cl.el * lisp/emacs-lisp/bytecomp.el (byte-compile-warning-types) (byte-compile-warnings, byte-compile-cl-file-p) (byte-compile-eval, byte-compile-eval-before-compile) (byte-compile-arglist-warn, byte-compile-find-cl-functions) (byte-compile-cl-warn, displaying-byte-compile-warnings) (byte-compile-file-form-require, byte-compile-form): Remove all specific cl.el warnings, as that library is now obsolete. The regular obsoletion warnings are sufficiently discouraging. * lisp/emacs-lisp/advice.el (ad-compile-function): Don't try to silence the now removed warning. * doc/lispref/tips.texi (Coding Conventions): * doc/misc/cl.texi (Organization): Make recommendation to not use cl.el and cl-compat.el stronger. * lisp/obsolete/cl.el: Make alias help say that they are obsolete. * lisp/obsolete/cl-compat.el (build-klist, safe-idiv) (pair-with-newsyms): Silence byte-compiler. --- doc/lispref/tips.texi | 13 +------ doc/misc/cl.texi | 15 ++------ lisp/emacs-lisp/advice.el | 2 - lisp/emacs-lisp/bytecomp.el | 89 +++------------------------------------------ lisp/obsolete/cl-compat.el | 17 +++++---- lisp/obsolete/cl.el | 4 +- 6 files changed, 24 insertions(+), 116 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi index 40d01d47468..c9a43e0cdeb 100644 --- a/doc/lispref/tips.texi +++ b/doc/lispref/tips.texi @@ -139,17 +139,8 @@ your file do not need to load the extra library. @item If you need Common Lisp extensions, use the @code{cl-lib} library -rather than the old @code{cl} library. The latter does not -use a clean namespace (i.e., its definitions do not -start with a @samp{cl-} prefix). If your package loads @code{cl} at -run time, that could cause name clashes for users who don't use that -package. - -There is no problem with using the @code{cl} package at @emph{compile} -time, with @code{(eval-when-compile (require 'cl))}. That's -sufficient for using the macros in the @code{cl} package, because the -compiler expands them before generating the byte-code. It is still -better to use the more modern @code{cl-lib} in this case, though. +rather than the old @code{cl} library. The latter library is +deprecated and will be removed in a future version of Emacs. @item When defining a major mode, please follow the major mode diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi index 2b38544dc87..084edd11b2d 100644 --- a/doc/misc/cl.texi +++ b/doc/misc/cl.texi @@ -210,17 +210,10 @@ behave in exactly the same way as the @file{cl-lib.el} versions. @c There is also cl-mapc, which was called cl-mapc even before cl-lib.el. @c But not autoloaded, so maybe not much used? -Since the old @file{cl.el} does not use a clean namespace, Emacs has a -policy that packages distributed with Emacs must not load @code{cl} at -run time. (It is ok for them to load @code{cl} at @emph{compile} -time, with @code{eval-when-compile}, and use the macros it provides.) -There is no such restriction on the use of @code{cl-lib}. New code -should use @code{cl-lib} rather than @code{cl}. - -There is one more file, @file{cl-compat.el}, which defines some -routines from the older Quiroz @file{cl.el} package that are not otherwise -present in the new package. This file is obsolete and should not be -used in new code. +The old file @file{cl.el}, as well as the even older +@file{cl-compat.el}, are deprecated and will be removed in a future +version of Emacs. Any existing code that uses them should be updated +to use @file{cl-lib.el} instead. @node Naming Conventions @section Naming Conventions diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index bb45bb37d11..948443fc18a 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el @@ -2224,8 +2224,6 @@ For that it has to be fbound with a non-autoload definition." (let ((byte-compile-warnings byte-compile-warnings) ;; Don't pop up windows showing byte-compiler warnings. (warning-suppress-types '((bytecomp)))) - (if (featurep 'cl) - (byte-compile-disable-warning 'cl-functions)) (byte-compile (ad-get-advice-info-field function 'advicefunname)))) ;; @@@ Accessing argument lists: diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 879f08a09f6..0acd5276977 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -296,7 +296,7 @@ The information is logged to `byte-compile-log-buffer'." (defconst byte-compile-warning-types '(redefine callargs free-vars unresolved - obsolete noruntime cl-functions interactive-only + obsolete noruntime interactive-only make-local mapcar constants suspicious lexical lexical-dynamic) "The list of warning types used when `byte-compile-warnings' is t.") (defcustom byte-compile-warnings t @@ -312,8 +312,6 @@ Elements of the list may be: obsolete obsolete variables and functions. noruntime functions that may not be defined at runtime (typically defined only under `eval-when-compile'). - cl-functions calls to runtime functions (as distinguished from macros and - aliases) from the old CL package (not the newer cl-lib). interactive-only commands that normally shouldn't be called from Lisp code. lexical global/dynamic variables lacking a prefix. @@ -968,11 +966,6 @@ CONST2 may be evaluated multiple times." ;;; compile-time evaluation -(defun byte-compile-cl-file-p (file) - "Return non-nil if FILE is one of the CL files." - (and (stringp file) - (string-match "^cl\\.el" (file-name-nondirectory file)))) - (defun byte-compile-eval (form) "Eval FORM and mark the functions defined therein. Each function's symbol gets added to `byte-compile-noruntime-functions'." @@ -1003,18 +996,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." (when (and (symbolp s) (not (memq s old-autoloads))) (push s byte-compile-noruntime-functions)) (when (and (consp s) (eq t (car s))) - (push (cdr s) old-autoloads))))))) - (when (byte-compile-warning-enabled-p 'cl-functions) - (let ((hist-new load-history)) - ;; Go through load-history, looking for the cl files. - ;; Since new files are added at the start of load-history, - ;; we scan the new history until the tail matches the old. - (while (and (not byte-compile-cl-functions) - hist-new (not (eq hist-new hist-orig))) - ;; We used to check if the file had already been loaded, - ;; but it is better to check non-nil byte-compile-cl-functions. - (and (byte-compile-cl-file-p (car (pop hist-new))) - (byte-compile-find-cl-functions)))))))) + (push (cdr s) old-autoloads)))))))))) (defun byte-compile-eval-before-compile (form) "Evaluate FORM for `eval-and-compile'." @@ -1025,9 +1007,7 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'." ;; There are other ways to do this nowadays. (let ((tem current-load-list)) (while (not (eq tem hist-nil-orig)) - (when (equal (car tem) '(require . cl)) - (byte-compile-disable-warning 'cl-functions)) - (setq tem (cdr tem))))))) + (setq tem (cdr tem))))))) ;;; byte compiler messages @@ -1577,45 +1557,6 @@ extra args." (if (equal sig1 '(1 . 1)) "argument" "arguments") (byte-compile-arglist-signature-string sig2))))))) -(defvar byte-compile-cl-functions nil - "List of functions defined in CL.") - -;; Can't just add this to cl-load-hook, because that runs just before -;; the forms from cl.el get added to load-history. -(defun byte-compile-find-cl-functions () - (unless byte-compile-cl-functions - (dolist (elt load-history) - (and (byte-compile-cl-file-p (car elt)) - (dolist (e (cdr elt)) - ;; Includes the cl-foo functions that cl autoloads. - (when (memq (car-safe e) '(autoload defun)) - (push (cdr e) byte-compile-cl-functions))))))) - -(defun byte-compile-cl-warn (form) - "Warn if FORM is a call of a function from the CL package." - (let ((func (car-safe form))) - (if (and byte-compile-cl-functions - (memq func byte-compile-cl-functions) - ;; Aliases which won't have been expanded at this point. - ;; These aren't all aliases of subrs, so not trivial to - ;; avoid hardwiring the list. - (not (memq func - '(cl--block-wrapper cl--block-throw - multiple-value-call nth-value - copy-seq first second rest endp cl-member - ;; These are included in generated code - ;; that can't be called except at compile time - ;; or unless cl is loaded anyway. - cl--defsubst-expand cl-struct-setf-expander - ;; These would sometimes be warned about - ;; but such warnings are never useful, - ;; so don't warn about them. - macroexpand - cl--compiling-file)))) - (byte-compile-warn "function `%s' from cl package called at runtime" - func))) - form) - (defun byte-compile-print-syms (str1 strn syms) (when syms (byte-compile-set-symbol-position (car syms) t)) @@ -1713,7 +1654,6 @@ extra args." (and (markerp warning-series) (eq (marker-buffer warning-series) (get-buffer byte-compile-log-buffer))))) - (byte-compile-find-cl-functions) (if (or (eq warning-series 'byte-compile-warning-series) warning-series-started) ;; warning-series does come from compilation, @@ -2510,8 +2450,7 @@ list that represents a doc string reference. (put 'require 'byte-hunk-handler 'byte-compile-file-form-require) (defun byte-compile-file-form-require (form) (let ((args (mapcar 'eval (cdr form))) - (hist-orig load-history) - hist-new prov-cons) + hist-new prov-cons) (apply 'require args) ;; Record the functions defined by the require in `byte-compile-new-defuns'. @@ -2524,21 +2463,7 @@ list that represents a doc string reference. (dolist (x (car hist-new)) (when (and (consp x) (memq (car x) '(defun t))) - (push (cdr x) byte-compile-new-defuns)))) - - (when (byte-compile-warning-enabled-p 'cl-functions) - ;; Detect (require 'cl) in a way that works even if cl is already loaded. - (if (member (car args) '("cl" cl)) - (progn - (byte-compile-warn "cl package required at runtime") - (byte-compile-disable-warning 'cl-functions)) - ;; We may have required something that causes cl to be loaded, eg - ;; the uncompiled version of a file that requires cl when compiling. - (setq hist-new load-history) - (while (and (not byte-compile-cl-functions) - hist-new (not (eq hist-new hist-orig))) - (and (byte-compile-cl-file-p (car (pop hist-new))) - (byte-compile-find-cl-functions)))))) + (push (cdr x) byte-compile-new-defuns))))) (byte-compile-keep-pending form 'byte-compile-normal-call)) (put 'progn 'byte-hunk-handler 'byte-compile-file-form-progn) @@ -3239,9 +3164,7 @@ for symbols generated by the byte compiler itself." ;; differently now). (not (eq handler 'cl-byte-compile-compiler-macro)))) (funcall handler form) - (byte-compile-normal-call form)) - (if (byte-compile-warning-enabled-p 'cl-functions) - (byte-compile-cl-warn form)))) + (byte-compile-normal-call form)))) ((and (byte-code-function-p (car form)) (memq byte-optimize '(t lap))) (byte-compile-unfold-bcf form)) diff --git a/lisp/obsolete/cl-compat.el b/lisp/obsolete/cl-compat.el index b2471523d14..c37fc8eb5bb 100644 --- a/lisp/obsolete/cl-compat.el +++ b/lisp/obsolete/cl-compat.el @@ -111,8 +111,9 @@ (defun build-klist (arglist keys &optional allow-others) (let ((res (Multiple-value-call 'mapcar* 'cons (unzip-lists arglist)))) (or allow-others - (let ((bad (set-difference (mapcar 'car res) keys))) - (if bad (error "Bad keywords: %s not in %s" bad keys)))) + (with-suppressed-warnings ((obsolete set-difference)) + (let ((bad (set-difference (mapcar 'car res) keys))) + (if bad (error "Bad keywords: %s not in %s" bad keys))))) res)) (defun extract-from-klist (klist key &optional def) @@ -130,16 +131,18 @@ (funcall (or test 'eql) item elt)))) (defun safe-idiv (a b) - (let* ((q (/ (abs a) (abs b))) - (s (* (signum a) (signum b)))) - (Values q (- a (* s q b)) s))) + (with-suppressed-warnings ((obsolete signum)) + (let* ((q (/ (abs a) (abs b))) + (s (* (signum a) (signum b)))) + (Values q (- a (* s q b)) s)))) ;; Internal routines. (defun pair-with-newsyms (oldforms) - (let ((newsyms (mapcar (lambda (x) (make-symbol "--cl-var--")) oldforms))) - (Values (mapcar* 'list newsyms oldforms) newsyms))) + (with-suppressed-warnings ((obsolete mapcar*)) + (let ((newsyms (mapcar (lambda (x) (make-symbol "--cl-var--")) oldforms))) + (Values (mapcar* 'list newsyms oldforms) newsyms)))) (defun zip-lists (evens odds) (cl-mapcan 'list evens odds)) diff --git a/lisp/obsolete/cl.el b/lisp/obsolete/cl.el index 20bffffd781..6a628f305cf 100644 --- a/lisp/obsolete/cl.el +++ b/lisp/obsolete/cl.el @@ -113,7 +113,7 @@ most-positive-float ;; custom-print-functions )) - (defvaralias var (intern (format "cl-%s" var)))) + (define-obsolete-variable-alias var (intern (format "cl-%s" var)) "27.1")) (dolist (fun '( (get* . cl-get) @@ -291,7 +291,7 @@ )) (let ((new (if (consp fun) (prog1 (cdr fun) (setq fun (car fun))) (intern (format "cl-%s" fun))))) - (defalias fun new))) + (define-obsolete-function-alias fun new "27.1"))) (defun cl--wrap-in-nil-block (fun &rest args) `(cl-block nil ,(apply fun args))) -- cgit v1.2.3 From 4594d6f59a0f0c229ded9874a38ae5acf9fe5647 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Thu, 3 Dec 2020 09:50:58 +0100 Subject: Remove redundant requires of 'custom' * lisp/emacs-lisp/eieio-custom.el: * lisp/htmlfontify.el: * lisp/mwheel.el: * lisp/net/eudc-vars.el: * lisp/net/ldap.el: * lisp/net/tramp-ftp.el: * lisp/net/tramp-gvfs.el: * lisp/progmodes/cwarn.el: * lisp/progmodes/sql.el: * lisp/savehist.el: * lisp/textmodes/reftex.el: * lisp/wid-browse.el: Don't require 'custom'; it is preloaded since version 20.1. --- lisp/emacs-lisp/eieio-custom.el | 1 - lisp/htmlfontify.el | 2 -- lisp/mwheel.el | 1 - lisp/net/eudc-vars.el | 2 -- lisp/net/ldap.el | 1 - lisp/net/tramp-ftp.el | 1 - lisp/net/tramp-gvfs.el | 2 -- lisp/progmodes/cwarn.el | 1 - lisp/progmodes/sql.el | 1 - lisp/savehist.el | 2 -- lisp/textmodes/reftex.el | 4 ---- lisp/wid-browse.el | 1 - 12 files changed, 19 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/eieio-custom.el b/lisp/emacs-lisp/eieio-custom.el index e26dc9e9a9c..3a9d8672e46 100644 --- a/lisp/emacs-lisp/eieio-custom.el +++ b/lisp/emacs-lisp/eieio-custom.el @@ -33,7 +33,6 @@ (require 'eieio) (require 'widget) (require 'wid-edit) -(require 'custom) ;;; Compatibility diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el index 4977e08c3da..c9ede657f54 100644 --- a/lisp/htmlfontify.el +++ b/lisp/htmlfontify.el @@ -78,8 +78,6 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) -(require 'custom) -;; (`defgroup' `defcustom') (require 'cus-edit) (require 'htmlfontify-loaddefs) diff --git a/lisp/mwheel.el b/lisp/mwheel.el index 1d9fe68075b..9fd050fea58 100644 --- a/lisp/mwheel.el +++ b/lisp/mwheel.el @@ -37,7 +37,6 @@ ;; 'mwheel-down', but I cannot find a way to do this very easily (or ;; portably), so for now I just live with it. -(require 'custom) (require 'timer) (defvar mouse-wheel-mode) diff --git a/lisp/net/eudc-vars.el b/lisp/net/eudc-vars.el index bb1474b8b5b..2306d7b99a4 100644 --- a/lisp/net/eudc-vars.el +++ b/lisp/net/eudc-vars.el @@ -27,8 +27,6 @@ ;;; Code: -(require 'custom) - ;;{{{ EUDC Main Custom Group (defgroup eudc nil diff --git a/lisp/net/ldap.el b/lisp/net/ldap.el index 5639d52f815..0016af292ef 100644 --- a/lisp/net/ldap.el +++ b/lisp/net/ldap.el @@ -33,7 +33,6 @@ ;;; Code: -(require 'custom) (require 'password-cache) (autoload 'auth-source-search "auth-source") diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el index 996a92454f1..329a490c7ae 100644 --- a/lisp/net/tramp-ftp.el +++ b/lisp/net/tramp-ftp.el @@ -31,7 +31,6 @@ (require 'tramp) ;; Pacify byte-compiler. -(eval-when-compile (require 'custom)) (defvar ange-ftp-ftp-name-arg) (defvar ange-ftp-ftp-name-res) (defvar ange-ftp-name-format) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 7970488b40d..f3d03d0fb0a 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -108,8 +108,6 @@ (require 'url-util) ;; Pacify byte-compiler. -(eval-when-compile (require 'custom)) - (declare-function zeroconf-init "zeroconf") (declare-function zeroconf-list-service-types "zeroconf") (declare-function zeroconf-list-services "zeroconf") diff --git a/lisp/progmodes/cwarn.el b/lisp/progmodes/cwarn.el index 0571739344e..b09a2ed7865 100644 --- a/lisp/progmodes/cwarn.el +++ b/lisp/progmodes/cwarn.el @@ -104,7 +104,6 @@ ;;{{{ Dependencies -(require 'custom) (require 'cc-mode) ;;}}} diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el index 22099394ff0..0bf9a517aa6 100644 --- a/lisp/progmodes/sql.el +++ b/lisp/progmodes/sql.el @@ -232,7 +232,6 @@ (require 'cl-lib) (require 'comint) -(require 'custom) (require 'thingatpt) (require 'view) (eval-when-compile (require 'subr-x)) ; string-empty-p diff --git a/lisp/savehist.el b/lisp/savehist.el index 5d20239d17f..8931e83243d 100644 --- a/lisp/savehist.el +++ b/lisp/savehist.el @@ -47,8 +47,6 @@ ;;; Code: -(require 'custom) - ;; User variables (defgroup savehist nil diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el index 29ebab5f9bb..b1fa79ae2ac 100644 --- a/lisp/textmodes/reftex.el +++ b/lisp/textmodes/reftex.el @@ -51,10 +51,6 @@ ;;; Code: (eval-when-compile (require 'cl-lib)) - -;; Stuff that needs to be there when we use defcustom -(require 'custom) - (require 'easymenu) (defvar reftex-tables-dirty t diff --git a/lisp/wid-browse.el b/lisp/wid-browse.el index f5c3d486f4d..bc2e3c4c12b 100644 --- a/lisp/wid-browse.el +++ b/lisp/wid-browse.el @@ -28,7 +28,6 @@ ;;; Code: (require 'easymenu) -(require 'custom) (require 'wid-edit) (defgroup widget-browse nil -- cgit v1.2.3 From fddf68cd81002817bde016578db6bf0e4b11717f Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 2 Dec 2020 15:49:56 +0100 Subject: Remove redundant requires of 'button' * lisp/apropos.el: * lisp/emacs-lisp/cl-print.el: * lisp/emacs-lisp/debug.el: * lisp/emacs-lisp/ert.el: * lisp/emacs-lisp/shadow.el: * lisp/facemenu.el: * lisp/help-mode.el: * lisp/man.el: * lisp/progmodes/etags.el: * lisp/textmodes/bibtex.el: * lisp/woman.el: Don't require 'button'; it is preloaded since version 23.1. --- lisp/apropos.el | 2 -- lisp/emacs-lisp/cl-print.el | 2 -- lisp/emacs-lisp/debug.el | 1 - lisp/emacs-lisp/ert.el | 1 - lisp/emacs-lisp/shadow.el | 1 - lisp/facemenu.el | 3 +-- lisp/help-mode.el | 1 - lisp/man.el | 1 - lisp/progmodes/etags.el | 1 - lisp/textmodes/bibtex.el | 2 -- lisp/woman.el | 1 - 11 files changed, 1 insertion(+), 15 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/apropos.el b/lisp/apropos.el index 9debdfb19ce..595db1d2f8e 100644 --- a/lisp/apropos.el +++ b/lisp/apropos.el @@ -56,8 +56,6 @@ ;;; Code: -(require 'button) - (defgroup apropos nil "Apropos commands for users and programmers." :group 'help diff --git a/lisp/emacs-lisp/cl-print.el b/lisp/emacs-lisp/cl-print.el index 1043cf7b175..0375c57f77d 100644 --- a/lisp/emacs-lisp/cl-print.el +++ b/lisp/emacs-lisp/cl-print.el @@ -33,8 +33,6 @@ ;;; Code: -(require 'button) - (defvar cl-print-readably nil "If non-nil, try and make sure the result can be `read'.") diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 0e4135b253e..11ef836563d 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -29,7 +29,6 @@ (require 'cl-lib) (require 'backtrace) -(require 'button) (defgroup debugger nil "Debuggers and related commands for Emacs." diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index baa04f2c6af..7442a247f9e 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -58,7 +58,6 @@ ;;; Code: (require 'cl-lib) -(require 'button) (require 'debug) (require 'backtrace) (require 'easymenu) diff --git a/lisp/emacs-lisp/shadow.el b/lisp/emacs-lisp/shadow.el index dd614dd792c..f1863869dd3 100644 --- a/lisp/emacs-lisp/shadow.el +++ b/lisp/emacs-lisp/shadow.el @@ -183,7 +183,6 @@ See the documentation for `list-load-path-shadows' for further information." buffer-read-only t)) ;; TODO use text-properties instead, a la dired. -(require 'button) (define-button-type 'load-path-shadows-find-file 'follow-link t ;; 'face 'default diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 3ed4b54d223..e7f3f7bb03b 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -86,8 +86,7 @@ ;;; Code: (eval-when-compile - (require 'help) - (require 'button)) + (require 'help)) ;; Global bindings: (define-key global-map [C-down-mouse-2] 'facemenu-menu) diff --git a/lisp/help-mode.el b/lisp/help-mode.el index f0770fb6602..732e6cc28dd 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -29,7 +29,6 @@ ;;; Code: -(require 'button) (require 'cl-lib) (eval-when-compile (require 'easymenu)) diff --git a/lisp/man.el b/lisp/man.el index 07af5ea0ff0..991b1bb60e5 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -90,7 +90,6 @@ (require 'ansi-color) (require 'cl-lib) -(require 'button) (defgroup man nil "Browse UNIX manual pages." diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el index 8879726ad59..104d889b8be 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el @@ -34,7 +34,6 @@ ;; prefixes but somewhere within the name. (require 'ring) -(require 'button) (require 'xref) (require 'fileloop) diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el index 4dc68c40044..77fc6990d9c 100644 --- a/lisp/textmodes/bibtex.el +++ b/lisp/textmodes/bibtex.el @@ -40,8 +40,6 @@ ;;; Code: -(require 'button) - ;; User Options: diff --git a/lisp/woman.el b/lisp/woman.el index 96ae7fe5794..33a6a0dfbdb 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -404,7 +404,6 @@ (make-obsolete-variable 'woman-version nil "28.1") (require 'man) -(require 'button) (define-button-type 'WoMan-xref-man-page :supertype 'Man-abstract-xref-man-page 'func (lambda (arg) -- cgit v1.2.3 From 9b2e5b230156fa871f48fd5788e76dd9d33c059c Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 2 Dec 2020 15:56:54 +0100 Subject: Remove redundant requires of 'help' * lisp/emacs-lisp/advice.el (ad-read-advised-function): * lisp/emacs-lisp/ert.el: * lisp/facemenu.el: Don't require 'help'; it is preloaded since version 18.59. --- lisp/emacs-lisp/advice.el | 3 +-- lisp/emacs-lisp/ert.el | 1 - lisp/facemenu.el | 3 --- 3 files changed, 1 insertion(+), 6 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index 948443fc18a..c8a6676b665 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el @@ -1840,8 +1840,7 @@ function at point for which PREDICATE returns non-nil)." (or default ;; Prefer func name at point, if it's an advised function etc. (let ((function (progn - (require 'help) - (function-called-at-point)))) + (function-called-at-point)))) (and function (member (symbol-name function) ad-advised-functions) (or (null predicate) diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 7442a247f9e..e5ac1d1f1cb 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -63,7 +63,6 @@ (require 'easymenu) (require 'ewoc) (require 'find-func) -(require 'help) (require 'pp) ;;; UI customization options. diff --git a/lisp/facemenu.el b/lisp/facemenu.el index e7f3f7bb03b..cdff4b8f3e6 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -85,9 +85,6 @@ ;;; Code: -(eval-when-compile - (require 'help)) - ;; Global bindings: (define-key global-map [C-down-mouse-2] 'facemenu-menu) (define-key global-map "\M-o" 'facemenu-keymap) -- cgit v1.2.3 From 81fe928a769d9a63078aa1144335c204a2541595 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 4 Dec 2020 19:12:12 +0100 Subject: Prefer setq-local in emacs-lisp/*.el * lisp/emacs-lisp/chart.el (chart-mode): * lisp/emacs-lisp/copyright.el (copyright-update): * lisp/emacs-lisp/eieio-custom.el (eieio-customize-object): * lisp/emacs-lisp/elint.el (elint-update-env, elint-init-form): * lisp/emacs-lisp/ert.el (ert--results-update-ewoc-hf): (ert--setup-results-buffer): * lisp/emacs-lisp/lisp-mode.el (lisp-mode-variables): * lisp/emacs-lisp/pp.el (pp-display-expression): * lisp/emacs-lisp/re-builder.el (reb-mode, reb-restart-font-lock): * lisp/emacs-lisp/shadow.el (load-path-shadows-mode): * lisp/emacs-lisp/smie.el (smie-setup): * lisp/emacs-lisp/syntax.el (syntax-propertize): * lisp/emacs-lisp/trace.el (trace-make-advice): Prefer setq-local. --- lisp/emacs-lisp/chart.el | 2 +- lisp/emacs-lisp/copyright.el | 2 +- lisp/emacs-lisp/eieio-custom.el | 9 +++------ lisp/emacs-lisp/elint.el | 13 ++++++------- lisp/emacs-lisp/ert.el | 20 ++++++++++---------- lisp/emacs-lisp/lisp-mode.el | 2 +- lisp/emacs-lisp/pp.el | 2 +- lisp/emacs-lisp/re-builder.el | 6 +++--- lisp/emacs-lisp/shadow.el | 4 ++-- lisp/emacs-lisp/smie.el | 4 ++-- lisp/emacs-lisp/syntax.el | 2 +- lisp/emacs-lisp/trace.el | 2 +- 12 files changed, 32 insertions(+), 36 deletions(-) (limited to 'lisp/emacs-lisp') diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el index 177710038a0..c1c6e3bf0fd 100644 --- a/lisp/emacs-lisp/chart.el +++ b/lisp/emacs-lisp/chart.el @@ -120,7 +120,7 @@ too much in text characters anyways.") (define-derived-mode chart-mode special-mode "Chart" "Define a mode in Emacs for displaying a chart." (buffer-disable-undo) - (set (make-local-variable 'font-lock-global-modes) nil) + (setq-local font-lock-global-modes nil) (font-lock-mode -1) ;Isn't it off already? --Stef ) diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el index 9828ca63ebc..edeeb03c32a 100644 --- a/lisp/emacs-lisp/copyright.el +++ b/lisp/emacs-lisp/copyright.el @@ -256,7 +256,7 @@ interactively." (match-string-no-properties 1) copyright-current-gpl-version))))) (replace-match copyright-current-gpl-version t t nil 1)))) - (set (make-local-variable 'copyright-update) nil))) + (setq-local copyright-update nil))) ;; If a write-file-hook returns non-nil, the file is presumed to be written. nil)) diff --git a/lisp/emacs-lisp/eieio-custom.el b/lisp/emacs-lisp/eieio-custom.el index 3a9d8672e46..c1378cbeb79 100644 --- a/lisp/emacs-lisp/eieio-custom.el +++ b/lisp/emacs-lisp/eieio-custom.el @@ -365,8 +365,7 @@ These groups are specified with the `:group' slot flag." (widget-insert "\n\n") (widget-insert "Edit object " (eieio-object-name obj) "\n\n") ;; Create the widget editing the object. - (make-local-variable 'eieio-wo) - (setq eieio-wo (eieio-custom-widget-insert obj :eieio-group g)) + (setq-local eieio-wo (eieio-custom-widget-insert obj :eieio-group g)) ;;Now generate the apply buttons (widget-insert "\n") (eieio-custom-object-apply-reset obj) @@ -375,10 +374,8 @@ These groups are specified with the `:group' slot flag." ;;(widget-minor-mode) (goto-char (point-min)) (widget-forward 3) - (make-local-variable 'eieio-co) - (setq eieio-co obj) - (make-local-variable 'eieio-cog) - (setq eieio-cog g))) + (setq-local eieio-co obj) + (setq-local eieio-cog g))) (cl-defmethod eieio-custom-object-apply-reset ((_obj eieio-default-superclass)) "Insert an Apply and Reset button into the object editor. diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el index e2cffedd45f..ef97c8279d7 100644 --- a/lisp/emacs-lisp/elint.el +++ b/lisp/emacs-lisp/elint.el @@ -355,15 +355,14 @@ Returns the forms." ;; Env is up to date elint-buffer-forms ;; Remake env - (set (make-local-variable 'elint-buffer-forms) (elint-get-top-forms)) - (set (make-local-variable 'elint-features) nil) - (set (make-local-variable 'elint-buffer-env) - (elint-init-env elint-buffer-forms)) + (setq-local elint-buffer-forms (elint-get-top-forms)) + (setq-local elint-features nil) + (setq-local elint-buffer-env (elint-init-env elint-buffer-forms)) (if elint-preloaded-env ;; FIXME: This doesn't do anything! Should we setq the result to ;; elint-buffer-env? (elint-env-add-env elint-preloaded-env elint-buffer-env)) - (set (make-local-variable 'elint-last-env-time) (buffer-modified-tick)) + (setq-local elint-last-env-time (buffer-modified-tick)) elint-buffer-forms)) (defun elint-get-top-forms () @@ -456,8 +455,8 @@ Return nil if there are no more forms, t otherwise." (= 4 (length form)) (eq (car-safe (cadr form)) 'quote) (equal (nth 2 form) '(quote error-conditions))) - (set (make-local-variable 'elint-extra-errors) - (cons (cadr (cadr form)) elint-extra-errors))) + (setq-local elint-extra-errors + (cons (cadr (cadr form)) elint-extra-errors))) ((eq (car form) 'provide) (add-to-list 'elint-features (eval (cadr form)))) ;; Import variable definitions diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index e5ac1d1f1cb..5f29c2665a3 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -1802,8 +1802,8 @@ Also sets `ert--results-progress-bar-button-begin'." ;; `progress-bar-button-begin' will be the right position ;; even in the results buffer. (with-current-buffer results-buffer - (set (make-local-variable 'ert--results-progress-bar-button-begin) - progress-bar-button-begin)))) + (setq-local ert--results-progress-bar-button-begin + progress-bar-button-begin)))) (insert "\n\n") (buffer-string)) ;; footer @@ -1979,15 +1979,15 @@ BUFFER-NAME, if non-nil, is the buffer name to use." ;; from ert-results-mode to ert-results-mode when ;; font-lock-mode turns itself off in change-major-mode-hook.) (erase-buffer) - (set (make-local-variable 'font-lock-function) - 'ert--results-font-lock-function) + (setq-local font-lock-function + 'ert--results-font-lock-function) (let ((ewoc (ewoc-create 'ert--print-test-for-ewoc nil nil t))) - (set (make-local-variable 'ert--results-ewoc) ewoc) - (set (make-local-variable 'ert--results-stats) stats) - (set (make-local-variable 'ert--results-progress-bar-string) - (make-string (ert-stats-total stats) - (ert-char-for-test-result nil t))) - (set (make-local-variable 'ert--results-listener) listener) + (setq-local ert--results-ewoc ewoc) + (setq-local ert--results-stats stats) + (setq-local ert--results-progress-bar-string + (make-string (ert-stats-total stats) + (ert-char-for-test-result nil t))) + (setq-local ert--results-listener listener) (cl-loop for test across (ert--stats-tests stats) do (ewoc-enter-last ewoc (make-ert--ewoc-entry :test test diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index cc40af7a41c..081ef8d441a 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -634,7 +634,7 @@ font-lock keywords will not be case sensitive." ;; and should make no difference for explicit fill ;; because lisp-fill-paragraph should do the job. ;; I believe that newcomment's auto-fill code properly deals with it -stef - ;;(set (make-local-variable 'adaptive-fill-mode) nil) + ;;(setq-local adaptive-fill-mode nil) (setq-local indent-line-function 'lisp-indent-line) (setq-local indent-region-function 'lisp-indent-region) (setq-local comment-indent-function #'lisp-comment-indent) diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el index 458f803ffe3..de7d2020ea8 100644 --- a/lisp/emacs-lisp/pp.el +++ b/lisp/emacs-lisp/pp.el @@ -118,7 +118,7 @@ after OUT-BUFFER-NAME." (with-current-buffer standard-output (emacs-lisp-mode) (setq buffer-read-only nil) - (set (make-local-variable 'font-lock-verbose) nil))))) + (setq-local font-lock-verbose nil))))) ;;;###autoload (defun pp-eval-expression (expression) diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el index 78ae3a8c1e5..ffbf3b4b4dd 100644 --- a/lisp/emacs-lisp/re-builder.el +++ b/lisp/emacs-lisp/re-builder.el @@ -271,7 +271,7 @@ Except for Lisp syntax this is the same as `reb-regexp'.") (define-derived-mode reb-mode nil "RE Builder" "Major mode for interactively building Regular Expressions." - (set (make-local-variable 'blink-matching-paren) nil) + (setq-local blink-matching-paren nil) (reb-mode-common)) (defvar reb-lisp-mode-map @@ -832,8 +832,8 @@ If SUBEXP is non-nil mark only the corresponding sub-expressions." (let ((font-lock-is-on font-lock-mode)) (font-lock-mode -1) (kill-local-variable 'font-lock-set-defaults) - ;;(set (make-local-variable 'reb-re-syntax) 'string) - ;;(set (make-local-variable 'reb-re-syntax) 'rx) + ;;(setq-local reb-re-syntax 'string) + ;;(setq-local reb-re-syntax 'rx) (setq font-lock-defaults (cond ((memq reb-re-syntax '(read string)) diff --git a/lisp/emacs-lisp/shadow.el b/lisp/emacs-lisp/shadow.el index f1863869dd3..68f58f69f7b 100644 --- a/lisp/emacs-lisp/shadow.el +++ b/lisp/emacs-lisp/shadow.el @@ -177,8 +177,8 @@ See the documentation for `list-load-path-shadows' for further information." (define-derived-mode load-path-shadows-mode fundamental-mode "LP-Shadows" "Major mode for load-path shadows buffer." - (set (make-local-variable 'font-lock-defaults) - '((load-path-shadows-font-lock-keywords))) + (setq-local font-lock-defaults + '((load-path-shadows-font-lock-keywords))) (setq buffer-undo-list t buffer-read-only t)) diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el index 1b700afd12d..355dd0f49e8 100644 --- a/lisp/emacs-lisp/smie.el +++ b/lisp/emacs-lisp/smie.el @@ -1891,9 +1891,9 @@ KEYWORDS are additional arguments, which can use the following keywords: (v (pop keywords))) (pcase k (:forward-token - (set (make-local-variable 'smie-forward-token-function) v)) + (setq-local smie-forward-token-function v)) (:backward-token - (set (make-local-variable 'smie-backward-token-function) v)) + (setq-local smie-backward-token-function v)) (_ (message "smie-setup: ignoring unknown keyword %s" k))))) (let ((ca (cdr (assq :smie-closer-alist grammar)))) (when ca diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el index 62f1b16d75c..e35f9d89ded 100644 --- a/lisp/emacs-lisp/syntax.el +++ b/lisp/emacs-lisp/syntax.el @@ -353,7 +353,7 @@ set by `syntax-propertize'") (setq syntax-propertize--done (max (point-max) pos)) ;; (message "Needs to syntax-propertize from %s to %s" ;; syntax-propertize--done pos) - (set (make-local-variable 'parse-sexp-lookup-properties) t) + (setq-local parse-sexp-lookup-properties t) (when (< syntax-propertize--done (point-min)) ;; *Usually* syntax-propertize is called via syntax-ppss which ;; takes care of adding syntax-ppss-flush-cache to b-c-f, but this diff --git a/lisp/emacs-lisp/trace.el b/lisp/emacs-lisp/trace.el index 627305689c7..28e964ec4c2 100644 --- a/lisp/emacs-lisp/trace.el +++ b/lisp/emacs-lisp/trace.el @@ -225,7 +225,7 @@ be printed along with the arguments in the trace." (ctx (funcall context))) (unless inhibit-trace (with-current-buffer trace-buffer - (set (make-local-variable 'window-point-insertion-type) t) + (setq-local window-point-insertion-type t) (unless background (trace--display-buffer trace-buffer)) (goto-char (point-max)) ;; Insert a separator from previous trace output: -- cgit v1.2.3