From 24b9515da0588aca38a1bce5f615e0cdf7891388 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 31 Jan 2021 18:00:39 -0500 Subject: * admin/*.el: Use lexical-binding * admin/admin.el: Use lexical-binding. (manual-misc-manuals): Pass a limit to `looking-back`. (reminder-for-release-blocking-bugs): Don't use `_` for a real variable. * admin/authors.el: Use lexical-binding. (authors-disambiguate-file-name): Remove unused var `parent`. * admin/cus-test.el: * admin/find-gc.el: * admin/gitmerge.el: Use lexical-binding. --- admin/admin.el | 18 ++++++++++++------ admin/authors.el | 20 ++++++++++---------- admin/cus-test.el | 17 +++++++++-------- admin/find-gc.el | 25 +++++++++++++------------ admin/gitmerge.el | 6 +++--- 5 files changed, 47 insertions(+), 39 deletions(-) diff --git a/admin/admin.el b/admin/admin.el index fa96b7e5cac..d032c1ceb85 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -1,4 +1,4 @@ -;;; admin.el --- utilities for Emacs administration +;;; admin.el --- utilities for Emacs administration -*- lexical-binding: t; -*- ;; Copyright (C) 2001-2021 Free Software Foundation, Inc. @@ -254,7 +254,7 @@ ROOT should be the root of an Emacs source tree." (search-forward "INFO_COMMON = ") (let ((start (point))) (end-of-line) - (while (and (looking-back "\\\\") + (while (and (looking-back "\\\\" (- (point) 2)) (zerop (forward-line 1))) (end-of-line)) (append (split-string (replace-regexp-in-string @@ -930,13 +930,19 @@ changes (in a non-trivial way). This function does not check for that." (interactive (list (progn (require 'debbugs-gnu) + (defvar debbugs-gnu-emacs-blocking-reports) + (defvar debbugs-gnu-emacs-current-release) (completing-read "Emacs release: " (mapcar #'identity debbugs-gnu-emacs-blocking-reports) nil t debbugs-gnu-emacs-current-release)))) (require 'debbugs-gnu) + (declare-function debbugs-get-status "debbugs" (&rest bug-numbers)) + (declare-function debbugs-get-attribute "debbugs" (bug-or-message attribute)) (require 'reporter) + (declare-function mail-position-on-field "sendmail" (field &optional soft)) + (declare-function mail-text "sendmail" ()) (when-let ((id (alist-get version debbugs-gnu-emacs-blocking-reports nil nil #'string-equal)) @@ -958,11 +964,11 @@ changes (in a non-trivial way). This function does not check for that." (insert " The following bugs are regarded as release-blocking for Emacs " version ". People are encouraged to work on them with priority.\n\n") - (dolist (_ blockedby-status) - (unless (equal (debbugs-get-attribute _ 'pending) "done") + (dolist (i blockedby-status) + (unless (equal (debbugs-get-attribute i 'pending) "done") (insert (format "bug#%d %s\n" - (debbugs-get-attribute _ 'id) - (debbugs-get-attribute _ 'subject))))) + (debbugs-get-attribute i 'id) + (debbugs-get-attribute i 'subject))))) (insert " If you use the debbugs package from GNU ELPA, you can apply the following form to see all bugs which block a given release: diff --git a/admin/authors.el b/admin/authors.el index 0180ffea250..6c81c7872fc 100644 --- a/admin/authors.el +++ b/admin/authors.el @@ -1,4 +1,4 @@ -;;; authors.el --- utility for maintaining Emacs's AUTHORS file +;;; authors.el --- utility for maintaining Emacs's AUTHORS file -*- lexical-binding: t; -*- ;; Copyright (C) 2000-2021 Free Software Foundation, Inc. @@ -1254,7 +1254,7 @@ Additionally, for these logs we apply the `lax' elements of (defun authors-disambiguate-file-name (fullname) "Convert FULLNAME to an unambiguous relative-name." (let ((relname (file-name-nondirectory fullname)) - dir parent) + dir) (if (and (member relname authors-ambiguous-files) ;; Try to identify the top-level directory. ;; FIXME should really use ROOT from M-x authors. @@ -1266,8 +1266,8 @@ Additionally, for these logs we apply the `lax' elements of ;; I think it looks weird to see eg "lisp/simple.el". ;; But for eg Makefile.in, we do want to say "lisp/Makefile.in". (if (and (string-equal "lisp" - (setq parent (file-name-nondirectory - (directory-file-name dir)))) + (file-name-nondirectory + (directory-file-name dir))) ;; TODO better to simply have hard-coded list? ;; Only really Makefile.in where this applies. (not (file-exists-p @@ -1569,9 +1569,9 @@ and changed by AUTHOR." (cons (cons file (cdr (assq :changed actions))) changed-list)))))) (if wrote-list - (setq wrote-list (sort wrote-list 'string-lessp))) + (setq wrote-list (sort wrote-list #'string-lessp))) (if cowrote-list - (setq cowrote-list (sort cowrote-list 'string-lessp))) + (setq cowrote-list (sort cowrote-list #'string-lessp))) (when changed-list (setq changed-list (sort changed-list (lambda (a b) @@ -1579,7 +1579,7 @@ and changed by AUTHOR." (string-lessp (car a) (car b)) (> (cdr a) (cdr b)))))) (setq nchanged (length changed-list)) - (setq changed-list (mapcar 'car changed-list))) + (setq changed-list (mapcar #'car changed-list))) (if (> (- nchanged authors-many-files) 2) (setcdr (nthcdr authors-many-files changed-list) (list (format "and %d other files" (- nchanged authors-many-files))))) @@ -1688,12 +1688,12 @@ list of their contributions.\n") (when authors-invalid-file-names (insert "Unrecognized file entries found:\n\n") (mapc (lambda (f) (if (not (string-match "^[A-Za-z]+$" f)) (insert f "\n"))) - (sort authors-invalid-file-names 'string-lessp))) + (sort authors-invalid-file-names #'string-lessp))) (when authors-ignored-names (insert "\n\nThese authors were ignored:\n\n" (mapconcat - 'identity - (sort authors-ignored-names 'string-lessp) "\n"))) + #'identity + (sort authors-ignored-names #'string-lessp) "\n"))) (goto-char (point-min)) (compilation-mode) (message "Errors were found. See buffer %s" (buffer-name)))) diff --git a/admin/cus-test.el b/admin/cus-test.el index aca7b68aa7a..995586f9c71 100644 --- a/admin/cus-test.el +++ b/admin/cus-test.el @@ -1,4 +1,4 @@ -;;; cus-test.el --- tests for custom types and load problems +;;; cus-test.el --- tests for custom types and load problems -*- lexical-binding: t; -*- ;; Copyright (C) 1998, 2000, 2002-2021 Free Software Foundation, Inc. @@ -112,6 +112,7 @@ Names should be as they appear in loaddefs.el.") ;; This avoids a hang of `cus-test-apropos' in 21.2. ;; (add-to-list 'cus-test-skip-list 'sh-alias-alist) +(defvar viper-mode) (or noninteractive ;; Never Viperize. (setq viper-mode nil)) @@ -196,7 +197,7 @@ The detected problematic options are stored in `cus-test-errors'." mismatch) (when (default-boundp symbol) (push (funcall get symbol) values) - (push (eval (car (get symbol 'standard-value))) values)) + (push (eval (car (get symbol 'standard-value)) t) values)) (if (boundp symbol) (push (symbol-value symbol) values)) ;; That does not work. @@ -222,7 +223,7 @@ The detected problematic options are stored in `cus-test-errors'." (get symbol 'standard-value)))) (and (consp c-value) (boundp symbol) - (not (equal (eval (car c-value)) (symbol-value symbol))) + (not (equal (eval (car c-value) t) (symbol-value symbol))) (add-to-list 'cus-test-vars-with-changed-state symbol))) (if mismatch @@ -239,7 +240,7 @@ The detected problematic options are stored in `cus-test-errors'." (defun cus-test-cus-load-groups (&optional cus-load) "Return a list of current custom groups. If CUS-LOAD is non-nil, include groups from cus-load.el." - (append (mapcar 'cdr custom-current-group-alist) + (append (mapcar #'cdr custom-current-group-alist) (if cus-load (with-temp-buffer (insert-file-contents (locate-library "cus-load.el")) @@ -290,7 +291,7 @@ currently defined groups." "Call `custom-load-symbol' on all atoms." (interactive) (if noninteractive (let (noninteractive) (require 'dunnet))) - (mapatoms 'custom-load-symbol) + (mapatoms #'custom-load-symbol) (run-hooks 'cus-test-after-load-libs-hook)) (defmacro cus-test-load-1 (&rest body) @@ -346,7 +347,7 @@ Optional argument ALL non-nil means list all (non-obsolete) Lisp files." (prog1 ;; Hack to remove leading "./". (mapcar (lambda (e) (substring e 2)) - (apply 'process-lines find-program + (apply #'process-lines find-program "." "-name" "obsolete" "-prune" "-o" "-name" "[^.]*.el" ; ignore .dir-locals.el (if all @@ -542,7 +543,7 @@ in the Emacs source directory." (message "No options not loaded by custom-load-symbol found") (message "The following options were not loaded by custom-load-symbol:") (cus-test-message - (sort cus-test-vars-not-cus-loaded 'string<))) + (sort cus-test-vars-not-cus-loaded #'string<))) (dolist (o groups-loaded) (setq groups-not-loaded (delete o groups-not-loaded))) @@ -550,7 +551,7 @@ in the Emacs source directory." (if (not groups-not-loaded) (message "No groups not in cus-load.el found") (message "The following groups are not in cus-load.el:") - (cus-test-message (sort groups-not-loaded 'string<))))) + (cus-test-message (sort groups-not-loaded #'string<))))) (provide 'cus-test) diff --git a/admin/find-gc.el b/admin/find-gc.el index c70a051bfb5..1cce54ef142 100644 --- a/admin/find-gc.el +++ b/admin/find-gc.el @@ -1,4 +1,4 @@ -;;; find-gc.el --- detect functions that call the garbage collector +;;; find-gc.el --- detect functions that call the garbage collector -*- lexical-binding: t; -*- ;; Copyright (C) 1992, 2001-2021 Free Software Foundation, Inc. @@ -42,14 +42,14 @@ Each entry has the form (FUNCTION . FUNCTIONS-THAT-CALL-IT).") Each entry has the form (FUNCTION . FUNCTIONS-IT-CALLS).") -;;; Functions on this list are safe, even if they appear to be able -;;; to call the target. +;; Functions on this list are safe, even if they appear to be able +;; to call the target. (defvar find-gc-noreturn-list '(Fsignal Fthrow wrong_type_argument)) -;;; This was originally generated directory-files, but there were -;;; too many files there that were not actually compiled. The -;;; list below was created for a HP-UX 7.0 system. +;; This was originally generated directory-files, but there were +;; too many files there that were not actually compiled. The +;; list below was created for a HP-UX 7.0 system. (defvar find-gc-source-files '("dispnew.c" "scroll.c" "xdisp.c" "window.c" @@ -76,11 +76,11 @@ Also store it in `find-gc-unsafe-list'." (lambda (x y) (string-lessp (car x) (car y)))))) -;;; This does a depth-first search to find all functions that can -;;; ultimately call the function "target". The result is an a-list -;;; in find-gc-unsafe-list; the cars are the unsafe functions, and the cdrs -;;; are (one of) the unsafe functions that these functions directly -;;; call. +;; This does a depth-first search to find all functions that can +;; ultimately call the function "target". The result is an a-list +;; in find-gc-unsafe-list; the cars are the unsafe functions, and the cdrs +;; are (one of) the unsafe functions that these functions directly +;; call. (defun find-unsafe-funcs (target) (setq find-gc-unsafe-list (list (list target))) @@ -134,7 +134,8 @@ Also store it in `find-gc-unsafe-list'." (setcdr entry (cons name (cdr entry))))))))))))) (defun trace-use-tree () - (setq find-gc-subrs-callers (mapcar 'list (mapcar 'car find-gc-subrs-called))) + (setq find-gc-subrs-callers + (mapcar #'list (mapcar #'car find-gc-subrs-called))) (let ((ptr find-gc-subrs-called) p2 found) (while ptr diff --git a/admin/gitmerge.el b/admin/gitmerge.el index 1364bdc67ac..b92ecc7c78f 100644 --- a/admin/gitmerge.el +++ b/admin/gitmerge.el @@ -1,4 +1,4 @@ -;;; gitmerge.el --- help merge one Emacs branch into another +;;; gitmerge.el --- help merge one Emacs branch into another -*- lexical-binding: t; -*- ;; Copyright (C) 2010-2021 Free Software Foundation, Inc. @@ -390,7 +390,7 @@ is nil, only the single commit BEG is merged." (if end "s were " " was ") "skipped:\n\n") "")) - (apply 'call-process "git" nil t nil "log" "--oneline" + (apply #'call-process "git" nil t nil "log" "--oneline" (if end (list (concat beg "~.." end)) `("-1" ,beg))) (insert "\n") @@ -422,7 +422,7 @@ MISSING must be a list of SHA1 strings." (unless end (setq end beg)) (unless (zerop - (apply 'call-process "git" nil t nil "merge" "--no-ff" + (apply #'call-process "git" nil t nil "merge" "--no-ff" (append (when skip '("-s" "ours")) `("-m" ,commitmessage ,end)))) (gitmerge-write-missing missing from) -- cgit v1.2.3