commit 567c31121fdef6bdc8b645999a6ca1d994378c89 (HEAD, refs/remotes/origin/master) Author: Martin Rudalics Date: Wed May 19 09:17:37 2021 +0200 Fix recently introduced misbehavior of `quit-restore-window' (Bug#48493) * lisp/window.el (quit-restore-window): Unconditionally call `switch-to-prev-buffer' (Bug#48493). diff --git a/lisp/window.el b/lisp/window.el index 5a30713666..1c719480ca 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -5110,8 +5110,7 @@ nil means to not handle the buffer in a particular way. This (set-window-parameter window 'quit-restore nil) ;; Make sure that WINDOW is no more dedicated. (set-window-dedicated-p window nil) - (if prev-buffer - (switch-to-prev-buffer window bury-or-kill) + (unless (switch-to-prev-buffer window bury-or-kill) ;; Delete WINDOW if there is no previous buffer (Bug#48367). (window--delete window nil (eq bury-or-kill 'kill))))) commit 1276ba75eb0d308b76df34c522bb0d6e059c146e Author: Stefan Monnier Date: Tue May 18 20:30:08 2021 -0400 * lisp/progmodes/js.el (js--make-framework-matcher): Use a closure diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 1ab0459d70..c2481f6095 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -1060,7 +1060,7 @@ Return the pitem of the function we went to the beginning of." (t (js--beginning-of-defun-nested)))))) -(defun js--flush-caches (&optional beg ignored) +(defun js--flush-caches (&optional beg _ignored) "Flush the `js-mode' syntax cache after position BEG. BEG defaults to `point-min', meaning to flush the entire cache." (interactive) @@ -1473,11 +1473,10 @@ LIMIT defaults to point." "Helper function for building `js--font-lock-keywords'. Create a byte-compiled function for matching a concatenation of REGEXPS, but only if FRAMEWORK is in `js-enabled-frameworks'." - (setq regexps (apply #'concat regexps)) - (byte-compile - `(lambda (limit) - (when (memq (quote ,framework) js-enabled-frameworks) - (re-search-forward ,regexps limit t))))) + (let ((regexp (apply #'concat regexps))) + (lambda (limit) + (when (memq framework js-enabled-frameworks) + (re-search-forward regexp limit t))))) (defvar-local js--tmp-location nil) @@ -4181,8 +4180,9 @@ browser, respectively." "style" "") cmds))) - (eval (list 'with-js - (cons 'js-list (nreverse cmds)))))) + (eval `(with-js + (js-list ,@(nreverse cmds))) + t))) (command-hook () commit 942cbc4deaa6c3ec9b142e6d27f92516097ac24b Author: Stefan Monnier Date: Tue May 18 20:21:51 2021 -0400 * lisp/progmodes/gud.el (gud-tooltip-tips): Use proper closures Also prefer #' to quote function names. (jdb): Fix $ => \'. diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 8e6ce3d269..aa3365278c 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -101,6 +101,19 @@ (declare-function speedbar-delete-subblock "speedbar" (indent)) (declare-function speedbar-center-buffer-smartly "speedbar" ()) +;; FIXME: The declares below are necessary because we don't call `gud-def' +;; at toplevel, so the compiler doesn't know under which circumstances +;; they're defined. +(declare-function gud-until "gud" (arg)) +(declare-function gud-print "gud" (arg)) +(declare-function gud-down "gud" (arg)) +(declare-function gud-up "gud" (arg)) +(declare-function gud-jump "gud" (arg)) +(declare-function gud-finish "gud" (arg)) +(declare-function gud-next "gud" (arg)) +(declare-function gud-stepi "gud" (arg)) +(declare-function gud-tbreak "gud" (arg)) + (defvar tool-bar-map) (defvar speedbar-initial-expansion-list-name) (defvar speedbar-frame) diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index a37477dfa1..740a6e2581 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -50,6 +50,30 @@ (defvar hl-line-mode) (defvar hl-line-sticky-flag) +(declare-function gdb-tooltip-print "gdb-mi" (expr)) +(declare-function gdb-tooltip-print-1 "gdb-mi" (expr)) +(declare-function gud-pp "gdb-mi" (arg)) +(declare-function gdb-var-delete "gdb-mi" ()) +(declare-function speedbar-toggle-line-expansion "gud" ()) +(declare-function speedbar-edit-line "gud" ()) +;; FIXME: The declares below are necessary because we don't call `gud-def' +;; at toplevel, so the compiler doesn't know under which circumstances +;; they're defined. +(declare-function gud-statement "gud" (arg)) +(declare-function gud-until "gud" (arg)) +(declare-function gud-pv "gud" (arg)) +(declare-function gud-print "gud" (arg)) +(declare-function gud-down "gud" (arg)) +(declare-function gud-up "gud" (arg)) +(declare-function gud-jump "gud" (arg)) +(declare-function gud-finish "gud" (arg)) +(declare-function gud-cont "gud" (arg)) +(declare-function gud-next "gud" (arg)) +(declare-function gud-stepi "gud" (arg)) +(declare-function gud-step "gud" (arg)) +(declare-function gud-remove "gud" (arg)) +(declare-function gud-tbreak "gud" (arg)) +(declare-function gud-break "gud" (arg)) ;; ====================================================================== ;; GUD commands must be visible in C buffers visited by GUD @@ -66,7 +90,7 @@ pdb (Python), and jdb." "Prefix of all GUD commands valid in C buffers." :type 'key-sequence) -(global-set-key (vconcat gud-key-prefix "\C-l") 'gud-refresh) +(global-set-key (vconcat gud-key-prefix "\C-l") #'gud-refresh) ;; (define-key ctl-x-map " " 'gud-break); backward compatibility hack (defvar gud-marker-filter nil) @@ -150,10 +174,11 @@ Used to gray out relevant toolbar icons.") (or (not (gdb-show-run-p)) (bound-and-true-p gdb-active-process))))) - ([go] menu-item (if (bound-and-true-p gdb-active-process) - "Continue" "Run") gud-go + ([go] . (menu-item (if (bound-and-true-p gdb-active-process) + "Continue" "Run") + gud-go :visible (and (eq gud-minor-mode 'gdbmi) - (gdb-show-run-p))) + (gdb-show-run-p)))) ([stop] menu-item "Stop" gud-stop-subjob :visible (or (not (memq gud-minor-mode '(gdbmi pdb))) (and (eq gud-minor-mode 'gdbmi) @@ -185,13 +210,15 @@ Used to gray out relevant toolbar icons.") (bound-and-true-p gdb-active-process)) :visible (and (string-equal (buffer-local-value - 'gud-target-name gud-comint-buffer) "emacs") + 'gud-target-name gud-comint-buffer) + "emacs") (eq gud-minor-mode 'gdbmi))) - ([print*] menu-item (if (eq gud-minor-mode 'jdb) - "Dump object" - "Print Dereference") gud-pstar + ([print*] . (menu-item (if (eq gud-minor-mode 'jdb) + "Dump object" + "Print Dereference") + gud-pstar :enable (not gud-running) - :visible (memq gud-minor-mode '(gdbmi gdb jdb))) + :visible (memq gud-minor-mode '(gdbmi gdb jdb)))) ([print] menu-item "Print Expression" gud-print :enable (not gud-running)) ([watch] menu-item "Watch Expression" gud-watch @@ -336,7 +363,7 @@ Uses `gud--directories' to find the source files." (eq gud-minor-mode 'gdbmi)) (make-local-variable 'gdb-define-alist) (unless gdb-define-alist (gdb-create-define-alist)) - (add-hook 'after-save-hook 'gdb-create-define-alist nil t)) + (add-hook 'after-save-hook #'gdb-create-define-alist nil t)) (make-local-variable 'gud-keep-buffer)) buf))) @@ -383,8 +410,8 @@ we're in the GUD buffer)." `(gud-call ,cmd arg) ;; Unused lexical warning if cmd does not use "arg". cmd)))) - ,(if key `(local-set-key ,(concat "\C-c" key) ',func)) - ,(if key `(global-set-key (vconcat gud-key-prefix ,key) ',func)))) + ,(if key `(local-set-key ,(concat "\C-c" key) #',func)) + ,(if key `(global-set-key (vconcat gud-key-prefix ,key) #',func)))) ;; Where gud-display-frame should put the debugging arrow; a cons of ;; (filename . line-number). This is set by the marker-filter, which scans @@ -450,12 +477,12 @@ The value t means that there is no stack, and we are in display-file mode.") "Install those variables used by speedbar to enhance gud/gdb." (unless gud-speedbar-key-map (setq gud-speedbar-key-map (speedbar-make-specialized-keymap)) - (define-key gud-speedbar-key-map "j" 'speedbar-edit-line) - (define-key gud-speedbar-key-map "e" 'speedbar-edit-line) - (define-key gud-speedbar-key-map "\C-m" 'speedbar-edit-line) - (define-key gud-speedbar-key-map " " 'speedbar-toggle-line-expansion) - (define-key gud-speedbar-key-map "D" 'gdb-var-delete) - (define-key gud-speedbar-key-map "p" 'gud-pp)) + (define-key gud-speedbar-key-map "j" #'speedbar-edit-line) + (define-key gud-speedbar-key-map "e" #'speedbar-edit-line) + (define-key gud-speedbar-key-map "\C-m" #'speedbar-edit-line) + (define-key gud-speedbar-key-map " " #'speedbar-toggle-line-expansion) + (define-key gud-speedbar-key-map "D" #'gdb-var-delete) + (define-key gud-speedbar-key-map "p" #'gud-pp)) (speedbar-add-expansion-list '("GUD" gud-speedbar-menu-items gud-speedbar-key-map @@ -625,8 +652,7 @@ required by the caller." (defcustom gud-gud-gdb-command-name "gdb --fullname" "Default command to run an executable under GDB in text command mode. The option \"--fullname\" must be included in this value." - :type 'string - :group 'gud) + :type 'string) (defvar gud-gdb-marker-regexp ;; This used to use path-separator instead of ":"; @@ -801,9 +827,9 @@ the buffer in which this command was invoked." (add-hook 'completion-at-point-functions #'gud-gdb-completion-at-point nil 'local) - (setq-local gud-gdb-completion-function 'gud-gdb-completions) + (setq-local gud-gdb-completion-function #'gud-gdb-completions) - (local-set-key "\C-i" 'completion-at-point) + (local-set-key "\C-i" #'completion-at-point) (setq comint-prompt-regexp "^(.*gdb[+]?) *") (setq paragraph-start comint-prompt-regexp) (setq gdb-first-prompt t) @@ -2182,9 +2208,9 @@ extension EXTN. Normally EXTN is given as the regular expression (setq gud-jdb-analysis-buffer (get-buffer-create " *gud-jdb-scratch*")) (prog1 (apply - 'nconc + #'nconc (mapcar - 'gud-jdb-build-class-source-alist-for-file + #'gud-jdb-build-class-source-alist-for-file sources)) (kill-buffer gud-jdb-analysis-buffer) (setq gud-jdb-analysis-buffer nil))) @@ -2251,13 +2277,14 @@ relative to a classpath directory." ;; name relative to classpath (filename (concat - (mapconcat 'identity + (mapconcat #'identity (split-string ;; Eliminate any subclass references in the class ;; name string. These start with a "$" (if (string-match "\\$.*" p) (replace-match "" t t p) p) - "\\.") "/") + "\\.") + "/") ".java")) (cplist (append gud-jdb-sourcepath gud-jdb-classpath)) found-file) @@ -2279,7 +2306,7 @@ during jdb initialization depending on the value of "Parse the classpath list and convert each item to an absolute pathname." (mapcar (lambda (s) (if (string-match "[/\\]$" s) (replace-match "" nil nil s) s)) - (mapcar 'file-truename + (mapcar #'file-truename (split-string string (concat "[ \t\n\r,\"" path-separator "]+"))))) @@ -2458,7 +2485,7 @@ gud, see `gud-mode'." (if (string-match "-attach" command-line) (gud-call "classpath")) (fset 'gud-jdb-find-source - 'gud-jdb-find-source-using-classpath)) + #'gud-jdb-find-source-using-classpath)) ;; Else create and bind the class/source association list as well ;; as the source file list. @@ -2466,8 +2493,8 @@ gud, see `gud-mode'." (gud-jdb-build-class-source-alist (setq gud-jdb-source-files (gud-jdb-build-source-files-list gud-jdb-directories - "\\.java$")))) - (fset 'gud-jdb-find-source 'gud-jdb-find-source-file))) + "\\.java\\'")))) + (fset 'gud-jdb-find-source #'gud-jdb-find-source-file))) ;; ;; End of debugger-specific information @@ -2578,7 +2605,7 @@ Commands: \\{gud-mode-map}" (setq mode-line-process '(":%s")) - (define-key (current-local-map) "\C-c\C-l" 'gud-refresh) + (define-key (current-local-map) "\C-c\C-l" #'gud-refresh) (setq-local gud-last-frame nil) (if (boundp 'tool-bar-map) ; not --without-x (setq-local tool-bar-map gud-tool-bar-map)) @@ -2587,7 +2614,7 @@ Commands: (setq-local comint-input-ignoredups t) (make-local-variable 'paragraph-start) (setq-local gud-delete-prompt-marker (make-marker)) - (add-hook 'kill-buffer-hook 'gud-kill-buffer-hook nil t)) + (add-hook 'kill-buffer-hook #'gud-kill-buffer-hook nil t)) (defcustom gud-chdir-before-run t "Non-nil if GUD should `cd' to the debugged executable." @@ -2654,7 +2681,7 @@ Commands: (setq w (cdr w))) ;; Tramp has already been loaded if we are here. (if w (setcar w (setq file (file-local-name file))))) - (apply 'make-comint (concat "gud" filepart) program nil + (apply #'make-comint (concat "gud" filepart) program nil (if massage-args (funcall massage-args file args) args)) ;; Since comint clobbered the mode, we don't set it until now. (gud-mode) @@ -2664,8 +2691,8 @@ Commands: (if find-file (setq-local gud-find-file find-file)) (setq gud-last-last-frame nil) - (set-process-filter (get-buffer-process (current-buffer)) 'gud-filter) - (set-process-sentinel (get-buffer-process (current-buffer)) 'gud-sentinel) + (set-process-filter (get-buffer-process (current-buffer)) #'gud-filter) + (set-process-sentinel (get-buffer-process (current-buffer)) #'gud-sentinel) (gud-set-buffer)) (defun gud-set-buffer () @@ -3186,10 +3213,11 @@ class of the file (using s to separate nested class ids)." (while (and cplist (not class-found)) (if (string-match (car cplist) f) (setq class-found - (mapconcat 'identity + (mapconcat #'identity (split-string (substring f (+ (match-end 0) 1)) - "/") "."))) + "/") + "."))) (setq cplist (cdr cplist))) ;; if f is visited by a java(cc-mode) buffer, walk up the ;; syntactic information chain and collect any 'inclass @@ -3228,7 +3256,7 @@ class of the file (using s to separate nested class ids)." )) (string-match (concat (car nclass) "$") class-found) (setq class-found - (replace-match (mapconcat 'identity nclass "$") + (replace-match (mapconcat #'identity nclass "$") t t class-found))))) (if (not class-found) (message "gud-find-class: class for file %s not found!" f)) @@ -3362,7 +3390,7 @@ Treats actions as defuns." (setq-local outline-regexp "[ \t]") (setq-local imenu-generic-expression '((nil "^define[ \t]+\\(\\w+\\)" 1))) - (setq-local indent-line-function 'gdb-script-indent-line) + (setq-local indent-line-function #'gdb-script-indent-line) (setq-local beginning-of-defun-function #'gdb-script-beginning-of-defun) (setq-local end-of-defun-function @@ -3393,14 +3421,14 @@ Treats actions as defuns." (require 'tooltip) (if gud-tooltip-mode (progn - (add-hook 'change-major-mode-hook 'gud-tooltip-change-major-mode) - (add-hook 'pre-command-hook 'tooltip-hide) - (add-hook 'tooltip-functions 'gud-tooltip-tips) - (define-key global-map [mouse-movement] 'gud-tooltip-mouse-motion)) - (unless tooltip-mode (remove-hook 'pre-command-hook 'tooltip-hide) - (remove-hook 'change-major-mode-hook 'gud-tooltip-change-major-mode) - (remove-hook 'tooltip-functions 'gud-tooltip-tips) - (define-key global-map [mouse-movement] 'ignore))) + (add-hook 'change-major-mode-hook #'gud-tooltip-change-major-mode) + (add-hook 'pre-command-hook #'tooltip-hide) + (add-hook 'tooltip-functions #'gud-tooltip-tips) + (define-key global-map [mouse-movement] #'gud-tooltip-mouse-motion)) + (unless tooltip-mode (remove-hook 'pre-command-hook #'tooltip-hide) + (remove-hook 'change-major-mode-hook #'gud-tooltip-change-major-mode) + (remove-hook 'tooltip-functions #'gud-tooltip-tips) + (define-key global-map [mouse-movement] #'ignore))) (gud-tooltip-activate-mouse-motions-if-enabled) (if (and gud-comint-buffer (buffer-name gud-comint-buffer); gud-comint-buffer might be killed @@ -3417,9 +3445,9 @@ Treats actions as defuns." (make-local-variable 'gdb-define-alist) (gdb-create-define-alist) (add-hook 'after-save-hook - 'gdb-create-define-alist nil t)))))) + #'gdb-create-define-alist nil t)))))) (kill-local-variable 'gdb-define-alist) - (remove-hook 'after-save-hook 'gdb-create-define-alist t)))) + (remove-hook 'after-save-hook #'gdb-create-define-alist t)))) (defcustom gud-tooltip-modes '(gud-mode c-mode c++-mode fortran-mode python-mode) @@ -3450,12 +3478,12 @@ only tooltips in the buffer containing the overlay arrow." (defun gud-tooltip-change-major-mode () "Function added to `change-major-mode-hook' when tooltip mode is on." - (add-hook 'post-command-hook 'gud-tooltip-activate-mouse-motions-if-enabled)) + (add-hook 'post-command-hook #'gud-tooltip-activate-mouse-motions-if-enabled)) (defun gud-tooltip-activate-mouse-motions-if-enabled () "Reconsider for all buffers whether mouse motion events are desired." (remove-hook 'post-command-hook - 'gud-tooltip-activate-mouse-motions-if-enabled) + #'gud-tooltip-activate-mouse-motions-if-enabled) (dolist (buffer (buffer-list)) (with-current-buffer buffer (if (and gud-tooltip-mode @@ -3564,7 +3592,7 @@ This function must return nil if it doesn't handle EVENT." (posn-point (event-end event)) (or (and (eq gud-minor-mode 'gdbmi) (not gdb-active-process)) (progn (setq gud-tooltip-event event) - (eval (cons 'and gud-tooltip-display))))) + (eval (cons 'and gud-tooltip-display) t)))) (let ((expr (tooltip-expr-to-print event))) (when expr (if (and (eq gud-minor-mode 'gdbmi) @@ -3594,10 +3622,10 @@ so they have been disabled.")) (gdb-input (concat "server macro expand " expr "\n") - `(lambda () (gdb-tooltip-print-1 ,expr))) + (lambda () (gdb-tooltip-print-1 expr))) (gdb-input (concat cmd "\n") - `(lambda () (gdb-tooltip-print ,expr)))) + (lambda () (gdb-tooltip-print expr)))) (add-function :override (process-filter process) #'gud-tooltip-process-output) (gud-basic-call cmd)) commit 09ed51b9c89390059ccae30c0ae5dc39bc20523b Author: Stefan Monnier Date: Tue May 18 19:54:38 2021 -0400 * lisp/org/org-timer.el (org-timer--run-countdown-timer): Use closures diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el index b6802fe8b0..852d18579a 100644 --- a/lisp/org/org-timer.el +++ b/lisp/org/org-timer.el @@ -366,7 +366,7 @@ VALUE can be `on', `off', or `paused'." (setq org-timer-mode-line-timer nil)) (when org-timer-display (setq org-timer-mode-line-timer - (run-with-timer 1 1 'org-timer-update-mode-line)))))) + (run-with-timer 1 1 #'org-timer-update-mode-line)))))) (defun org-timer-update-mode-line () "Update the timer time in the mode line." @@ -456,14 +456,15 @@ using three `C-u' prefix arguments." "Start countdown timer that will last SECS. TITLE will be appended to the notification message displayed when time is up." - (let ((msg (format "%s: time out" title))) + (let ((msg (format "%s: time out" title)) + (sound org-clock-sound)) (run-with-timer - secs nil `(lambda () - (setq org-timer-countdown-timer nil - org-timer-start-time nil) - (org-notify ,msg ,org-clock-sound) - (org-timer-set-mode-line 'off) - (run-hooks 'org-timer-done-hook))))) + secs nil (lambda () + (setq org-timer-countdown-timer nil + org-timer-start-time nil) + (org-notify msg sound) + (org-timer-set-mode-line 'off) + (run-hooks 'org-timer-done-hook))))) (defun org-timer--get-timer-title () "Construct timer title. commit 5746fd57ab7c9d27bcc6220f2b9faaba2982deba Author: Stefan Monnier Date: Tue May 18 19:51:26 2021 -0400 * lisp/org/org-mouse.el: Make use of lexical scoping (org-mouse-todo-menu): Simplify by eta-reduction. (org-mouse-popup-global-menu): Remove redundant `eval`. (org-mouse-keyword-menu, org-mouse-keyword-replace-menu) (org-mouse-tag-menu, org-mouse-match-closure): Use proper closures. diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el index 5c222ea70d..57281dd68c 100644 --- a/lisp/org/org-mouse.el +++ b/lisp/org/org-mouse.el @@ -167,14 +167,12 @@ indirectly, for example, through the agenda buffer.") (defcustom org-mouse-punctuation ":" "Punctuation used when inserting text by drag and drop." - :group 'org-mouse :type 'string) (defcustom org-mouse-features '(context-menu yank-link activate-stars activate-bullets activate-checkboxes) "The features of org-mouse that should be activated. Changing this variable requires a restart of Emacs to get activated." - :group 'org-mouse :type '(set :greedy t (const :tag "Mouse-3 shows context menu" context-menu) (const :tag "C-mouse-1 and mouse-3 move trees" move-tree) @@ -292,19 +290,19 @@ argument. If it is a string, it is interpreted as the format string to (format ITEMFORMAT keyword). If it is neither a string nor a function, elements of KEYWORDS are used directly." (mapcar - `(lambda (keyword) + (lambda (keyword) (vector (cond - ((functionp ,itemformat) (funcall ,itemformat keyword)) - ((stringp ,itemformat) (format ,itemformat keyword)) + ((functionp itemformat) (funcall itemformat keyword)) + ((stringp itemformat) (format itemformat keyword)) (t keyword)) - (list 'funcall ,function keyword) + (list 'funcall function keyword) :style (cond - ((null ,selected) t) - ((functionp ,selected) 'toggle) + ((null selected) t) + ((functionp selected) 'toggle) (t 'radio)) - :selected (if (functionp ,selected) - (and (funcall ,selected keyword) t) - (equal ,selected keyword)))) + :selected (if (functionp selected) + (and (funcall selected keyword) t) + (equal selected keyword)))) keywords)) (defun org-mouse-remove-match-and-spaces () @@ -344,12 +342,12 @@ string to (format ITEMFORMAT keyword). If it is neither a string nor a function, elements of KEYWORDS are used directly." (setq group (or group 0)) (let ((replace (org-mouse-match-closure - (if nosurround 'replace-match - 'org-mouse-replace-match-and-surround)))) + (if nosurround #'replace-match + #'org-mouse-replace-match-and-surround)))) (append (org-mouse-keyword-menu keywords - `(lambda (keyword) (funcall ,replace keyword t t nil ,group)) + (lambda (keyword) (funcall replace keyword t t nil group)) (match-string group) itemformat) `(["None" org-mouse-remove-match-and-spaces @@ -416,7 +414,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" (let ((kwds org-todo-keywords-1)) (org-mouse-keyword-menu kwds - `(lambda (kwd) (org-todo kwd)) + #'org-todo (lambda (kwd) (equal state kwd)))))) (defun org-mouse-tag-menu () ;todo @@ -424,14 +422,14 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" (append (let ((tags (org-get-tags nil t))) (org-mouse-keyword-menu - (sort (mapcar 'car (org-get-buffer-tags)) 'string-lessp) - `(lambda (tag) + (sort (mapcar #'car (org-get-buffer-tags)) #'string-lessp) + (lambda (tag) (org-mouse-set-tags - (sort (if (member tag (quote ,tags)) - (delete tag (quote ,tags)) - (cons tag (quote ,tags))) - 'string-lessp))) - `(lambda (tag) (member tag (quote ,tags))) + (sort (if (member tag tags) + (delete tag tags) + (cons tag tags)) + #'string-lessp))) + (lambda (tag) (member tag tags)) )) '("--" ["Align Tags Here" (org-align-tags) t] @@ -500,7 +498,7 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" ["Check TODOs" org-show-todo-tree t] ("Check Tags" ,@(org-mouse-keyword-menu - (sort (mapcar 'car (org-get-buffer-tags)) 'string-lessp) + (sort (mapcar #'car (org-get-buffer-tags)) #'string-lessp) #'(lambda (tag) (org-tags-sparse-tree nil tag))) "--" ["Custom Tag ..." org-tags-sparse-tree t]) @@ -510,16 +508,16 @@ SCHEDULED: or DEADLINE: or ANYTHINGLIKETHIS:" ["Display TODO List" org-todo-list t] ("Display Tags" ,@(org-mouse-keyword-menu - (sort (mapcar 'car (org-get-buffer-tags)) 'string-lessp) + (sort (mapcar #'car (org-get-buffer-tags)) #'string-lessp) #'(lambda (tag) (org-tags-view nil tag))) "--" ["Custom Tag ..." org-tags-view t]) ["Display Calendar" org-goto-calendar t] "--" ,@(org-mouse-keyword-menu - (mapcar 'car org-agenda-custom-commands) + (mapcar #'car org-agenda-custom-commands) #'(lambda (key) - (eval `(org-agenda nil (string-to-char ,key)))) + (org-agenda nil (string-to-char key))) nil #'(lambda (key) (let ((entry (assoc key org-agenda-custom-commands))) @@ -594,10 +592,10 @@ This means, between the beginning of line and the point." (defun org-mouse-match-closure (function) (let ((match (match-data t))) - `(lambda (&rest rest) - (save-match-data - (set-match-data ',match) - (apply ',function rest))))) + (lambda (&rest rest) + (save-match-data + (set-match-data match) + (apply function rest))))) (defun org-mouse-yank-link (click) (interactive "e") @@ -631,7 +629,7 @@ This means, between the beginning of line and the point." ((save-excursion (beginning-of-line) (looking-at "[ \t]*#\\+STARTUP: \\(.*\\)")) (popup-menu `(nil - ,@(org-mouse-list-options-menu (mapcar 'car org-startup-options) + ,@(org-mouse-list-options-menu (mapcar #'car org-startup-options) 'org-mode-restart)))) ((or (eolp) (and (looking-at "\\( \\|\t\\)\\(\\+:[0-9a-zA-Z_:]+\\)?\\( \\|\t\\)+$") @@ -857,21 +855,21 @@ This means, between the beginning of line and the point." (add-hook 'org-mode-hook #'(lambda () - (setq org-mouse-context-menu-function 'org-mouse-context-menu) + (setq org-mouse-context-menu-function #'org-mouse-context-menu) (when (memq 'context-menu org-mouse-features) (org-defkey org-mouse-map [mouse-3] nil) - (org-defkey org-mode-map [mouse-3] 'org-mouse-show-context-menu)) - (org-defkey org-mode-map [down-mouse-1] 'org-mouse-down-mouse) + (org-defkey org-mode-map [mouse-3] #'org-mouse-show-context-menu)) + (org-defkey org-mode-map [down-mouse-1] #'org-mouse-down-mouse) (when (memq 'context-menu org-mouse-features) - (org-defkey org-mouse-map [C-drag-mouse-1] 'org-mouse-move-tree) - (org-defkey org-mouse-map [C-down-mouse-1] 'org-mouse-move-tree-start)) + (org-defkey org-mouse-map [C-drag-mouse-1] #'org-mouse-move-tree) + (org-defkey org-mouse-map [C-down-mouse-1] #'org-mouse-move-tree-start)) (when (memq 'yank-link org-mouse-features) - (org-defkey org-mode-map [S-mouse-2] 'org-mouse-yank-link) - (org-defkey org-mode-map [drag-mouse-3] 'org-mouse-yank-link)) + (org-defkey org-mode-map [S-mouse-2] #'org-mouse-yank-link) + (org-defkey org-mode-map [drag-mouse-3] #'org-mouse-yank-link)) (when (memq 'move-tree org-mouse-features) - (org-defkey org-mouse-map [drag-mouse-3] 'org-mouse-move-tree) - (org-defkey org-mouse-map [down-mouse-3] 'org-mouse-move-tree-start)) + (org-defkey org-mouse-map [drag-mouse-3] #'org-mouse-move-tree) + (org-defkey org-mouse-map [down-mouse-3] #'org-mouse-move-tree-start)) (when (memq 'activate-stars org-mouse-features) (font-lock-add-keywords @@ -1086,11 +1084,11 @@ This means, between the beginning of line and the point." (defvar org-agenda-mode-map) (add-hook 'org-agenda-mode-hook (lambda () - (setq org-mouse-context-menu-function 'org-mouse-agenda-context-menu) - (org-defkey org-agenda-mode-map [mouse-3] 'org-mouse-show-context-menu) - (org-defkey org-agenda-mode-map [down-mouse-3] 'org-mouse-move-tree-start) - (org-defkey org-agenda-mode-map [C-mouse-4] 'org-agenda-earlier) - (org-defkey org-agenda-mode-map [C-mouse-5] 'org-agenda-later) + (setq org-mouse-context-menu-function #'org-mouse-agenda-context-menu) + (org-defkey org-agenda-mode-map [mouse-3] #'org-mouse-show-context-menu) + (org-defkey org-agenda-mode-map [down-mouse-3] #'org-mouse-move-tree-start) + (org-defkey org-agenda-mode-map [C-mouse-4] #'org-agenda-earlier) + (org-defkey org-agenda-mode-map [C-mouse-5] #'org-agenda-later) (org-defkey org-agenda-mode-map [drag-mouse-3] (lambda (event) (interactive "e") (cl-case (org-mouse-get-gesture event) commit 4e240bf09678a41055e46fb16a798541d58d372e Author: Stefan Monnier Date: Tue May 18 19:36:54 2021 -0400 * lisp/org/org-colview.el (org-columns-map): Use proper closures Also prefer #' to quote function names. (org-columns-map): Use derived-mode-p. diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el index 75056d45a7..2f03906440 100644 --- a/lisp/org/org-colview.el +++ b/lisp/org/org-colview.el @@ -162,20 +162,20 @@ See `org-columns-summary-types' for details.") (org-overview) (org-content)) -(org-defkey org-columns-map "c" 'org-columns-content) -(org-defkey org-columns-map "o" 'org-overview) -(org-defkey org-columns-map "e" 'org-columns-edit-value) -(org-defkey org-columns-map "\C-c\C-t" 'org-columns-todo) -(org-defkey org-columns-map "\C-c\C-c" 'org-columns-toggle-or-columns-quit) -(org-defkey org-columns-map "\C-c\C-o" 'org-columns-open-link) -(org-defkey org-columns-map "v" 'org-columns-show-value) -(org-defkey org-columns-map "q" 'org-columns-quit) -(org-defkey org-columns-map "r" 'org-columns-redo) -(org-defkey org-columns-map "g" 'org-columns-redo) -(org-defkey org-columns-map [left] 'backward-char) -(org-defkey org-columns-map "\M-b" 'backward-char) -(org-defkey org-columns-map "a" 'org-columns-edit-allowed) -(org-defkey org-columns-map "s" 'org-columns-edit-attributes) +(org-defkey org-columns-map "c" #'org-columns-content) +(org-defkey org-columns-map "o" #'org-overview) +(org-defkey org-columns-map "e" #'org-columns-edit-value) +(org-defkey org-columns-map "\C-c\C-t" #'org-columns-todo) +(org-defkey org-columns-map "\C-c\C-c" #'org-columns-toggle-or-columns-quit) +(org-defkey org-columns-map "\C-c\C-o" #'org-columns-open-link) +(org-defkey org-columns-map "v" #'org-columns-show-value) +(org-defkey org-columns-map "q" #'org-columns-quit) +(org-defkey org-columns-map "r" #'org-columns-redo) +(org-defkey org-columns-map "g" #'org-columns-redo) +(org-defkey org-columns-map [left] #'backward-char) +(org-defkey org-columns-map "\M-b" #'backward-char) +(org-defkey org-columns-map "a" #'org-columns-edit-allowed) +(org-defkey org-columns-map "s" #'org-columns-edit-attributes) (org-defkey org-columns-map "\M-f" (lambda () (interactive) (goto-char (1+ (point))))) (org-defkey org-columns-map [right] @@ -187,7 +187,7 @@ See `org-columns-summary-types' for details.") (while (and (org-invisible-p2) (not (eobp))) (beginning-of-line 2)) (move-to-column col) - (if (eq major-mode 'org-agenda-mode) + (if (derived-mode-p 'org-agenda-mode) (org-agenda-do-context-action))))) (org-defkey org-columns-map [up] (lambda () (interactive) @@ -198,20 +198,20 @@ See `org-columns-summary-types' for details.") (move-to-column col) (if (eq major-mode 'org-agenda-mode) (org-agenda-do-context-action))))) -(org-defkey org-columns-map [(shift right)] 'org-columns-next-allowed-value) -(org-defkey org-columns-map "n" 'org-columns-next-allowed-value) -(org-defkey org-columns-map [(shift left)] 'org-columns-previous-allowed-value) -(org-defkey org-columns-map "p" 'org-columns-previous-allowed-value) -(org-defkey org-columns-map "<" 'org-columns-narrow) -(org-defkey org-columns-map ">" 'org-columns-widen) -(org-defkey org-columns-map [(meta right)] 'org-columns-move-right) -(org-defkey org-columns-map [(meta left)] 'org-columns-move-left) -(org-defkey org-columns-map [(shift meta right)] 'org-columns-new) -(org-defkey org-columns-map [(shift meta left)] 'org-columns-delete) +(org-defkey org-columns-map [(shift right)] #'org-columns-next-allowed-value) +(org-defkey org-columns-map "n" #'org-columns-next-allowed-value) +(org-defkey org-columns-map [(shift left)] #'org-columns-previous-allowed-value) +(org-defkey org-columns-map "p" #'org-columns-previous-allowed-value) +(org-defkey org-columns-map "<" #'org-columns-narrow) +(org-defkey org-columns-map ">" #'org-columns-widen) +(org-defkey org-columns-map [(meta right)] #'org-columns-move-right) +(org-defkey org-columns-map [(meta left)] #'org-columns-move-left) +(org-defkey org-columns-map [(shift meta right)] #'org-columns-new) +(org-defkey org-columns-map [(shift meta left)] #'org-columns-delete) (dotimes (i 10) (org-defkey org-columns-map (number-to-string i) - `(lambda () (interactive) - (org-columns-next-allowed-value nil ,i)))) + (lambda () (interactive) + (org-columns-next-allowed-value nil i)))) (easy-menu-define org-columns-menu org-columns-map "Org Column Menu" '("Column" @@ -490,7 +490,7 @@ for the duration of the command.") (org-add-props " " nil 'display `(space :align-to ,linum-offset)) (org-add-props (substring title 0 -1) nil 'face 'org-column-title))) (setq org-columns-previous-hscroll -1) - (add-hook 'post-command-hook 'org-columns-hscroll-title nil 'local))) + (add-hook 'post-command-hook #'org-columns-hscroll-title nil 'local))) (defun org-columns-hscroll-title () "Set the `header-line-format' so that it scrolls along with the table." @@ -519,7 +519,7 @@ for the duration of the command.") (when (local-variable-p 'org-previous-header-line-format) (setq header-line-format org-previous-header-line-format) (kill-local-variable 'org-previous-header-line-format) - (remove-hook 'post-command-hook 'org-columns-hscroll-title 'local)) + (remove-hook 'post-command-hook #'org-columns-hscroll-title 'local)) (set-marker org-columns-begin-marker nil) (when (markerp org-columns-top-level-marker) (set-marker org-columns-top-level-marker nil)) @@ -782,7 +782,7 @@ around it." (setq time-after (copy-sequence time)) (setf (nth 3 time-before) (1- (nth 3 time))) (setf (nth 3 time-after) (1+ (nth 3 time))) - (mapcar (lambda (x) (format-time-string fmt (apply 'encode-time x))) + (mapcar (lambda (x) (format-time-string fmt (apply #'encode-time x))) (list time-before time time-after))))) (defun org-columns-open-link (&optional arg) commit af68b49565671821361d089ae9a68af32d760e2c Author: Stefan Monnier Date: Tue May 18 19:32:35 2021 -0400 * lisp/org/org-clock.el (org-clock-get-table-data): Use proper closures Also, prefer #' to quote function names diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index 251ad97cde..1283970bc2 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -539,8 +539,8 @@ of a different task.") "Marker pointing to the task that has been interrupted by the current clock.") (defvar org-clock-mode-line-map (make-sparse-keymap)) -(define-key org-clock-mode-line-map [mode-line mouse-2] 'org-clock-goto) -(define-key org-clock-mode-line-map [mode-line mouse-1] 'org-clock-menu) +(define-key org-clock-mode-line-map [mode-line mouse-2] #'org-clock-goto) +(define-key org-clock-mode-line-map [mode-line mouse-1] #'org-clock-menu) (defun org-clock--translate (s language) "Translate string S into using string LANGUAGE. @@ -1414,12 +1414,12 @@ the default behavior." (setq org-clock-mode-line-timer (run-with-timer org-clock-update-period org-clock-update-period - 'org-clock-update-mode-line))) + #'org-clock-update-mode-line))) (when org-clock-idle-timer (cancel-timer org-clock-idle-timer) (setq org-clock-idle-timer nil)) (setq org-clock-idle-timer - (run-with-timer 60 60 'org-resolve-clocks-if-idle)) + (run-with-timer 60 60 #'org-resolve-clocks-if-idle)) (message "Clock starts at %s - %s" ts org--msg-extra) (run-hooks 'org-clock-in-hook)))))) @@ -1716,7 +1716,7 @@ to, overriding the existing value of `org-clock-out-switch-to-state'." (unless (org-clocking-p) (setq org-clock-current-task nil))))))) -(add-hook 'org-clock-out-hook 'org-clock-remove-empty-clock-drawer) +(add-hook 'org-clock-out-hook #'org-clock-remove-empty-clock-drawer) (defun org-clock-remove-empty-clock-drawer () "Remove empty clock drawers in current subtree." @@ -2012,7 +2012,7 @@ Use `\\[org-clock-remove-overlays]' to remove the subtree times." (when time (org-clock-put-overlay time))))) ;; Arrange to remove the overlays upon next change. (when org-remove-highlights-with-change - (add-hook 'before-change-functions 'org-clock-remove-overlays + (add-hook 'before-change-functions #'org-clock-remove-overlays nil 'local)))) (let* ((h (/ org-clock-file-total-minutes 60)) (m (- org-clock-file-total-minutes (* 60 h)))) @@ -2063,7 +2063,7 @@ If NOREMOVE is nil, remove this function from the (setq org-clock-overlays nil) (unless noremove (remove-hook 'before-change-functions - 'org-clock-remove-overlays 'local)))) + #'org-clock-remove-overlays 'local)))) ;;;###autoload (defun org-clock-out-if-current () @@ -2932,12 +2932,12 @@ PROPERTIES: The list properties specified in the `:properties' parameter (save-excursion (org-clock-sum ts te (when matcher - `(lambda () - (let* ((todo (org-get-todo-state)) - (tags-list (org-get-tags)) - (org-scanner-tags tags-list) - (org-trust-scanner-tags t)) - (funcall ,matcher todo tags-list nil))))) + (lambda () + (let* ((todo (org-get-todo-state)) + (tags-list (org-get-tags)) + (org-scanner-tags tags-list) + (org-trust-scanner-tags t)) + (funcall matcher todo tags-list nil))))) (goto-char (point-min)) (setq st t) (while (or (and (bobp) (prog1 st (setq st nil)) commit 25bb250e292d8129db0e5bd9978c67aee05bccf5 Author: Stefan Monnier Date: Tue May 18 19:23:54 2021 -0400 * lisp/net/sieve-manage.el (sieve-sasl-auth): Use proper closures diff --git a/lisp/net/sieve-manage.el b/lisp/net/sieve-manage.el index 5dad5f446a..1f08a15e57 100644 --- a/lisp/net/sieve-manage.el +++ b/lisp/net/sieve-manage.el @@ -89,18 +89,15 @@ (defcustom sieve-manage-log "*sieve-manage-log*" "Name of buffer for managesieve session trace." - :type 'string - :group 'sieve-manage) + :type 'string) (defcustom sieve-manage-server-eol "\r\n" "The EOL string sent from the server." - :type 'string - :group 'sieve-manage) + :type 'string) (defcustom sieve-manage-client-eol "\r\n" "The EOL string we send to the server." - :type 'string - :group 'sieve-manage) + :type 'string) (defcustom sieve-manage-authenticators '(digest-md5 cram-md5 @@ -112,8 +109,7 @@ ;; FIXME Improve this. It's not `set'. ;; It's like (repeat (choice (const ...))), where each choice can ;; only appear once. - :type '(repeat symbol) - :group 'sieve-manage) + :type '(repeat symbol)) (defcustom sieve-manage-authenticator-alist '((cram-md5 sieve-manage-cram-md5-p sieve-manage-cram-md5-auth) @@ -130,26 +126,22 @@ NAME names the authenticator. CHECK is a function returning non-nil if the server support the authenticator and AUTHENTICATE is a function for doing the actual authentication." :type '(repeat (list (symbol :tag "Name") (function :tag "Check function") - (function :tag "Authentication function"))) - :group 'sieve-manage) + (function :tag "Authentication function")))) (defcustom sieve-manage-default-port "sieve" "Default port number or service name for managesieve protocol." :type '(choice integer string) - :version "24.4" - :group 'sieve-manage) + :version "24.4") (defcustom sieve-manage-default-stream 'network "Default stream type to use for `sieve-manage'." :version "24.1" - :type 'symbol - :group 'sieve-manage) + :type 'symbol) (defcustom sieve-manage-ignore-starttls nil "Ignore STARTTLS even if STARTTLS capability is provided." :version "26.1" - :type 'boolean - :group 'sieve-manage) + :type 'boolean) ;; Internal variables: @@ -247,7 +239,7 @@ Return the buffer associated with the connection." (sasl-read-passphrase ;; We *need* to copy the password, because sasl will modify it ;; somehow. - `(lambda (prompt) ,(copy-sequence user-password))) + (lambda (_prompt) (copy-sequence user-password))) (step (sasl-next-step client nil)) (_tag (sieve-manage-send (concat commit 26041ec8d518806e29566af4428bb61d6d36d0b7 Author: Stefan Monnier Date: Tue May 18 19:15:04 2021 -0400 * lisp/net/shr.el (shr-image-displayer): Use proper closures diff --git a/lisp/net/shr.el b/lisp/net/shr.el index cbdeb65ba8..873f0457e3 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -1257,20 +1257,20 @@ Return a string with image data." CONTENT-FUNCTION is a function to retrieve an image for a cid url that is an argument. The function to be returned takes three arguments URL, START, and END. Note that START and END should be markers." - `(lambda (url start end) - (when url - (if (string-match "\\`cid:" url) - ,(when content-function - `(let ((image (funcall ,content-function - (substring url (match-end 0))))) - (when image - (goto-char start) - (funcall shr-put-image-function - image (buffer-substring start end)) - (delete-region (point) end)))) - (url-retrieve url #'shr-image-fetched - (list (current-buffer) start end) - t t))))) + (lambda (url start end) + (when url + (if (string-match "\\`cid:" url) + (when content-function + (let ((image (funcall content-function + (substring url (match-end 0))))) + (when image + (goto-char start) + (funcall shr-put-image-function + image (buffer-substring start end)) + (delete-region (point) end)))) + (url-retrieve url #'shr-image-fetched + (list (current-buffer) start end) + t t))))) (defun shr-heading (dom &rest types) (shr-ensure-paragraph) commit 5e7b57ad8f11ad013f9b652637bb7fdaf7a3fd4a Author: Stefan Monnier Date: Tue May 18 19:12:11 2021 -0400 * lisp/net/imap.el (imap-mailbox-close): Use proper closures Also, remove redundant `:group` args, and prefer #' to quote function names diff --git a/lisp/net/imap.el b/lisp/net/imap.el index d29584e55b..6ca76f1f99 100644 --- a/lisp/net/imap.el +++ b/lisp/net/imap.el @@ -160,7 +160,6 @@ %l with the value of `imap-default-user'. The program should accept IMAP commands on stdin and return responses to stdout. Each entry in the list is tried until a successful connection is made." - :group 'imap :type '(repeat string)) (defcustom imap-gssapi-program (list @@ -173,7 +172,6 @@ the list is tried until a successful connection is made." %l with the value of `imap-default-user'. The program should accept IMAP commands on stdin and return responses to stdout. Each entry in the list is tried until a successful connection is made." - :group 'imap :type '(repeat string)) (defcustom imap-shell-program '("ssh %s imapd" @@ -186,7 +184,6 @@ number on server, %g with `imap-shell-host', and %l with `imap-default-user'. The program should read IMAP commands from stdin and write IMAP response to stdout. Each entry in the list is tried until a successful connection is made." - :group 'imap :type '(repeat string)) (defcustom imap-process-connection-type nil @@ -198,7 +195,6 @@ system has no ptys or if all ptys are busy: then a pipe is used in any case. The value takes effect when an IMAP server is opened; changing it after that has no effect." :version "22.1" - :group 'imap :type 'boolean) (defcustom imap-use-utf7 t @@ -206,7 +202,6 @@ opened; changing it after that has no effect." Since the UTF7 decoding currently only decodes into ISO-8859-1 characters, you may disable this decoding if you need to access UTF7 encoded mailboxes which doesn't translate into ISO-8859-1." - :group 'imap :type 'boolean) (defcustom imap-log nil @@ -217,7 +212,6 @@ It is not written to disk, however. Do not enable this variable unless you are comfortable with that. See also `imap-debug'." - :group 'imap :type 'boolean) (defcustom imap-debug nil @@ -232,17 +226,14 @@ variable unless you are comfortable with that. This variable only takes effect when loading the `imap' library. See also `imap-log'." - :group 'imap :type 'boolean) (defcustom imap-shell-host "gateway" "Hostname of rlogin proxy." - :group 'imap :type 'string) (defcustom imap-default-user (user-login-name) "Default username to use." - :group 'imap :type 'string) (defcustom imap-read-timeout (if (memq system-type '(windows-nt cygwin)) @@ -250,12 +241,10 @@ See also `imap-log'." 0.1) "How long to wait between checking for the end of output. Shorter values mean quicker response, but is more CPU intensive." - :type 'number - :group 'imap) + :type 'number) (defcustom imap-store-password nil "If non-nil, store session password without prompting." - :group 'imap :type 'boolean) ;;; Various variables @@ -987,8 +976,8 @@ t if it successfully authenticates, nil otherwise." "imap" buffer imap-server imap-port) ((error quit) nil))) (when imap-process - (set-process-filter imap-process 'imap-arrival-filter) - (set-process-sentinel imap-process 'imap-sentinel) + (set-process-filter imap-process #'imap-arrival-filter) + (set-process-sentinel imap-process #'imap-sentinel) (while (and (eq imap-state 'initial) (memq (process-status imap-process) '(open run))) (message "Waiting for response from %s..." imap-server) @@ -1012,7 +1001,7 @@ necessary. If nil, the buffer name is generated." (with-current-buffer (get-buffer-create buffer) (if (imap-opened buffer) (imap-close buffer)) - (mapc 'make-local-variable imap-local-variables) + (mapc #'make-local-variable imap-local-variables) (set-buffer-multibyte nil) (buffer-disable-undo) (setq imap-server (or server imap-server)) @@ -1034,7 +1023,7 @@ necessary. If nil, the buffer name is generated." ;; Stream changed? (if (not (eq imap-default-stream stream)) (with-current-buffer (generate-new-buffer " *temp*") - (mapc 'make-local-variable imap-local-variables) + (mapc #'make-local-variable imap-local-variables) (set-buffer-multibyte nil) (buffer-disable-undo) (setq imap-server (or server imap-server)) @@ -1078,7 +1067,6 @@ necessary. If nil, the buffer name is generated." "If non-nil, check if IMAP is open. See the function `imap-ping-server'." :version "23.1" ;; No Gnus - :group 'imap :type 'boolean) (defun imap-opened (&optional buffer) @@ -1346,16 +1334,16 @@ If BUFFER is nil the current buffer is assumed." (when imap-current-mailbox (if asynch (imap-add-callback (imap-send-command "CLOSE") - `(lambda (tag status) - (message "IMAP mailbox `%s' closed... %s" - imap-current-mailbox status) - (when (eq ,imap-current-mailbox - imap-current-mailbox) - ;; Don't wipe out data if another mailbox - ;; was selected... - (setq imap-current-mailbox nil - imap-message-data nil - imap-state 'auth)))) + (let ((cmb imap-current-mailbox)) + (lambda (_tag status) + (message "IMAP mailbox `%s' closed... %s" + imap-current-mailbox status) + (when (eq cmb imap-current-mailbox) + ;; Don't wipe out data if another mailbox + ;; was selected... + (setq imap-current-mailbox nil + imap-message-data nil + imap-state 'auth))))) (when (imap-ok-p (imap-send-command-wait "CLOSE")) (setq imap-current-mailbox nil imap-message-data nil @@ -1740,8 +1728,8 @@ See `imap-enable-exchange-bug-workaround'." (prog1 (and (imap-fetch-safe '("*" . "*:*") "UID") (list (imap-mailbox-get-1 'uidvalidity mailbox) - (apply 'max (imap-message-map - (lambda (uid _prop) uid) 'UID)))) + (apply #'max (imap-message-map + (lambda (uid _prop) uid) 'UID)))) (if old-mailbox (imap-mailbox-select old-mailbox (eq state 'examine)) (imap-mailbox-unselect))))))) @@ -1786,7 +1774,7 @@ first element. The rest of list contains the saved articles' UIDs." (prog1 (and (imap-fetch-safe '("*" . "*:*") "UID") (list (imap-mailbox-get-1 'uidvalidity mailbox) - (apply 'max (imap-message-map + (apply #'max (imap-message-map (lambda (uid _prop) uid) 'UID)))) (if old-mailbox (imap-mailbox-select old-mailbox (eq state 'examine)) @@ -1820,7 +1808,7 @@ on failure." (numberp (nth 9 body))) (nth 9 body)) (t 0)) - (apply '+ (mapcar 'imap-body-lines body))) + (apply #'+ (mapcar #'imap-body-lines body))) 0)) (defun imap-envelope-from (from) @@ -2424,7 +2412,7 @@ Return nil if no complete line has arrived." (buffer-substring (point) (1- (re-search-forward "[] ]" nil t))))) (if (eq (char-before) ? ) (prog1 - (mapconcat 'identity (cons section (imap-parse-header-list)) " ") + (mapconcat #'identity (cons section (imap-parse-header-list)) " ") (search-forward "]" nil t)) section))) commit db8266b0b2861baf24f503fe9ab66d8b52cf4d75 Author: Stefan Monnier Date: Tue May 18 19:06:54 2021 -0400 * lisp/net/eudc.el (eudc-menu): Use proper closures diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el index c112d27330..425217cf65 100644 --- a/lisp/net/eudc.el +++ b/lisp/net/eudc.el @@ -1108,12 +1108,12 @@ queries the server for the existing fields and displays a corresponding form." proto-name))) (if (not (fboundp command)) (fset command - `(lambda () - (interactive) - (eudc-set-server ,server (quote ,protocol)) - (message "Selected directory server is now %s (%s)" - ,server - ,proto-name)))) + (lambda () + (interactive) + (eudc-set-server server protocol) + (message "Selected directory server is now %s (%s)" + server + proto-name)))) (vector (format "%s (%s)" server proto-name) command :style 'radio commit e61bb6f6fedc890fc3cd94e6da4d893536d9823c Author: Stefan Monnier Date: Tue May 18 19:05:29 2021 -0400 * lisp/net/browse-url.el: Avoid `(lambda ..) (browse-url-netscape, browse-url-mozilla, browse-url-galeon) (browse-url-epiphany, browse-url-elinks): Use proper closures. diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index 1c98335a20..717a018598 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -1113,8 +1113,8 @@ used instead of `browse-url-new-window-flag'." ",new-window")) ")")))))))) (set-process-sentinel process - `(lambda (process change) - (browse-url-netscape-sentinel process ,url))))) + (lambda (process _change) + (browse-url-netscape-sentinel process url))))) (function-put 'browse-url-netscape 'browse-url-browser-kind 'external) @@ -1185,8 +1185,8 @@ used instead of `browse-url-new-window-flag'." ",new-window")) ")")))))) (set-process-sentinel process - `(lambda (process change) - (browse-url-mozilla-sentinel process ,url))))) + (lambda (process _change) + (browse-url-mozilla-sentinel process url))))) (function-put 'browse-url-mozilla 'browse-url-browser-kind 'external) @@ -1303,8 +1303,8 @@ used instead of `browse-url-new-window-flag'." '("--existing")) (list url))))) (set-process-sentinel process - `(lambda (process change) - (browse-url-galeon-sentinel process ,url))))) + (lambda (process _change) + (browse-url-galeon-sentinel process url))))) (function-put 'browse-url-galeon 'browse-url-browser-kind 'external) @@ -1351,8 +1351,8 @@ used instead of `browse-url-new-window-flag'." '("--existing")) (list url))))) (set-process-sentinel process - `(lambda (process change) - (browse-url-epiphany-sentinel process ,url))))) + (lambda (process _change) + (browse-url-epiphany-sentinel process url))))) (function-put 'browse-url-epiphany 'browse-url-browser-kind 'external) @@ -1715,8 +1715,8 @@ from `browse-url-elinks-wrapper'." (elinks-ping-process (start-process "elinks-ping" nil "elinks" "-remote" "ping()"))) (set-process-sentinel elinks-ping-process - `(lambda (process change) - (browse-url-elinks-sentinel process ,url)))))) + (lambda (process _change) + (browse-url-elinks-sentinel process url)))))) (function-put 'browse-url-elinks 'browse-url-browser-kind 'external) commit abedac0909654f6e88fa4108c42f3c658644ab3c Author: Stefan Monnier Date: Tue May 18 19:03:06 2021 -0400 * lisp/misearch.el (multi-isearch-push-state): Use proper closures diff --git a/lisp/misearch.el b/lisp/misearch.el index 338880f25f..7f3e981bb0 100644 --- a/lisp/misearch.el +++ b/lisp/misearch.el @@ -202,8 +202,9 @@ the initial buffer." "Save a function restoring the state of multiple buffers search. Save the current buffer to the additional state parameter in the search status stack." - `(lambda (cmd) - (multi-isearch-pop-state cmd ,(current-buffer)))) + (let ((buf (current-buffer))) + (lambda (cmd) + (multi-isearch-pop-state cmd buf)))) (defun multi-isearch-pop-state (_cmd buffer) "Restore the multiple buffers search state in BUFFER. commit 41efaa54c540e9deddb49548163c0048866e3c34 Author: Stefan Monnier Date: Tue May 18 19:01:49 2021 -0400 * lisp/menu-bar.el: Avoid `(lambda (menu-bar-buffer-vector, menu-bar-update-buffers): Use proper closures. diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 55744221b8..b71c650207 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -2288,9 +2288,10 @@ It must accept a buffer as its only required argument.") (setq i (1- i)) (aset buffers-vec i (cons (car pair) - `(lambda () - (interactive) - (funcall menu-bar-select-buffer-function ,(cdr pair)))))) + (let ((buf (cdr pair))) + (lambda () + (interactive) + (funcall menu-bar-select-buffer-function buf)))))) buffers-vec)) (defun menu-bar-update-buffers (&optional force) @@ -2345,8 +2346,8 @@ It must accept a buffer as its only required argument.") (aset frames-vec i (cons (frame-parameter frame 'name) - `(lambda () - (interactive) (menu-bar-select-frame ,frame)))) + (lambda () + (interactive) (menu-bar-select-frame frame)))) (setq i (1+ i))) ;; Put it after the normal buffers (setq buffers-menu commit de4dcd8d108ac8f7855d55c7ba0ae4a10c853633 Author: Stefan Monnier Date: Tue May 18 18:13:28 2021 -0400 * lisp/info.el (Info-isearch-push-state): Use proper closures diff --git a/lisp/info.el b/lisp/info.el index 2757ed5782..cdf339ff6f 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -2148,8 +2148,10 @@ If DIRECTION is `backward', search in the reverse direction." (goto-char (if isearch-forward (point-min) (point-max))))) (defun Info-isearch-push-state () - `(lambda (cmd) - (Info-isearch-pop-state cmd ',Info-current-file ',Info-current-node))) + (let ((file Info-current-file) + (node Info-current-node)) + (lambda (cmd) + (Info-isearch-pop-state cmd file node)))) (defun Info-isearch-pop-state (_cmd file node) (or (and (equal Info-current-file file) commit 0ccd712ad26fff76fc8a26a861dc09ee0483b9ac Author: Stefan Monnier Date: Tue May 18 18:11:08 2021 -0400 * lisp/imenu.el (imenu--create-keymap): Use proper closures diff --git a/lisp/imenu.el b/lisp/imenu.el index 7fc57c1052..2024bb1e06 100644 --- a/lisp/imenu.el +++ b/lisp/imenu.el @@ -463,8 +463,8 @@ Non-nil arguments are in recursive calls." ((imenu--subalist-p item) (imenu--create-keymap (car item) (cdr item) cmd)) (t - `(lambda () (interactive) - ,(if cmd `(,cmd ',item) (list 'quote item))))))) + (lambda () (interactive) + (if cmd (funcall cmd item) item)))))) alist))) (defun imenu--in-alist (str alist) commit 2520a163cb28a180222fe4421123cc743581b893 Author: Stefan Monnier Date: Tue May 18 18:06:15 2021 -0400 * lisp/find-dired.el (find-dired): Use a proper closure diff --git a/lisp/find-dired.el b/lisp/find-dired.el index adc5672eca..87a7407a86 100644 --- a/lisp/find-dired.el +++ b/lisp/find-dired.el @@ -225,8 +225,8 @@ it finishes, type \\[kill-find]." (use-local-map map)) (setq-local dired-sort-inhibit t) (setq-local revert-buffer-function - `(lambda (ignore-auto noconfirm) - (find-dired ,dir ,find-args))) + (lambda (_ignore-auto _noconfirm) + (find-dired dir find-args))) ;; Set subdir-alist so that Tree Dired will work: (if (fboundp 'dired-simple-subdir-alist) ;; will work even with nested dired format (dired-nstd.el,v 1.15 commit 49c5299bbbfc103d03128f749d71a15169fe78d9 Author: Stefan Monnier Date: Tue May 18 18:05:05 2021 -0400 * lisp/facemenu.el (facemenu-add-new-face): Use `:documentation` diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 29ee4f8bdd..855ce0be69 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el @@ -827,15 +827,15 @@ This command was defined by `facemenu-add-new-face'." (key (setq function (intern (concat "facemenu-set-" name))) (fset function - `(lambda () - ,docstring - (interactive) - (facemenu-set-face - (quote ,symbol) - (if (and mark-active (not current-prefix-arg)) - (region-beginning)) - (if (and mark-active (not current-prefix-arg)) - (region-end))))) + (lambda () + (:documentation docstring) + (interactive) + (facemenu-set-face + symbol + (if (and mark-active (not current-prefix-arg)) + (region-beginning)) + (if (and mark-active (not current-prefix-arg)) + (region-end))))) (define-key 'facemenu-keymap key (cons name function)) (define-key menu key (cons name function))) ;; Faces with no keyboard equivalent. Figure out where to put it: commit f57b0f08b44c90f02450563e6fd0c75806fcd2f7 Author: Stefan Monnier Date: Tue May 18 17:53:23 2021 -0400 * lisp/eshell/em-pred.el: Take advantage of lexical scoping Also remove redundant `:group` arguments. (eshell-parse-modifiers): Make sure we pass a function value. (eshell-parse-arg-modifier, eshell-parse-modifiers) (eshell-add-pred-func, eshell-pred-user-or-group) (eshell-pred-file-time, eshell-pred-file-type, eshell-pred-file-mode) (eshell-pred-file-links, eshell-pred-file-size) (eshell-pred-substitute, eshell-include-members, eshell-join-members) (eshell-split-members): Use proper closures. diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el index 0780d6ee83..def52f42e5 100644 --- a/lisp/eshell/em-pred.el +++ b/lisp/eshell/em-pred.el @@ -63,8 +63,7 @@ ordinary strings." (defcustom eshell-pred-load-hook nil "A list of functions to run when `eshell-pred' is loaded." :version "24.1" ; removed eshell-pred-initialize - :type 'hook - :group 'eshell-pred) + :type 'hook) (defcustom eshell-predicate-alist '((?/ . (eshell-pred-file-type ?d)) ; directories @@ -108,8 +107,7 @@ ordinary strings." The format of each entry is (CHAR . PREDICATE-FUNC-SEXP)" - :type '(repeat (cons character sexp)) - :group 'eshell-pred) + :type '(repeat (cons character sexp))) (put 'eshell-predicate-alist 'risky-local-variable t) @@ -146,8 +144,7 @@ The format of each entry is The format of each entry is (CHAR ENTRYWISE-P MODIFIER-FUNC-SEXP)" - :type '(repeat (cons character sexp)) - :group 'eshell-pred) + :type '(repeat (cons character sexp))) (put 'eshell-modifier-alist 'risky-local-variable t) @@ -297,9 +294,9 @@ This function is specially for adding onto `eshell-parse-argument-hook'." (append eshell-current-modifiers (list - `(lambda (lst) - (eshell-apply-modifiers - lst (quote ,preds) (quote ,mods))))))))) + (lambda (lst) + (eshell-apply-modifiers + lst preds mods)))))))) (goto-char (1+ end)) (eshell-finish-arg)))))) @@ -324,7 +321,7 @@ resultant list of strings." (if (looking-at "[^|':]") (let ((func (read (current-buffer)))) (if (and func (functionp func)) - (setq preds (eshell-add-pred-func func preds + (setq preds (eshell-add-pred-func (eval func t) preds negate follow)) (error "Invalid function predicate `%s'" (eshell-stringify func)))) @@ -341,8 +338,7 @@ resultant list of strings." (let ((func (read (current-buffer)))) (if (and func (functionp func)) (setq mods - (cons `(lambda (lst) - (mapcar (function ,func) lst)) + (cons (lambda (lst) (mapcar func lst)) mods)) (error "Invalid function modifier `%s'" (eshell-stringify func)))) @@ -353,14 +349,14 @@ resultant list of strings." (if (not mod) (error "Unknown modifier character `%c'" (char-after)) (forward-char) - (setq mods (cons (eval (cdr mod)) mods))))) + (setq mods (cons (eval (cdr mod) t) mods))))) (t (let ((pred (assq char eshell-predicate-alist))) (if (not pred) (error "Unknown predicate character `%c'" char) (forward-char) (setq preds - (eshell-add-pred-func (eval (cdr pred)) preds + (eshell-add-pred-func (eval (cdr pred) t) preds negate follow)))))))) (end-of-buffer (error "Predicate or modifier ended prematurely"))) @@ -369,11 +365,11 @@ resultant list of strings." (defun eshell-add-pred-func (pred funcs negate follow) "Add the predicate function PRED to FUNCS." (if negate - (setq pred `(lambda (file) - (not (funcall ,pred file))))) + (setq pred (lambda (file) + (not (funcall pred file))))) (if follow - (setq pred `(lambda (file) - (funcall ,pred (file-truename file))))) + (setq pred (lambda (file) + (funcall pred (file-truename file))))) (cons pred funcs)) (defun eshell-pred-user-or-group (mod-char mod-type attr-index get-id-func) @@ -399,10 +395,10 @@ resultant list of strings." (unless ugid (error "Unknown %s name specified for modifier `%c'" mod-type mod-char)) - `(lambda (file) - (let ((attrs (file-attributes file))) - (if attrs - (= (nth ,attr-index attrs) ,ugid)))))) + (lambda (file) + (let ((attrs (file-attributes file))) + (if attrs + (= (nth attr-index attrs) ugid)))))) (defun eshell-pred-file-time (mod-char mod-type attr-index) "Return a predicate to test whether a file matches a certain time." @@ -445,13 +441,13 @@ resultant list of strings." (error "Cannot stat file `%s'" file)) (setq when (nth attr-index attrs))) (goto-char (1+ end))) - `(lambda (file) - (let ((attrs (file-attributes file))) - (if attrs - (,(cond ((eq qual ?-) #'time-less-p) + (let ((f (cond ((eq qual ?-) #'time-less-p) ((eq qual ?+) (lambda (a b) (time-less-p b a))) - (#'time-equal-p)) - ,when (nth ,attr-index attrs))))))) + (#'time-equal-p)))) + (lambda (file) + (let ((attrs (file-attributes file))) + (if attrs + (funcall f when (nth attr-index attrs)))))))) (defun eshell-pred-file-type (type) "Return a test which tests that the file is of a certain TYPE. @@ -462,20 +458,20 @@ that `ls -l' will show in the first column of its display." (if (memq type '(?b ?c)) (forward-char) (setq type ?%))) - `(lambda (file) - (let ((attrs (eshell-file-attributes (directory-file-name file)))) - (if attrs - (memq (aref (file-attribute-modes attrs) 0) - ,(if (eq type ?%) - '(?b ?c) - (list 'quote (list type)))))))) + (let ((set (if (eq type ?%) + '(?b ?c) + (list type)))) + (lambda (file) + (let ((attrs (eshell-file-attributes (directory-file-name file)))) + (if attrs + (memq (aref (file-attribute-modes attrs) 0) set)))))) (defsubst eshell-pred-file-mode (mode) "Return a test which tests that MODE pertains to the file." - `(lambda (file) - (let ((modes (file-modes file 'nofollow))) - (if modes - (not (zerop (logand ,mode modes))))))) + (lambda (file) + (let ((modes (file-modes file 'nofollow))) + (if modes + (not (zerop (logand mode modes))))))) (defun eshell-pred-file-links () "Return a predicate to test whether a file has a given number of links." @@ -487,15 +483,15 @@ that `ls -l' will show in the first column of its display." (error "Invalid file link count modifier `l'")) (setq amount (string-to-number (match-string 0))) (goto-char (match-end 0)) - `(lambda (file) - (let ((attrs (eshell-file-attributes file))) - (if attrs - (,(if (eq qual ?-) - '< - (if (eq qual ?+) - '> - '=)) - (file-attribute-link-number attrs) ,amount)))))) + (let ((f (if (eq qual ?-) + #'< + (if (eq qual ?+) + #'> + #'=)))) + (lambda (file) + (let ((attrs (eshell-file-attributes file))) + (if attrs + (funcall f (file-attribute-link-number attrs) amount))))))) (defun eshell-pred-file-size () "Return a predicate to test whether a file is of a given size." @@ -517,15 +513,15 @@ that `ls -l' will show in the first column of its display." (error "Invalid file size modifier `L'")) (setq amount (* (string-to-number (match-string 0)) quantum)) (goto-char (match-end 0)) - `(lambda (file) - (let ((attrs (eshell-file-attributes file))) - (if attrs - (,(if (eq qual ?-) - '< - (if (eq qual ?+) - '> - '=)) - (file-attribute-size attrs) ,amount)))))) + (let ((f (if (eq qual ?-) + #'< + (if (eq qual ?+) + #'> + #'=)))) + (lambda (file) + (let ((attrs (eshell-file-attributes file))) + (if attrs + (funcall f (file-attribute-size attrs) amount))))))) (defun eshell-pred-substitute (&optional repeat) "Return a modifier function that will substitute matches." @@ -539,22 +535,22 @@ that `ls -l' will show in the first column of its display." replace (buffer-substring-no-properties (point) end)) (goto-char (1+ end)) (if repeat - `(lambda (lst) - (mapcar - (lambda (str) - (let ((i 0)) - (while (setq i (string-match ,match str i)) - (setq str (replace-match ,replace t nil str)))) - str) - lst)) - `(lambda (lst) - (mapcar - (lambda (str) - (if (string-match ,match str) - (setq str (replace-match ,replace t nil str)) - (error (concat str ": substitution failed"))) - str) - lst))))) + (lambda (lst) + (mapcar + (lambda (str) + (let ((i 0)) + (while (setq i (string-match match str i)) + (setq str (replace-match replace t nil str)))) + str) + lst)) + (lambda (lst) + (mapcar + (lambda (str) + (if (string-match match str) + (setq str (replace-match replace t nil str)) + (error (concat str ": substitution failed"))) + str) + lst))))) (defun eshell-include-members (&optional invert-p) "Include only lisp members matching a regexp." @@ -564,12 +560,12 @@ that `ls -l' will show in the first column of its display." (setq end (eshell-find-delimiter delim delim nil nil t) regexp (buffer-substring-no-properties (point) end)) (goto-char (1+ end)) - `(lambda (lst) - (eshell-winnow-list - lst nil '((lambda (elem) - ,(if invert-p - `(not (string-match ,regexp elem)) - `(string-match ,regexp elem)))))))) + (let ((predicates + (list (if invert-p + (lambda (elem) (not (string-match regexp elem))) + (lambda (elem) (string-match regexp elem)))))) + (lambda (lst) + (eshell-winnow-list lst nil predicates))))) (defun eshell-join-members () "Return a modifier function that join matches." @@ -581,8 +577,8 @@ that `ls -l' will show in the first column of its display." (setq end (eshell-find-delimiter delim delim nil nil t) str (buffer-substring-no-properties (point) end)) (goto-char (1+ end))) - `(lambda (lst) - (mapconcat 'identity lst ,str)))) + (lambda (lst) + (mapconcat #'identity lst str)))) (defun eshell-split-members () "Return a modifier function that splits members." @@ -593,10 +589,11 @@ that `ls -l' will show in the first column of its display." (setq end (eshell-find-delimiter delim delim nil nil t) sep (buffer-substring-no-properties (point) end)) (goto-char (1+ end))) - `(lambda (lst) - (mapcar - (lambda (str) - (split-string str ,sep)) lst)))) + (lambda (lst) + (mapcar + (lambda (str) + (split-string str sep)) + lst)))) (provide 'em-pred) commit 39b67c3ffe475107218adbd68a78d8eda6cc83c7 Author: Juri Linkov Date: Wed May 19 00:15:30 2021 +0300 * doc/emacs/basic.texi (Repeating): Document repeat-exit-timeout (bug#48472). diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi index 666a479582..ba8d822b18 100644 --- a/doc/emacs/basic.texi +++ b/doc/emacs/basic.texi @@ -895,4 +895,7 @@ Currently supported shorter key sequences are @kbd{C-x u u} instead of v v} to resize the selected window interactively, @kbd{M-g n n p p} to navigate @code{next-error} matches. Any other key exits transient mode and then is executed normally. The user option @code{repeat-exit-key} -defines an additional key to exit this transient mode. +defines an additional key to exit this transient mode. Also it's +possible to break the repetition chain automatically after idle time +by customizing the user option @code{repeat-exit-timeout} to a number +of seconds. diff --git a/etc/NEWS b/etc/NEWS index ae8a864f10..8bbb972493 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2385,6 +2385,8 @@ You can type 'C-x u u' instead of 'C-x u C-x u' to undo many changes, 'M-g n n p p' to navigate next-error matches. Any other key exits transient mode and then is executed normally. 'repeat-exit-key' defines an additional key to exit mode like 'isearch-exit' ('RET'). +The user option 'repeat-exit-timeout' specifies the number of +seconds of idle time to break the repetition chain automatically. With 'repeat-keep-prefix' you can keep the prefix arg of the previous command. For example, this can help to reverse the window navigation direction with e.g. 'C-x o M-- o o'. Also it can help to set a new commit 2c47eaa18a4a3f7eb53ed826d8c5d018ac843586 Author: Stefan Monnier Date: Tue May 18 17:13:37 2021 -0400 * lisp/emacs-lisp/eieio-core.el (eieio-defclass-internal): Use a closure diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index 2923dffd95..34b4575182 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el @@ -347,19 +347,20 @@ See `defclass' for more information." (when eieio-backward-compatibility (let ((csym (intern (concat (symbol-name cname) "-list-p")))) (defalias csym - `(lambda (obj) - ,(format - "Test OBJ to see if it a list of objects which are a child of type %s" - cname) - (when (listp obj) - (let ((ans t)) ;; nil is valid - ;; Loop over all the elements of the input list, test - ;; each to make sure it is a child of the desired object class. - (while (and obj ans) - (setq ans (and (eieio-object-p (car obj)) - (object-of-class-p (car obj) ,cname))) - (setq obj (cdr obj))) - ans)))) + (lambda (obj) + (:documentation + (format + "Test OBJ to see if it a list of objects which are a child of type %s" + cname)) + (when (listp obj) + (let ((ans t)) ;; nil is valid + ;; Loop over all the elements of the input list, test + ;; each to make sure it is a child of the desired object class. + (while (and obj ans) + (setq ans (and (eieio-object-p (car obj)) + (object-of-class-p (car obj) 'cname))) + (setq obj (cdr obj))) + ans)))) (make-obsolete csym (format "use (cl-typep ... \\='(list-of %s)) instead" cname) commit 0fa959db203f9d6c2d09cb1e026b5b99a5274e79 Author: Juri Linkov Date: Wed May 19 00:02:42 2021 +0300 * lisp/repeat.el (repeat-exit-timeout): New defcustom (bug#48472). (repeat-exit-timer): New variable. (repeat-post-hook): Run idle timer with an "exit function" returned from set-transient-map. Suggested by Gustavo Barros . (repeat-echo-message): Remove own previous message when input arg is nil. * lisp/window.el (display-buffer-override-next-command): Return exitfun. diff --git a/lisp/repeat.el b/lisp/repeat.el index b7118cc7f9..46c880d0dd 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el @@ -338,10 +338,22 @@ recently executed command not bound to an input event\"." "Key that stops the modal repeating of keys in sequence. For example, you can set it to like `isearch-exit'." :type '(choice (const :tag "No special key to exit repeating sequence" nil) - (key-sequence :tag "Key that exits repeating sequence")) + (key-sequence :tag "Key that exits repeating sequence")) :group 'convenience :version "28.1") +(defcustom repeat-exit-timeout nil + "Break the repetition chain of keys after specified timeout. +When a number, exit the repeat mode after idle time of the specified +number of seconds." + :type '(choice (const :tag "No timeout to exit repeating sequence" nil) + (number :tag "Timeout in seconds to exit repeating")) + :group 'convenience + :version "28.1") + +(defvar repeat-exit-timer nil + "Timer activated after the last key typed in the repeating key sequence.") + (defcustom repeat-keep-prefix t "Keep the prefix arg of the previous command." :type 'boolean @@ -420,16 +432,32 @@ When Repeat mode is enabled, and the command symbol has the property named (setq prefix-arg current-prefix-arg)) (setq repeat-in-progress t) - (set-transient-map map)))))) + (let ((exitfun (set-transient-map map))) + + (when repeat-exit-timer + (cancel-timer repeat-exit-timer) + (setq repeat-exit-timer nil)) + + (when repeat-exit-timeout + (setq repeat-exit-timer + (run-with-idle-timer + repeat-exit-timeout nil + (lambda () + (setq repeat-in-progress nil) + (funcall exitfun) + (funcall repeat-echo-function nil))))))))))) (setq repeat-map nil) (when (and was-in-progress (not repeat-in-progress)) + (when repeat-exit-timer + (cancel-timer repeat-exit-timer) + (setq repeat-exit-timer nil)) (funcall repeat-echo-function nil)))) -(defun repeat-echo-message-string (map) +(defun repeat-echo-message-string (keymap) "Return a string with a list of repeating keys." (let (keys) - (map-keymap (lambda (key _) (push key keys)) map) + (map-keymap (lambda (key _) (push key keys)) keymap) (format-message "Repeat with %s%s" (mapconcat (lambda (key) (key-description (vector key))) @@ -439,21 +467,23 @@ When Repeat mode is enabled, and the command symbol has the property named (key-description repeat-exit-key)) "")))) -(defun repeat-echo-message (map) +(defun repeat-echo-message (keymap) "Display available repeating keys in the echo area." - (when map - (let ((mess (repeat-echo-message-string map))) - (if (current-message) - (message "%s [%s]" (current-message) mess) - (message mess))))) + (if keymap + (let ((mess (repeat-echo-message-string keymap))) + (if (current-message) + (message "%s [%s]" (current-message) mess) + (message mess))) + (when (string-prefix-p "Repeat with " (current-message)) + (message nil)))) (defvar repeat-echo-mode-line-string (propertize "[Repeating...] " 'face 'mode-line-emphasis) "String displayed in the mode line in repeating mode.") -(defun repeat-echo-mode-line (map) +(defun repeat-echo-mode-line (keymap) "Display the repeat indicator in the mode line." - (if map + (if keymap (unless (assq 'repeat-in-progress mode-line-modes) (add-to-list 'mode-line-modes (list 'repeat-in-progress repeat-echo-mode-line-string))) diff --git a/lisp/window.el b/lisp/window.el index 026cde5901..5a30713666 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -8634,7 +8634,9 @@ meaning of these values in `window--display-buffer'. Optional `post-function' is called after the buffer is displayed in the window; the function takes two arguments: an old and new window. Optional string argument `echo' can be used to add a prefix to the -command echo keystrokes that should describe the current prefix state." +command echo keystrokes that should describe the current prefix state. +This returns an \"exit function\", which can be called with no argument +to deactivate this overriding action." (let* ((old-window (or (minibuffer-selected-window) (selected-window))) (new-window nil) (minibuffer-depth (minibuffer-depth)) @@ -8676,7 +8678,8 @@ command echo keystrokes that should describe the current prefix state." (add-hook 'post-command-hook clearfun) (when echofun (add-hook 'prefix-command-echo-keystrokes-functions echofun)) - (push action (car display-buffer-overriding-action)))) + (push action (car display-buffer-overriding-action)) + exitfun)) (defun set-window-text-height (window height) commit 48744903de305ddd748e7f57a0112b0c2c86dca5 Author: Stefan Monnier Date: Tue May 18 16:58:54 2021 -0400 * lisp/calendar/cal-menu.el (cal-menu-holidays-menu): Use a proper closure diff --git a/lisp/calendar/cal-menu.el b/lisp/calendar/cal-menu.el index 497f332905..ef84bfadd3 100644 --- a/lisp/calendar/cal-menu.el +++ b/lisp/calendar/cal-menu.el @@ -104,9 +104,9 @@ ;; The bug has since been fixed. (dotimes (i 11) (push (vector (format "hol-year-%d" i) - `(lambda () - (interactive) - (holiday-list (+ displayed-year ,(- i 5)))) + (lambda () + (interactive) + (holiday-list (+ displayed-year (- i 5)))) :label `(format "For Year %d" (+ displayed-year ,(- i 5)))) l)) commit 502e3ce614ce9cec60a9f8fb9b6beb216131e362 Author: Juri Linkov Date: Tue May 18 23:35:57 2021 +0300 * lisp/emacs-lisp/lisp-mode.el (lisp-outline-level): Fix imprecise numbers. (lisp-outline-level): Return right levels starting from 1 instead of 5. Suggested by Howard Melman in bug#46878. diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 67b7546094..59325d647d 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -682,10 +682,16 @@ font-lock keywords will not be case sensitive." (defun lisp-outline-level () "Lisp mode `outline-level' function." + ;; Expects outline-regexp is ";;;\\(;* [^ \t\n]\\|###autoload\\)\\|(" + ;; and point is at the beginning of a matching line. (let ((len (- (match-end 0) (match-beginning 0)))) - (if (looking-at "(\\|;;;###autoload") - 1000 - len))) + (cond ((looking-at "(\\|;;;###autoload") + 1000) + ((looking-at ";;\\(;+\\) ") + (- (match-end 1) (match-beginning 1))) + ;; Above should match everything but just in case. + (t + len)))) (defun lisp-current-defun-name () "Return the name of the defun at point, or nil." commit 83be3e9598530eb77e6bbcc93b2e16934d2606af Author: Juri Linkov Date: Tue May 18 23:23:50 2021 +0300 * lisp/simple.el (read-from-kill-ring): Add new arg PROMPT (bug#48478). * lisp/simple.el (yank-pop, yank-from-kill-ring): * lisp/isearch.el (isearch-yank-from-kill-ring): Use arg PROMPT in the call read-from-kill-ring. diff --git a/lisp/isearch.el b/lisp/isearch.el index 536c76ea5d..00969e5e2a 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -2538,7 +2538,7 @@ If search string is empty, just beep." "Read a string from the `kill-ring' and append it to the search string." (interactive) (with-isearch-suspended - (let ((string (read-from-kill-ring))) + (let ((string (read-from-kill-ring "Yank from kill-ring: "))) (if (and isearch-case-fold-search (eq 'not-yanks search-upper-case)) (setq string (downcase string))) diff --git a/lisp/simple.el b/lisp/simple.el index 3f211bfb36..2d9b7dddab 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5587,7 +5587,8 @@ This command honors the `yank-handled-properties' and property, in the way that `yank' does." (interactive "p") (if (not (eq last-command 'yank)) - (yank-from-kill-ring (read-from-kill-ring) current-prefix-arg) + (yank-from-kill-ring (read-from-kill-ring "Yank from kill-ring: ") + current-prefix-arg) (setq this-command 'yank) (unless arg (setq arg 1)) (let ((inhibit-read-only t) @@ -5676,8 +5677,9 @@ With ARG, rotate that many kills forward (or backward, if negative)." (current-kill arg)) (defvar read-from-kill-ring-history) -(defun read-from-kill-ring () - "Read a `kill-ring' entry using completion and minibuffer history." +(defun read-from-kill-ring (prompt) + "Read a `kill-ring' entry using completion and minibuffer history. +PROMPT is a string to prompt with." ;; `current-kill' updates `kill-ring' with a possible interprogram-paste (current-kill 0) (let* ((history-add-new-input nil) @@ -5721,11 +5723,7 @@ With ARG, rotate that many kills forward (or backward, if negative)." (define-key map "?" nil) map))) (completing-read - ;; FIXME: This prompt is specific to using this function from - ;; yank-related commands, but the function could be used in - ;; other contexts. Should the prompt be passed via an - ;; argument? - "Yank from kill-ring: " + prompt (lambda (string pred action) (if (eq action 'metadata) ;; Keep sorted by recency @@ -5755,7 +5753,8 @@ With \\[universal-argument] as argument, this command puts point at beginning of the inserted text and mark at the end, like `yank' does. When called from Lisp, insert STRING like `insert-for-yank' does." - (interactive (list (read-from-kill-ring) current-prefix-arg)) + (interactive (list (read-from-kill-ring "Yank from kill-ring: ") + current-prefix-arg)) (push-mark) (insert-for-yank string) (if (consp arg) commit 63e4ed1c8f1c5bbf59c366134d379bae972201f9 Author: Philipp Stephani Date: Tue May 18 18:43:11 2021 +0200 Recreate symptom of Bug#42701. The fix to Bug#48489 (commit 9676d41b8301b84e07717e633059a3f2b5c4c9d8) has masked the symptom of Bug#42701 for 'if-let'. Create a helper macro that still exemplifies the bug. * test/lisp/emacs-lisp/edebug-tests.el (edebug-tests--duplicate-symbol-backtrack): New helper macro. (edebug-tests-duplicate-symbol-backtrack): Use it instead of 'if-let'. diff --git a/test/lisp/emacs-lisp/edebug-tests.el b/test/lisp/emacs-lisp/edebug-tests.el index 7d45432e57..2f45050e2e 100644 --- a/test/lisp/emacs-lisp/edebug-tests.el +++ b/test/lisp/emacs-lisp/edebug-tests.el @@ -1029,14 +1029,21 @@ clashes (Bug#41853)." inner@cl-flet@10002 edebug-tests-cl-flet-2))))))) +(defmacro edebug-tests--duplicate-symbol-backtrack (arg) + "Helper macro that exemplifies Bug#42701. +ARG is either (FORM) or (FORM IGNORED)." + (declare (debug ([&or (form) (form sexp)]))) + (car arg)) + (ert-deftest edebug-tests-duplicate-symbol-backtrack () "Check that Edebug doesn't create duplicate symbols when backtracking (Bug#42701)." (with-temp-buffer - (dolist (form '((require 'subr-x) - (defun edebug-tests-duplicate-symbol-backtrack () - (if-let (x (funcall (lambda (y) 1) 2)) 3 4)))) - (print form (current-buffer))) + (print '(defun edebug-tests-duplicate-symbol-backtrack () + (edebug-tests--duplicate-symbol-backtrack + ;; Passing (FORM IGNORED) forces backtracking. + ((lambda () 123) ignored))) + (current-buffer)) (let* ((edebug-all-defs t) (edebug-initial-mode 'Go-nonstop) (instrumented-names ()) commit 68f5718c0a4393391ce3c4179e8ab1430e5b0119 Author: Lars Ingebrigtsen Date: Tue May 18 17:49:05 2021 +0200 Fix some regressions introduced by the previous dired-aux change * lisp/dired-aux.el (dired-compress-file): Check that the file we're compressing exists. Also work outside the current directory. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 2e4ff93459..eb43ab187d 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1334,7 +1334,8 @@ Return nil if no change in files." (user-error "No compression rule found for suffix %s, \ see `dired-compress-file-alist' for the supported suffixes list." dired-compress-file-default-suffix) - (and (or (not (file-exists-p out-name)) + (and (file-exists-p file) + (or (not (file-exists-p out-name)) (y-or-n-p (format "File %s already exists. Really compress? " @@ -1343,8 +1344,7 @@ see `dired-compress-file-alist' for the supported suffixes list." (replace-regexp-in-string "%o" (shell-quote-argument out-name) (replace-regexp-in-string - "%i" (shell-quote-argument - (file-name-nondirectory file)) + "%i" (shell-quote-argument file) (cdr rule) nil t) nil t)) commit 33c0994c7cbb6a5048db10b3b05d31e8d72f220a Author: Basil L. Contovounesios Date: Tue May 18 16:28:42 2021 +0100 Look for ElDoc buffer in all visible frames * lisp/emacs-lisp/eldoc.el (eldoc--echo-area-prefer-doc-buffer-p): Look for a window displaying the ElDoc documentation buffer in all visible frames, as promised by the user option eldoc-echo-area-prefer-doc-buffer (bug#48278). diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el index b4f068cf3a..cec89cf3bc 100644 --- a/lisp/emacs-lisp/eldoc.el +++ b/lisp/emacs-lisp/eldoc.el @@ -538,7 +538,7 @@ documentation to potentially appear in the echo are is truncated." (and truncatedp (eq eldoc-echo-area-prefer-doc-buffer 'maybe))) - (get-buffer-window eldoc--doc-buffer))) + (get-buffer-window eldoc--doc-buffer 'visible))) (defun eldoc-display-in-echo-area (docs _interactive) "Display DOCS in echo area. commit 304a3b9ee8fdde52d7379fc5ac5be71a54fdfeb0 Author: Miha Rihtaršič Date: Tue May 18 17:08:58 2021 +0200 Fix problem with focusing in `C-o' in ibuffer in some circumstances * lisp/ibuffer.el (ibuffer-visit-buffer-other-window-noselect): Use display-buffer instead of pop-to-buffer and selecting the old window. `pop-to-buffer' focuses the new frame, but `select-window' usually fails to focus the original frame. This simple patch fixes that (bug#48218). diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index b484dd717c..c80222ed0f 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -988,9 +988,7 @@ one window." (let ((buf (ibuffer-current-buffer t))) (bury-buffer (current-buffer)) (if noselect - (let ((curwin (selected-window))) - (pop-to-buffer buf) - (select-window curwin)) + (display-buffer buf) (switch-to-buffer-other-window buf)))) (defun ibuffer-visit-buffer-other-window-noselect () commit ab20f385a7bae0c2938e50545c1045378a3e0575 Author: Gong Qijian Date: Tue May 18 16:35:48 2021 +0200 Fix `custom-delayed-init-variables' problem when re-dumping emacs * lisp/startup.el (command-line): Don't bug out on redumping Emacs (bug#48492). Copyright-paperwork-exempt: yes diff --git a/lisp/startup.el b/lisp/startup.el index bb25c1b7b0..2ba5d74554 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1197,11 +1197,11 @@ please check its value") ;; Re-evaluate predefined variables whose initial value depends on ;; the runtime context. - (setq custom-delayed-init-variables - ;; Initialize them in the same order they were loaded, in case there - ;; are dependencies between them. - (nreverse custom-delayed-init-variables)) - (mapc #'custom-reevaluate-setting custom-delayed-init-variables) + (when (listp custom-delayed-init-variables) + (mapc #'custom-reevaluate-setting + ;; Initialize them in the same order they were loaded, in + ;; case there are dependencies between them. + (reverse custom-delayed-init-variables))) (setq custom-delayed-init-variables t) ;; Warn for invalid user name. commit 6a7e503ccaf7ccdc47916fa12012ae19b30a016c Author: Stefan Monnier Date: Tue May 18 10:37:57 2021 -0400 * lisp/kmacro.el: Fix test cases broken by last change (kmacro-lambda-form): Remove unused args `counter` and `format`. Arrange to be able to extract `mac` from the function. (kmacro-extract-lambda): Use this new extraction instead of digging into the guts of a function's code. diff --git a/lisp/kmacro.el b/lisp/kmacro.el index 4e92277d0f..3700a1964a 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -782,24 +782,32 @@ If kbd macro currently being defined end it before activating it." ;; executing the macro later on (but that's controversial...) ;;;###autoload -(defun kmacro-lambda-form (mac &optional counter format) +(defun kmacro-lambda-form (mac) "Create lambda form for macro bound to symbol or key." - (let ((mac (if counter (list mac counter format) mac))) - (lambda (&optional arg) - "Keyboard macro." - (interactive "p") + ;; FIXME: This should be a "funcallable struct"! + (lambda (&optional arg) + "Keyboard macro." + ;; We put an "unused prompt" as a special marker so + ;; `kmacro-extract-lambda' can see it's "one of us". + (interactive "pkmacro") + (if (eq arg 'kmacro--extract-lambda) + (cons 'kmacro--extract-lambda mac) (kmacro-exec-ring-item mac arg)))) (defun kmacro-extract-lambda (mac) "Extract kmacro from a kmacro lambda form." - (and (eq (car-safe mac) 'lambda) - (setq mac (assoc 'kmacro-exec-ring-item mac)) - (setq mac (car-safe (cdr-safe (car-safe (cdr-safe mac))))) - (listp mac) - (= (length mac) 3) - (arrayp (car mac)) - mac)) - + (let ((mac (cond + ((eq (car-safe mac) 'lambda) + (let ((e (assoc 'kmacro-exec-ring-item mac))) + (car-safe (cdr-safe (car-safe (cdr-safe e)))))) + ((and (functionp mac) + (equal (interactive-form mac) '(interactive "pkmacro"))) + (let ((r (funcall mac 'kmacro--extract-lambda))) + (and (eq (car-safe r) 'kmacro--extract-lambda) (cdr r))))))) + (and (consp mac) + (= (length mac) 3) + (arrayp (car mac)) + mac))) (defalias 'kmacro-p #'kmacro-extract-lambda "Return non-nil if MAC is a kmacro keyboard macro.") commit 2c90aa93a9d4d53c090dbb8a33501fa4e8cefc64 Author: Alexandr Vityazev Date: Tue May 18 15:36:25 2021 +0200 Fix the length= shortdoc example * lisp/emacs-lisp/shortdoc.el (list): Fix the length= example (bug#48495). Copyright-paperwork-exempt: yes diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index 9b31d68703..0320e17182 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -625,7 +625,7 @@ There can be any number of :example/:result elements." (length> :eval (length> '(a b c) 1)) (length= - :eval (length> '(a b c) 3)) + :eval (length= '(a b c) 3)) (safe-length :eval (safe-length '(a b c)))) commit cbd3a3b87d590b42c0e37f376c35200712bf5e1d Author: Eli Zaretskii Date: Tue May 18 15:00:04 2021 +0300 Revert "* lisp/bookmark.el: make bookmark-fontify nil default value" This reverts commit ed8c3303f945fbd2c16ece0e87d041c75ae05ff9. diff --git a/lisp/bookmark.el b/lisp/bookmark.el index a4951b506f..64b467adfa 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el @@ -173,7 +173,7 @@ A non-nil value may result in truncated bookmark names." "Time before `bookmark-bmenu-search' updates the display." :type 'number) -(defcustom bookmark-fontify nil +(defcustom bookmark-fontify t "Whether to colorize a bookmarked line. If non-nil, setting a bookmark will colorize the current line with `bookmark-face'." commit be9db2b94d31a0afe3f93302558b3a78605244c7 Author: Mattias Engdegård Date: Tue May 18 12:03:11 2021 +0200 Fix pcase 'rx' patterns with a single named submatch (bug#48477) pcase 'rx' patterns with a single named submatch, like (rx (let x "a")) would always succeed because of an over-optimistic transformation. Patterns with 0 or more than 1 named submatches were not affected. Reported by Philipp Stephani. * lisp/emacs-lisp/rx.el (rx--pcase-macroexpander): Special case for a single named submatch. * test/lisp/emacs-lisp/rx-tests.el (rx-pcase): Add tests. diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index 1e3eb9c12b..43bd84d999 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -1445,12 +1445,23 @@ following constructs: (regexp (rx--to-expr (rx--pcase-transform (cons 'seq regexps)))) (nvars (length rx--pcase-vars))) `(and (pred stringp) - ,(if (zerop nvars) - ;; No variables bound: a single predicate suffices. - `(pred (string-match ,regexp)) + ,(pcase nvars + (0 + ;; No variables bound: a single predicate suffices. + `(pred (string-match ,regexp))) + (1 + ;; Create a match value that on a successful regexp match + ;; is the submatch value, 0 on failure. We can't use nil + ;; for failure because it is a valid submatch value. + `(app (lambda (s) + (if (string-match ,regexp s) + (match-string 1 s) + 0)) + (and ,(car rx--pcase-vars) (pred (not numberp))))) + (_ ;; Pack the submatches into a dotted list which is then ;; immediately destructured into individual variables again. - ;; This is of course slightly inefficient when NVARS > 1. + ;; This is of course slightly inefficient. ;; A dotted list is used to reduce the number of conses ;; to create and take apart. `(app (lambda (s) @@ -1463,7 +1474,7 @@ following constructs: (rx--reduce-right #'cons (mapcar (lambda (name) (list '\, name)) - (reverse rx--pcase-vars))))))))) + (reverse rx--pcase-vars)))))))))) ;; Obsolete internal symbol, used in old versions of the `flycheck' package. (define-obsolete-function-alias 'rx-submatch-n 'rx-to-string "27.1") diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el index 2dd1bca22d..4828df0de9 100644 --- a/test/lisp/emacs-lisp/rx-tests.el +++ b/test/lisp/emacs-lisp/rx-tests.el @@ -166,6 +166,20 @@ (backref 1)) (list u v))) '("1" "3"))) + (should (equal (pcase "bz" + ((rx "a" (let x nonl)) (list 1 x)) + (_ 'no)) + 'no)) + (should (equal (pcase "az" + ((rx "a" (let x nonl)) (list 1 x)) + ((rx "b" (let x nonl)) (list 2 x)) + (_ 'no)) + '(1 "z"))) + (should (equal (pcase "bz" + ((rx "a" (let x nonl)) (list 1 x)) + ((rx "b" (let x nonl)) (list 2 x)) + (_ 'no)) + '(2 "z"))) (let ((k "blue")) (should (equal (pcase "" ((rx "<" (literal k) ">") 'ok))