commit c7aab69e30ffb8cd91df488d0cafe22bb7774877 Author: Sean Whitton Date: Mon Jul 6 16:50:00 2026 +0100 Delete dir-mode VC backend method This overlapped with the existing support for a backend-specific minor mode. * lisp/vc/vc.el (dir-mode): Delete specification. (vc-dir-mode): De-declare. (vc-default-dir-mode): Delete. * etc/NEWS: Update. diff --git a/etc/NEWS b/etc/NEWS index 0a5bf6d8af6..6c743afbe2f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -129,11 +129,8 @@ obsolete. *** VC-Dir now shows key binding hints. To hide these, you can customize the new user option 'vc-dir-show-key-binding-hints' to nil. - ---- -*** Backends can supply a derived mode for VC-Dir buffers. -Backend authors can use the new backend methods 'dir-mode' and -'dir-extra-hints'. +Backends can supply additional hints using the new 'dir-extra-hints' +backend method. --- *** VC-Dir doesn't process very large status output by default. diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index bbc87bb0a19..33e3e5dced2 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -208,12 +208,6 @@ ;; Return a string of additional key bindings hints for the *vc-dir* ;; buffer header, or nil. ;; -;; - dir-mode () -;; -;; Mode to use for the *vc-dir* buffer. This defaults to -;; `vc-dir-mode' and is expected to be changed (if at all) to a -;; derived mode of `vc-dir-mode'. -;; ;; - dir-printer (fileinfo) ;; ;; Pretty print the `vc-dir-fileinfo' FILEINFO. @@ -5643,10 +5637,6 @@ to provide the `find-revision' operation instead." (funcall update-function (mapcar (lambda (file) (list file 'up-to-date)) files))) -(declare-function vc-dir-mode "vc-dir") - -(defun vc-default-dir-mode (_backend) (vc-dir-mode)) - (defalias 'vc-default-dir-extra-hints #'ignore) (defun vc-check-headers () commit 83b6d619fe1928d23a762cc6d7293b65dbe4a3a8 Author: Sean Whitton Date: Mon Jul 6 15:46:30 2026 +0100 VC-Dir: New button to toggle key binding hints * lisp/vc/vc-dir.el (vc-dir--key-binding-hints): New variable. (vc-dir-headers): Set it and use it. Insert a toggle button. (vc-dir-toggle-hints): New command. (vc-dir-mode-map): Bind it. diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 5c4727b43bd..048670b357d 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -431,6 +431,7 @@ an \\+`up-to-date' or \\+`ignored' file." (define-key map "E=" #'vc-diff-outgoing-and-edited) (define-key map "ED" #'vc-root-diff-outgoing-and-edited) (define-key map "V" #'vc-dir-root-next-action) + (define-key map "?" #'vc-dir-toggle-hints) (let ((branch-map (make-sparse-keymap))) (define-key map "b" branch-map) @@ -1595,6 +1596,29 @@ elements to this list.") :group 'vc :version "32.1") +(defvar-local vc-dir--key-binding-hints "" + "Key binding hints for this VC-Dir buffer.") + +(defun vc-dir-toggle-hints (&rest _ignore) + "Toggle display of the key bindings hints in current VC-Dir buffer. +The toggle is preserved across refreshes of this VC-Dir buffer." + (interactive) + (if (and (local-variable-p 'vc-dir-show-key-binding-hints) + (not (eq vc-dir-show-key-binding-hints + (default-value 'vc-dir-show-key-binding-hints)))) + (kill-local-variable 'vc-dir-show-key-binding-hints) + (setq-local vc-dir-show-key-binding-hints + (not vc-dir-show-key-binding-hints))) + ;; Preserve point across the toggle. We don't currently try to + ;; preserve point across the operation of customizing the value of + ;; `vc-dir-show-key-binding-hints'. + (let ((opoint (point))) + (vc-dir--set-header default-directory) + (let ((hints-length (length vc-dir--key-binding-hints))) + (goto-char (if vc-dir-show-key-binding-hints + (+ opoint hints-length) + (- opoint hints-length)))))) + (defun vc-dir-headers (backend dir) "Display the headers in the *VC-Dir* buffer. It calls the `dir-extra-hints' backend method to display @@ -1602,36 +1626,51 @@ backend-specific key binding hints. It calls the `dir-extra-headers' backend method to display backend-specific headers." (kill-local-variable 'vc-dir-async-header-values) + (setq-local + vc-dir--key-binding-hints + (substitute-command-keys + (concat + (propertize "Act " 'font-lock-face 'vc-dir-key-binding-hint-label) + " " + "(\\[vc-revert]) Revert, " + "(\\[vc-dir-delete-file]) Delete, " + "(\\[vc-dir-ignore]) Ignore, " + "(\\[vc-next-action]/\\[vc-dir-root-next-action]) Commit/commit all, " + "(\\[vc-push]) Push" + "\n" + (propertize "Marks" 'font-lock-face 'vc-dir-key-binding-hint-label) + " " + "(\\[vc-dir-mark]) Mark, " + "(\\[vc-dir-unmark]) Unmark, " + "(\\[vc-dir-unmark-all-files]) Unmark same state/dir, " + "(\\[universal-argument] \\[vc-dir-unmark-all-files]) Unmark all" + "\n" + (propertize "View " 'font-lock-face 'vc-dir-key-binding-hint-label) + " " + "(\\[vc-diff]) Diff, " + "(\\[revert-buffer]) Refresh, " + "(\\[vc-dir-hide-up-to-date]) Hide up-to-date" + "\n" + (vc-call-backend backend 'dir-extra-hints) + "\n"))) (concat - (and - vc-dir-show-key-binding-hints - (substitute-command-keys - (concat - (propertize "Act " 'font-lock-face 'vc-dir-key-binding-hint-label) - " " - "(\\[vc-revert]) Revert, " - "(\\[vc-dir-delete-file]) Delete, " - "(\\[vc-dir-ignore]) Ignore, " - "(\\[vc-next-action]/\\[vc-dir-root-next-action]) Commit/commit all, " - "(\\[vc-push]) Push" - "\n" - (propertize "Marks" 'font-lock-face 'vc-dir-key-binding-hint-label) - " " - "(\\[vc-dir-mark]) Mark, " - "(\\[vc-dir-unmark]) Unmark, " - "(\\[vc-dir-unmark-all-files]) Unmark same state/dir, " - "(\\[universal-argument] \\[vc-dir-unmark-all-files]) Unmark all" - "\n" - (propertize "View " 'font-lock-face 'vc-dir-key-binding-hint-label) - " " - "(\\[vc-diff]) Diff, " - "(\\[revert-buffer]) Refresh, " - "(\\[vc-dir-hide-up-to-date]) Hide up-to-date" - "\n" - (vc-call-backend backend 'dir-extra-hints) - "\n"))) + (and vc-dir-show-key-binding-hints vc-dir--key-binding-hints) (propertize "VC backend : " 'face 'vc-dir-header) - (propertize (format "%s\n" backend) 'face 'vc-dir-header-value) + (propertize (format "%s" backend) 'face 'vc-dir-header-value) + (let ((label (substitute-command-keys "\ +[toggle hints (\\[vc-dir-toggle-hints])]"))) + (concat + (propertize " " 'display + `(space + :align-to + ,(- (length (car (string-split vc-dir--key-binding-hints + "\n"))) + (length label)))) + (with-temp-buffer + (insert-text-button label 'action #'vc-dir-toggle-hints + 'help-echo "Toggle display of key binding hints") + (buffer-string)))) + "\n" (propertize "Working dir: " 'face 'vc-dir-header) (propertize (format "%s\n" (abbreviate-file-name dir)) 'face 'vc-dir-header-value) commit 02fb63f7fe9aca2974d47095e5281919d173967a Author: Sean Whitton Date: Mon Jul 6 15:16:28 2026 +0100 VC-Dir: Let backends supply a custom mode and key binding hints * lisp/vc/vc.el (dir-extra-hints, dir-mode): Specify new backend methods. (vc-dir-mode): Declare. (vc-default-dir-mode, vc-default-dir-extra-hints): New functions. * lisp/vc/vc-dir.el (vc-dir-headers, vc-dir): Call the new backend methods. * lisp/cedet/ede.el (ede-turn-on-hook): Use derived-mode-p instead of looking at major-mode directly. * etc/NEWS: Document the new backend methods. diff --git a/etc/NEWS b/etc/NEWS index 80bb25183bd..0a5bf6d8af6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -119,15 +119,6 @@ are now buttonized, allowing using mouse or 'RET' to follow them. ** VC -+++ -*** Improved creation of commit log entry from ChangeLog. -When VC detects that all log entries for the current changeset come from -the same ChangeLog file or buffer, it now inserts the entire body of the -ChangeLog entry into the *vc-log* buffer. If the ChangeLog entry -contains a summary line, VC inserts it into the *vc-log* Summary header. -If VC detects that the set of changed files listed in the ChangeLog -entry differs from the current VC fileset, it displays a warning. - +++ *** VC-Dir outgoing revisions count is now asynchronous. This means it won't get in your way even if it's slow for your @@ -139,6 +130,11 @@ obsolete. To hide these, you can customize the new user option 'vc-dir-show-key-binding-hints' to nil. +--- +*** Backends can supply a derived mode for VC-Dir buffers. +Backend authors can use the new backend methods 'dir-mode' and +'dir-extra-hints'. + --- *** VC-Dir doesn't process very large status output by default. If the VCS status process used to populate the VC-Dir buffer produces a @@ -150,6 +146,15 @@ message saying so, with a button to override it. You can customize the new user option 'vc-dir-process-output-limit' to control how early to stop, and to disable this feature. ++++ +*** Improved creation of commit log entry from ChangeLog. +When VC detects that all log entries for the current changeset come from +the same ChangeLog file or buffer, it now inserts the entire body of the +ChangeLog entry into the *vc-log* buffer. If the ChangeLog entry +contains a summary line, VC inserts it into the *vc-log* Summary header. +If VC detects that the set of changed files listed in the ChangeLog +entry differs from the current VC fileset, it displays a warning. + ** Outline mode *** New command 'outline-show-entry-and-parents'. diff --git a/lisp/cedet/ede.el b/lisp/cedet/ede.el index 36864e6f3e9..478d8911c1f 100644 --- a/lisp/cedet/ede.el +++ b/lisp/cedet/ede.el @@ -469,7 +469,7 @@ To be used in hook functions." ;; Emacs 21 has no buffer file name for directory edits. ;; so we need to add these hacks in. (eq major-mode 'dired-mode) - (eq major-mode 'vc-dir-mode)) + (derived-mode-p 'vc-dir-mode)) (ede-minor-mode 1))) (define-minor-mode ede-minor-mode diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 0425f89256f..5c4727b43bd 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -1597,8 +1597,10 @@ elements to this list.") (defun vc-dir-headers (backend dir) "Display the headers in the *VC-Dir* buffer. -It calls the `dir-extra-headers' backend method to display backend -specific headers." +It calls the `dir-extra-hints' backend method to display +backend-specific key binding hints. +It calls the `dir-extra-headers' backend method to display +backend-specific headers." (kill-local-variable 'vc-dir-async-header-values) (concat (and @@ -1625,7 +1627,9 @@ specific headers." "(\\[vc-diff]) Diff, " "(\\[revert-buffer]) Refresh, " "(\\[vc-dir-hide-up-to-date]) Hide up-to-date" - "\n\n"))) + "\n" + (vc-call-backend backend 'dir-extra-hints) + "\n"))) (propertize "VC backend : " 'face 'vc-dir-header) (propertize (format "%s\n" backend) 'face 'vc-dir-header-value) (propertize "Working dir: " 'face 'vc-dir-header) @@ -1968,7 +1972,7 @@ These are the commands available for use in the file status buffer: (vc-dir-refresh) ;; FIXME: find a better way to pass the backend to `vc-dir-mode'. (let ((use-vc-backend backend)) - (vc-dir-mode) + (vc-call-backend backend 'dir-mode) ;; Activate the backend-specific minor mode, if any. (when-let* ((minor-mode (intern-soft (format "vc-dir-%s-mode" diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index ef957b7010a..bbc87bb0a19 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -190,7 +190,7 @@ ;; ;; To provide more backend specific functionality for `vc-dir' ;; the following functions might be needed: `dir-extra-headers', -;; `dir-printer', and `extra-dir-menu'. +;; `dir-extra-hints', `dir-mode', `dir-printer', and `extra-dir-menu'. ;; ;; NOTE: project.el includes a similar method `project-list-files' ;; that has a slightly different return value and performance @@ -203,6 +203,17 @@ ;; ;; Return a string that will be added to the *vc-dir* buffer header. ;; +;; - dir-extra-hints () +;; +;; Return a string of additional key bindings hints for the *vc-dir* +;; buffer header, or nil. +;; +;; - dir-mode () +;; +;; Mode to use for the *vc-dir* buffer. This defaults to +;; `vc-dir-mode' and is expected to be changed (if at all) to a +;; derived mode of `vc-dir-mode'. +;; ;; - dir-printer (fileinfo) ;; ;; Pretty print the `vc-dir-fileinfo' FILEINFO. @@ -5632,6 +5643,12 @@ to provide the `find-revision' operation instead." (funcall update-function (mapcar (lambda (file) (list file 'up-to-date)) files))) +(declare-function vc-dir-mode "vc-dir") + +(defun vc-default-dir-mode (_backend) (vc-dir-mode)) + +(defalias 'vc-default-dir-extra-hints #'ignore) + (defun vc-check-headers () "Check if the current file has any headers in it." (interactive) commit 7c085204562aaf9bd20f8d9a2026b450f3e11610 Author: Sean Whitton Date: Mon Jul 6 14:38:31 2026 +0100 vc-dir-headers: Move hints to top, delete \ * lisp/vc/vc-dir.el (vc-dir-headers): Move hints to top of buffer (bug#81190). Delete unneeded and possibly harmful \. diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index a9e6ce7daa2..0425f89256f 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -1601,6 +1601,31 @@ It calls the `dir-extra-headers' backend method to display backend specific headers." (kill-local-variable 'vc-dir-async-header-values) (concat + (and + vc-dir-show-key-binding-hints + (substitute-command-keys + (concat + (propertize "Act " 'font-lock-face 'vc-dir-key-binding-hint-label) + " " + "(\\[vc-revert]) Revert, " + "(\\[vc-dir-delete-file]) Delete, " + "(\\[vc-dir-ignore]) Ignore, " + "(\\[vc-next-action]/\\[vc-dir-root-next-action]) Commit/commit all, " + "(\\[vc-push]) Push" + "\n" + (propertize "Marks" 'font-lock-face 'vc-dir-key-binding-hint-label) + " " + "(\\[vc-dir-mark]) Mark, " + "(\\[vc-dir-unmark]) Unmark, " + "(\\[vc-dir-unmark-all-files]) Unmark same state/dir, " + "(\\[universal-argument] \\[vc-dir-unmark-all-files]) Unmark all" + "\n" + (propertize "View " 'font-lock-face 'vc-dir-key-binding-hint-label) + " " + "(\\[vc-diff]) Diff, " + "(\\[revert-buffer]) Refresh, " + "(\\[vc-dir-hide-up-to-date]) Hide up-to-date" + "\n\n"))) (propertize "VC backend : " 'face 'vc-dir-header) (propertize (format "%s\n" backend) 'face 'vc-dir-header-value) (propertize "Working dir: " 'face 'vc-dir-header) @@ -1612,35 +1637,7 @@ specific headers." (concat (propertize (format "%-11s: " header) 'face 'vc-dir-header) "\n")) - vc-dir-async-header-values) - (and - vc-dir-show-key-binding-hints - (concat - "\n" - (substitute-command-keys - (concat - "\\" - (propertize "Act " 'font-lock-face 'vc-dir-key-binding-hint-label) - " " - "(\\[vc-revert]) Revert, " - "(\\[vc-dir-delete-file]) Delete, " - "(\\[vc-dir-ignore]) Ignore, " - "(\\[vc-next-action]/\\[vc-dir-root-next-action]) Commit/commit all, " - "(\\[vc-push]) Push" - "\n" - (propertize "Marks" 'font-lock-face 'vc-dir-key-binding-hint-label) - " " - "(\\[vc-dir-mark]) Mark, " - "(\\[vc-dir-unmark]) Unmark, " - "(\\[vc-dir-unmark-all-files]) Unmark same state/dir, " - "(\\[universal-argument] \\[vc-dir-unmark-all-files]) Unmark all" - "\n" - (propertize "View " 'font-lock-face 'vc-dir-key-binding-hint-label) - " " - "(\\[vc-diff]) Diff, " - "(\\[revert-buffer]) Refresh, " - "(\\[vc-dir-hide-up-to-date]) Hide up-to-date")) - "\n")))) + vc-dir-async-header-values))) (defun vc-dir--set-header (def-dir &optional reset-footer) (ewoc-set-hf vc-ewoc