commit 4c74b68fb1f23db6ba770f7322efe378f3492751 (HEAD, refs/remotes/origin/master) Author: Stefan Monnier Date: Mon Sep 8 12:39:48 2025 -0400 (cl--make-usage-args): Try and fix bug#79353 * lisp/emacs-lisp/cl-macs.el (cl--make-usage-args): Don't depend on `cl-extra` when `take` does the job. diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 08a6cbf209d..63d85623fbe 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -517,7 +517,7 @@ its argument list allows full Common Lisp conventions." (when aux ;; `&aux' args aren't arguments, so let's just drop them from the ;; usage info. - (setq arglist (cl-subseq arglist 0 aux)))) + (setq arglist (take aux arglist)))) (if (not (proper-list-p arglist)) (let* ((last (last arglist)) (tail (cdr last))) commit 6b6cfa8e40bbfe97ac1cd50a90d26325829f2aa7 Author: Eshel Yaron Date: Mon Sep 8 17:30:52 2025 +0200 ; * lisp/progmodes/project.el: Restore backward compatibility. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 887e9a7bb28..c15148110a6 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1718,8 +1718,9 @@ Return non-nil if PROJECT is not a remote project." (t (complete-with-action action buffers string pred))))) -(define-completion-category 'project-buffer '(buffer) - "Completion category for buffers in a given project.") +(when (fboundp 'define-completion-category) ; Introduced in Emacs 31. + (define-completion-category 'project-buffer '(buffer) + "Completion category for buffers in a given project.")) (defun project--read-project-buffer () (let* ((pr (project-current t)) commit 15939846a00969ed815e3ca7bd31f1ef1dc7355f Author: Sean Whitton Date: Mon Sep 8 11:50:36 2025 +0100 Make C-x v w w work in Log View mode, to change working directory * lisp/vc/diff-mode.el (diff-find-matching-buffer): Rename ... * lisp/progmodes/project.el (project-change-to-matching-directory): ... to here. All uses changed. * lisp/vc/log-view.el (project-change-to-matching-directory): Declare. (log-view-mode): Use it. * doc/emacs/vc1-xtra.texi (Other Working Trees): Document the change. diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi index 3a8c939dc1b..b5a0f0c129b 100644 --- a/doc/emacs/vc1-xtra.texi +++ b/doc/emacs/vc1-xtra.texi @@ -477,15 +477,16 @@ command lets you switch to those versions of the file. @c buffer as the example here, because 'C-x v =' and 'C-x v D' are more @c likely to be uncommitted changes on which you'd use 'C-x v w a'. @c That requires a new node for bindings available in *vc-change-log*s. -@kbd{C-x v w w} also works in Diff mode (@pxref{Diff Mode}). Instead of -switching to a different buffer, the command changes the default -directory of the Diff mode buffer to the corresponding directory under -another working tree. This is useful with Diff mode buffers generated -by VC commands, such as @kbd{C-x v =} and @kbd{C-x v D} (@pxref{Old -Revisions}). You can use @kbd{C-x v w w} and then standard Diff mode -commands like @w{@kbd{C-c C-a}} (@code{diff-apply-hunk}) and @kbd{C-c -RET C-a} (@code{diff-apply-buffer}) to apply hunks from one working tree -to another. +@kbd{C-x v w w} also works in Diff mode (@pxref{Diff Mode}) and Log View +mode (@pxref{Old Revisions}). Instead of switching to a different +buffer, the command changes the default directory of the buffer to the +corresponding directory under another working tree. This is +particularly useful with Diff mode buffers generated by VC commands, +such as @kbd{C-x v =} and @kbd{C-x v D} (@pxref{Old Revisions}). You +can use @kbd{C-x v w w} and then standard Diff mode commands like +@w{@kbd{C-c C-a}} (@code{diff-apply-hunk}) and @kbd{C-c RET C-a} +(@code{diff-apply-buffer}) to apply hunks from one working tree to +another. @kindex C-x v w s @findex vc-working-tree-switch-project diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 438b8528960..887e9a7bb28 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1398,6 +1398,28 @@ This function is intended to be used as the value of (file-name-as-directory mirror-name) mirror-name)))))) +;; Used by `diff-mode' and `log-view-mode'. +;; If the matching directory does not exist it's an error so that we +;; avoid invalidating the relative file names in Diff mode file headers. +(defun project-change-to-matching-directory (current-project mirror-project) + "Change default directory to matching one under another project. +CURRENT-PROJECT is the project instance for the current project. +MIRROR-PROJECT is the project instance for the project to visit. +A matching directory has the same name relative to the project root. +If a matching directory does not exist in the other project, it is an +error. + +This function is intended to be used as the value of +`project-find-matching-buffer-function'." + (let* ((mirror-root (project-root mirror-project)) + (relative-name (file-relative-name default-directory + (project-root current-project))) + (mirror-name (expand-file-name relative-name mirror-root))) + (if (file-directory-p mirror-name) + (message "Default directory changed to `%s'" + (setq default-directory mirror-name)) + (user-error "`%s' not found in `%s'" relative-name mirror-root)))) + (defun project--completing-read-strict (prompt collection &optional predicate hist mb-default diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index c33263f5f4a..c58ad67ff52 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -1618,6 +1618,8 @@ else cover the whole buffer." (defvar whitespace-style) (defvar whitespace-trailing-regexp) +(declare-function project-change-to-matching-directory "project") + ;; Prevent applying `view-read-only' to diff-mode buffers (bug#75993). ;; We don't derive from `special-mode' because that would inhibit the ;; `self-insert-command' binding of normal keys. @@ -1642,7 +1644,8 @@ In read-only buffers the following bindings are also available: (add-hook 'font-lock-mode-hook #'diff--font-lock-cleanup nil 'local) (setq-local imenu-generic-expression diff-imenu-generic-expression) - (setq-local project-find-matching-buffer-function #'diff-find-matching-buffer) + (setq-local project-find-matching-buffer-function + #'project-change-to-matching-directory) ;; These are not perfect. They would be better done separately for ;; context diffs and unidiffs. ;; (setq-local paragraph-start @@ -3359,28 +3362,6 @@ hunk text is not found in the source file." ) str) -(declare-function project-root "project") - -(defun diff-find-matching-buffer (current-project mirror-project) - "Change default directory to matching one under another project. -CURRENT-PROJECT is the project instance for the current project. -MIRROR-PROJECT is the project instance for the project to visit. -A matching directory has the same name relative to the project root. -If a matching directory does not exist in the other project, it is an -error (this avoids invalidating the relative file names in Diff mode -file headers). - -This function is intended to be used as the value of -`project-find-matching-buffer-function' in Diff mode buffers." - (let* ((mirror-root (project-root mirror-project)) - (relative-name (file-relative-name default-directory - (project-root current-project))) - (mirror-name (expand-file-name relative-name mirror-root))) - (if (file-directory-p mirror-name) - (message "Default directory changed to `%s'" - (setq default-directory mirror-name)) - (user-error "`%s' not found in `%s'" relative-name mirror-root)))) - ;;; Support for converting a diff to diff3 markers via `wiggle'. ;; Wiggle can be found at https://neil.brown.name/wiggle/ or in your nearest diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el index 1cb8b935ab5..3d04676b419 100644 --- a/lisp/vc/log-view.el +++ b/lisp/vc/log-view.el @@ -250,6 +250,8 @@ The match group number 1 should match the revision number itself.") ;;;; Actual code ;;;; +(declare-function project-change-to-matching-directory "project") + ;;;###autoload (define-derived-mode log-view-mode special-mode "Log-View" "Major mode for browsing CVS log output." @@ -258,6 +260,8 @@ The match group number 1 should match the revision number itself.") (setq-local beginning-of-defun-function #'log-view-beginning-of-defun) (setq-local end-of-defun-function #'log-view-end-of-defun) (setq-local cvs-minor-wrap-function #'log-view-minor-wrap) + (setq-local project-find-matching-buffer-function + #'project-change-to-matching-directory) (hack-dir-local-variables-non-file-buffer)) ;;;; commit 0e6c4461d896ed0c0adc74bf2c3763f3598140fa Author: Sean Whitton Date: Mon Sep 8 10:45:59 2025 +0100 vc-next-action: Fix a cache invalidation problem * lisp/vc/vc.el (vc-next-action): Use vc-registered, not vc-backend, to see which files are already registered. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 0d55e9fbb50..68a3edddd54 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1648,7 +1648,18 @@ from which to check out the file(s)." ;; In the case there actually are any unregistered files then ;; `vc-deduce-backend', via `vc-only-files-state-and-model', ;; has already prompted the user to approve registering them. - (let ((register (cl-remove-if #'vc-backend fileset-only-files))) + ;; + ;; FIXME: We should be able to use `vc-backend' instead of + ;; `vc-registered' here given that `vc-deduce-backend' just + ;; determined a state for all of the files. However, there + ;; are case(s) where the cached information is out-of-date. + ;; For example, if we used C-x v v on a directory in *vc-dir* + ;; and thereby newly registered files within that directory, + ;; only that directory's name will have been passed to + ;; `vc-register', and so `vc-backend' will still consider them + ;; unregistered, even though `vc-dir-deduce-fileset' will + ;; return `added' for their states. + (let ((register (cl-remove-if #'vc-registered fileset-only-files))) (if (not verbose) (vc-checkin ready-for-commit backend nil nil nil nil register) (let* ((revision (read-string "New revision or backend: "))