commit d714aa753b744c903d149a1f6c69262d958c313e (HEAD, refs/remotes/origin/master) Author: Basil L. Contovounesios Date: Thu May 21 12:23:19 2020 +0100 ; Bump defcustom :version in last change * lisp/ido.el (ido-cannot-complete-command): Bump defcustom :version after default value was changed. diff --git a/lisp/ido.el b/lisp/ido.el index 15144f131b..5716c6ff44 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -499,13 +499,14 @@ This means that \\[ido-complete] must always be followed by \\[ido-exit-minibuff even when there is only one unique completion." :type 'boolean) -(defcustom ido-cannot-complete-command 'ido-completion-auto-help +(defcustom ido-cannot-complete-command #'ido-completion-auto-help "Command run when `ido-complete' can't complete any more. The most useful values are `ido-completion-help', which pops up a window with completion alternatives; `ido-completion-auto-help', which does the same but respects the value of -`completion-auto-help'; or `ido-next-match' or `ido-prev-match', +`completion-auto-help'; and `ido-next-match' or `ido-prev-match', which cycle the buffer list." + :version "28.1" :type 'function) commit cdec3139b9125d2360223fcd1fb0fe1a52595cb7 Author: Ryan C. Thompson Date: Thu May 21 02:21:12 2020 +0300 lisp/ido.el: Respect completion-auto-help setting This commit makes ido completion respect the user's setting for `completion-auto-help' by default. It does this by defining a wrapper function `ido-completion-auto-help', which calls `ido-completion-help' only when `completion-auto-help' is non-nil. * lisp/ido.el (ido-completion-auto-help): New function. (ido-cannot-complete-command): Use it as the new default (bug#41340). diff --git a/lisp/ido.el b/lisp/ido.el index 81883402ad..15144f131b 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -499,11 +499,13 @@ This means that \\[ido-complete] must always be followed by \\[ido-exit-minibuff even when there is only one unique completion." :type 'boolean) -(defcustom ido-cannot-complete-command 'ido-completion-help +(defcustom ido-cannot-complete-command 'ido-completion-auto-help "Command run when `ido-complete' can't complete any more. The most useful values are `ido-completion-help', which pops up a -window with completion alternatives, or `ido-next-match' or -`ido-prev-match', which cycle the buffer list." +window with completion alternatives; `ido-completion-auto-help', +which does the same but respects the value of +`completion-auto-help'; or `ido-next-match' or `ido-prev-match', +which cycle the buffer list." :type 'function) @@ -3926,6 +3928,14 @@ If `ido-change-word-sub' cannot be found in WORD, return nil." (when (bobp) (next-completion 1))))) +(defun ido-completion-auto-help () + "Call `ido-completion-help' if `completion-auto-help' is non-nil." + (interactive) + ;; Note: `completion-auto-help' could also be `lazy', but this value + ;; is irrelevant to ido, which is fundamentally eager, so it is + ;; treated the same as t. + (when completion-auto-help + (ido-completion-help))) (defun ido-completion-help () "Show possible completions in the `ido-completion-buffer'." commit 0bfee4b18be9455e33899178fe4ccf2743ea179b Author: Matthias Meulien Date: Thu May 21 01:37:30 2020 +0300 Bookmark locations can refer to VC directory buffers (bug#39722) * etc/NEWS: Document feature. * lisp/vc/vc-dir.el (vc-dir-mode): Set local bookmark-make-record-function. (bookmark-make-record-default, bookmark-prop-get, bookmark-default-handler) (bookmark-get-bookmark-record): Declarations. (vc-dir-bookmark-make-record): Make record used to bookmark a `vc-dir' buffer. (vc-dir-bookmark-jump): Provides bookmark-jump behavior for a `vc-dir' buffer. diff --git a/etc/NEWS b/etc/NEWS index 2cbb7adb0b..1bf1403cab 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -139,6 +139,9 @@ directories with the help of new command 'dired-vc-next-action'. *** New commands 'vc-dir-mark-registered-files' (bound to '* r') and 'vc-dir-mark-unregistered-files'. +*** Support for bookmark.el. +Bookmark locations can refer to VC directory buffers. + ** Gnus --- diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 0c9e656add..a86c37c24a 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -1106,6 +1106,7 @@ the *vc-dir* buffer. (set (make-local-variable 'vc-dir-backend) use-vc-backend) (set (make-local-variable 'desktop-save-buffer) 'vc-dir-desktop-buffer-misc-data) + (setq-local bookmark-make-record-function #'vc-dir-bookmark-make-record) (setq buffer-read-only t) (when (boundp 'tool-bar-map) (set (make-local-variable 'tool-bar-map) vc-dir-tool-bar-map)) @@ -1465,6 +1466,41 @@ These are the commands available for use in the file status buffer: (add-to-list 'desktop-buffer-mode-handlers '(vc-dir-mode . vc-dir-restore-desktop-buffer)) + +;;; Support for bookmark.el (adapted from what info.el does). + +(declare-function bookmark-make-record-default + "bookmark" (&optional no-file no-context posn)) +(declare-function bookmark-prop-get "bookmark" (bookmark prop)) +(declare-function bookmark-default-handler "bookmark" (bmk)) +(declare-function bookmark-get-bookmark-record "bookmark" (bmk)) + +(defun vc-dir-bookmark-make-record () + "Make record used to bookmark a `vc-dir' buffer. +This implements the `bookmark-make-record-function' type for +`vc-dir' buffers." + (let* ((bookmark-name + (concat "(" (symbol-name vc-dir-backend) ") " + (file-name-nondirectory + (directory-file-name default-directory)))) + (defaults (list bookmark-name default-directory))) + `(,bookmark-name + ,@(bookmark-make-record-default 'no-file) + (filename . ,default-directory) + (handler . vc-dir-bookmark-jump) + (defaults . ,defaults)))) + +;;;###autoload +(defun vc-dir-bookmark-jump (bmk) + "Provides the bookmark-jump behavior for a `vc-dir' buffer. +This implements the `handler' function interface for the record +type returned by `vc-dir-bookmark-make-record'." + (let* ((file (bookmark-prop-get bmk 'filename)) + (buf (save-window-excursion + (vc-dir file) (current-buffer)))) + (bookmark-default-handler + `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bmk))))) + (provide 'vc-dir) commit 5989432d15feb4439e759d2c0e28233ca22a7604 Author: Alan Mackenzie Date: Wed May 20 19:02:26 2020 +0000 CC Mode: Fix bug #39972, by fixing c-display-defun-name for nested defuns * lisp/progmodes/cc-mode.el (c-common-init): Build add-log-current-defun-function out of c-defun-name-and-limits instead of the former c-defun-name. diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index d822788bee..b3b2374805 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -795,7 +795,7 @@ compatible with old code; callers should always specify it." (set (make-local-variable 'outline-level) 'c-outline-level) (set (make-local-variable 'add-log-current-defun-function) (lambda () - (or (c-cpp-define-name) (c-defun-name)))) + (or (c-cpp-define-name) (car (c-defun-name-and-limits nil))))) (let ((rfn (assq mode c-require-final-newline))) (when rfn (if (boundp 'mode-require-final-newline) commit 5b66483eadebbd3b1c37a46d2d987637b2872a8e Author: Eric Abrahamsen Date: Wed Apr 29 18:10:35 2020 -0700 Prevent gnus-registry-handle-action from creating spurious entries Thanks to Bob Newell for finding this. * lisp/gnus/gnus-registry.el (gnus-registry-handle-action): If a message entry ends up with no groups in its 'group key, that means the entry should be deleted. diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index 480ed80ef8..f306889a7f 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el @@ -485,23 +485,25 @@ This is not required after changing `gnus-registry-cache-file'." (when from (setq entry (cons (delete from (assoc 'group entry)) (assq-delete-all 'group entry)))) - - (dolist (kv `((group ,to) - (sender ,sender) - (recipient ,@recipients) - (subject ,subject))) - (when (cadr kv) - (let ((new (or (assq (car kv) entry) - (list (car kv))))) - (dolist (toadd (cdr kv)) - (unless (member toadd new) - (setq new (append new (list toadd))))) - (setq entry (cons new - (assq-delete-all (car kv) entry)))))) - (gnus-message 10 "Gnus registry: new entry for %s is %S" - id - entry) - (gnus-registry-insert db id entry))) + ;; Only keep the entry if the message is going to a new group, or + ;; it's still in some previous group. + (when (or to (alist-get 'group entry)) + (dolist (kv `((group ,to) + (sender ,sender) + (recipient ,@recipients) + (subject ,subject))) + (when (cadr kv) + (let ((new (or (assq (car kv) entry) + (list (car kv))))) + (dolist (toadd (cdr kv)) + (unless (member toadd new) + (setq new (append new (list toadd))))) + (setq entry (cons new + (assq-delete-all (car kv) entry)))))) + (gnus-message 10 "Gnus registry: new entry for %s is %S" + id + entry) + (gnus-registry-insert db id entry)))) ;; Function for nn{mail|imap}-split-fancy: look up all references in ;; the cache and if a match is found, return that group. commit bd64571ef213a4279f897b7446e97ccd76fe4516 Author: Alan Mackenzie Date: Wed May 20 18:02:13 2020 +0000 which-function-mode: put hook function on after-change-major-mode-hook , rather than find-file-hook. This keeps which-function-mode active should the major mode be reinitialized. Also accept a null result from add-log-current-defun as definitive, should that function have run. This fixes bug #40714. * lisp/progmodes/which-func.el (which-func-ff-hook): Put on after-change-major-mode-hook. (which-function): Enhance the logic to accept a null result from add-log-current-defun. diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el index 1cee552b0c..266f40abba 100644 --- a/lisp/progmodes/which-func.el +++ b/lisp/progmodes/which-func.el @@ -186,7 +186,7 @@ and you want to simplify them for the mode line "Non-nil means display current function name in mode line. This makes a difference only if `which-function-mode' is non-nil.") -(add-hook 'find-file-hook 'which-func-ff-hook t) +(add-hook 'after-change-major-mode-hook 'which-func-ff-hook t) (defun which-func-try-to-enable () (unless (or (not which-function-mode) @@ -195,7 +195,7 @@ This makes a difference only if `which-function-mode' is non-nil.") (member major-mode which-func-modes))))) (defun which-func-ff-hook () - "File find hook for Which Function mode. + "`after-change-major-mode-hook' for Which Function mode. It creates the Imenu index for the buffer, if necessary." (which-func-try-to-enable) @@ -282,52 +282,55 @@ If no function name is found, return nil." (when (null name) (setq name (add-log-current-defun))) ;; If Imenu is loaded, try to make an index alist with it. + ;; If `add-log-current-defun' ran and gave nil, accept that. (when (and (null name) - (boundp 'imenu--index-alist) - (or (null imenu--index-alist) - ;; Update if outdated - (/= (buffer-chars-modified-tick) imenu-menubar-modified-tick)) - (null which-function-imenu-failed)) - (ignore-errors (imenu--make-index-alist t)) - (unless imenu--index-alist - (set (make-local-variable 'which-function-imenu-failed) t))) - ;; If we have an index alist, use it. - (when (and (null name) - (boundp 'imenu--index-alist) imenu--index-alist) - (let ((alist imenu--index-alist) - (minoffset (point-max)) - offset pair mark imstack namestack) - ;; Elements of alist are either ("name" . marker), or - ;; ("submenu" ("name" . marker) ... ). The list can be - ;; arbitrarily nested. - (while (or alist imstack) - (if (null alist) - (setq alist (car imstack) - namestack (cdr namestack) - imstack (cdr imstack)) - - (setq pair (car-safe alist) - alist (cdr-safe alist)) - - (cond - ((atom pair)) ; Skip anything not a cons. - - ((imenu--subalist-p pair) - (setq imstack (cons alist imstack) - namestack (cons (car pair) namestack) - alist (cdr pair))) - - ((or (number-or-marker-p (setq mark (cdr pair))) - (and (overlayp mark) - (setq mark (overlay-start mark)))) - (when (and (>= (setq offset (- (point) mark)) 0) - (< offset minoffset)) ; Find the closest item. - (setq minoffset offset - name (if (null which-func-imenu-joiner-function) - (car pair) - (funcall - which-func-imenu-joiner-function - (reverse (cons (car pair) namestack)))))))))))) + (null add-log-current-defun-function)) + (when (and (null name) + (boundp 'imenu--index-alist) + (or (null imenu--index-alist) + ;; Update if outdated + (/= (buffer-chars-modified-tick) imenu-menubar-modified-tick)) + (null which-function-imenu-failed)) + (ignore-errors (imenu--make-index-alist t)) + (unless imenu--index-alist + (set (make-local-variable 'which-function-imenu-failed) t))) + ;; If we have an index alist, use it. + (when (and (null name) + (boundp 'imenu--index-alist) imenu--index-alist) + (let ((alist imenu--index-alist) + (minoffset (point-max)) + offset pair mark imstack namestack) + ;; Elements of alist are either ("name" . marker), or + ;; ("submenu" ("name" . marker) ... ). The list can be + ;; arbitrarily nested. + (while (or alist imstack) + (if (null alist) + (setq alist (car imstack) + namestack (cdr namestack) + imstack (cdr imstack)) + + (setq pair (car-safe alist) + alist (cdr-safe alist)) + + (cond + ((atom pair)) ; Skip anything not a cons. + + ((imenu--subalist-p pair) + (setq imstack (cons alist imstack) + namestack (cons (car pair) namestack) + alist (cdr pair))) + + ((or (number-or-marker-p (setq mark (cdr pair))) + (and (overlayp mark) + (setq mark (overlay-start mark)))) + (when (and (>= (setq offset (- (point) mark)) 0) + (< offset minoffset)) ; Find the closest item. + (setq minoffset offset + name (if (null which-func-imenu-joiner-function) + (car pair) + (funcall + which-func-imenu-joiner-function + (reverse (cons (car pair) namestack))))))))))))) ;; Filter the name if requested. (when name (if which-func-cleanup-function commit 525df72753acdd0221771a2a298842868f49f4b4 Author: Michael Albinus Date: Wed May 20 18:01:06 2020 +0200 ; Fix comment in tramp-archive.el diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index 63c0769e30..24ee6fa51f 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el @@ -109,7 +109,7 @@ (eval-when-compile (require 'cl-lib)) ;; Sometimes, compilation fails with "Variable binding depth exceeds -;; max-specpdl-size". +;; max-specpdl-size". Shall be fixed in Emacs 27. (eval-and-compile (let ((max-specpdl-size (* 2 max-specpdl-size))) (require 'tramp-gvfs))) @@ -320,7 +320,7 @@ arguments to pass to the OPERATION." operation args)) (archive (tramp-archive-file-name-archive filename)) ;; Sometimes, it fails with "Variable binding depth exceeds - ;; max-specpdl-size". + ;; max-specpdl-size". Shall be fixed in Emacs 27. (max-specpdl-size (* 2 max-specpdl-size))) ;; `filename' could be a quoted file name. Or the file commit 6b3fb29ede140c79a4146fb2056306632e3bd511 Author: Andrea Corallo Date: Tue May 19 22:33:38 2020 +0100 ; src/alloc.c: Add a GC reg spill mechanism and Bug#41357 related commentary. diff --git a/src/alloc.c b/src/alloc.c index b7ebaa63a5..d5a6d9167e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4998,8 +4998,9 @@ mark_stack (char const *bottom, char const *end) #endif } -/* This is a trampoline function that flushes registers to the stack, - and then calls FUNC. ARG is passed through to FUNC verbatim. +/* flush_stack_call_func is the trampoline function that flushes + registers to the stack, and then calls FUNC. ARG is passed through + to FUNC verbatim. This function must be called whenever Emacs is about to release the global interpreter lock. This lets the garbage collector easily @@ -5007,7 +5008,20 @@ mark_stack (char const *bottom, char const *end) Lisp. It is invalid to run any Lisp code or to allocate any GC memory - from FUNC. */ + from FUNC. + + Note: all register spilling is done in flush_stack_call_func before + flush_stack_call_func1 is activated. + + flush_stack_call_func1 is responsible for identifying the stack + address range to be scanned. It *must* be carefully kept as + noinline to make sure that registers has been spilled before it is + called, otherwise given __builtin_frame_address (0) typically + returns the frame pointer (base pointer) and not the stack pointer + [1] GC will miss to scan callee-saved registers content + (Bug#41357). + + [1] . */ NO_INLINE void flush_stack_call_func1 (void (*func) (void *arg), void *arg) commit 453ffe5d535438fba3d189cf26c47f25491d15fb Author: Michael Albinus Date: Wed May 20 11:09:44 2020 +0200 Fix minor Tramp oddities * lisp/net/tramp-archive.el (tramp-archive-file-name-handler): Increase `max-specpdl-size' temporarily. * lisp/net/tramp-rclone.el (tramp-rclone-flush-directory-cache): Fix a problem with older Emacsen. diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index 95cbfb8c22..63c0769e30 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el @@ -318,7 +318,10 @@ arguments to pass to the OPERATION." (let* ((filename (apply #'tramp-archive-file-name-for-operation operation args)) - (archive (tramp-archive-file-name-archive filename))) + (archive (tramp-archive-file-name-archive filename)) + ;; Sometimes, it fails with "Variable binding depth exceeds + ;; max-specpdl-size". + (max-specpdl-size (* 2 max-specpdl-size))) ;; `filename' could be a quoted file name. Or the file ;; archive could be a directory, see Bug#30293. diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index 445098a5bc..08bba33afe 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el @@ -477,7 +477,18 @@ file names." (with-tramp-connection-property (tramp-get-connection-process vec) "rclone-pid" (catch 'pid - (dolist (pid (list-system-processes)) ;; "pidof rclone" ? + (dolist + (pid + ;; Until Emacs 25, `process-attributes' could + ;; crash Emacs for some processes. So we use + ;; "pidof", which might not work everywhere. + (if (<= emacs-major-version 25) + (let ((default-directory temporary-file-directory)) + (mapcar + #'string-to-number + (split-string + (shell-command-to-string "pidof rclone")))) + (list-system-processes))) (and (string-match-p (regexp-quote (format "rclone mount %s:" (tramp-file-name-host vec)))