diff options
| -rw-r--r-- | doc/emacs/vc1-xtra.texi | 18 | ||||
| -rw-r--r-- | etc/NEWS | 7 | ||||
| -rw-r--r-- | lisp/vc/vc-hooks.el | 3 | ||||
| -rw-r--r-- | lisp/vc/vc.el | 53 |
4 files changed, 63 insertions, 18 deletions
diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi index 3ccad507159..facc03dd662 100644 --- a/doc/emacs/vc1-xtra.texi +++ b/doc/emacs/vc1-xtra.texi | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | * VC Delete/Rename:: Deleting and renaming version-controlled files. | 15 | * VC Delete/Rename:: Deleting and renaming version-controlled files. |
| 16 | * Revision Tags:: Symbolic names for revisions. | 16 | * Revision Tags:: Symbolic names for revisions. |
| 17 | * Version Headers:: Inserting version control headers into working files. | 17 | * Version Headers:: Inserting version control headers into working files. |
| 18 | * Editing VC Commands:: Editing the VC shell commands that Emacs will run. | ||
| 18 | @end menu | 19 | @end menu |
| 19 | 20 | ||
| 20 | @node Change Logs and VC | 21 | @node Change Logs and VC |
| @@ -263,6 +264,23 @@ elements of the form @code{(@var{regexp} . @var{format})}. Whenever | |||
| 263 | part of the version header. A @samp{%s} in @var{format} is replaced | 264 | part of the version header. A @samp{%s} in @var{format} is replaced |
| 264 | with the file's version control type. | 265 | with the file's version control type. |
| 265 | 266 | ||
| 267 | @node Editing VC Commands | ||
| 268 | @subsubsection Editing VC Commands | ||
| 269 | |||
| 270 | @findex vc-edit-next-command | ||
| 271 | @kindex C-x v ! | ||
| 272 | You can use the @kbd{C-x v !} (@code{vc-edit-next-command}) prefix | ||
| 273 | command to request an opportunity to edit the VC shell commands that | ||
| 274 | Emacs will run. This is primarily intended to make it possible to | ||
| 275 | access version control system-specific functionality without | ||
| 276 | complexifying either the VC command set or the backend API. | ||
| 277 | |||
| 278 | For example, Git can produce logs of more than one branch, but | ||
| 279 | @kbd{C-x v b l} (@code{vc-print-branch-log}) prompts for the name of | ||
| 280 | just one branch. To obtain a log of more than one branch, you can | ||
| 281 | type @kbd{C-x v ! C-x v b l} and then append the names of additional | ||
| 282 | branches to the end of the 'git log' command that VC prepares. | ||
| 283 | |||
| 266 | @node Customizing VC | 284 | @node Customizing VC |
| 267 | @subsection Customizing VC | 285 | @subsection Customizing VC |
| 268 | 286 | ||
| @@ -1754,6 +1754,13 @@ commands. | |||
| 1754 | This command marks files based on a regexp. If given a prefix | 1754 | This command marks files based on a regexp. If given a prefix |
| 1755 | argument, unmark instead. | 1755 | argument, unmark instead. |
| 1756 | 1756 | ||
| 1757 | +++ | ||
| 1758 | *** New command 'C-x v !' ('vc-edit-next-command') | ||
| 1759 | This prefix command requests editing of the next VC shell command | ||
| 1760 | before execution. For example, in a Git repository, you can produce a | ||
| 1761 | log of more than one branch by typing 'C-x v ! C-x v b l' and then | ||
| 1762 | appending additional branch names to the 'git log' command. | ||
| 1763 | |||
| 1757 | --- | 1764 | --- |
| 1758 | *** 'C-x v v' in a diffs buffer allows to commit only some of the changes. | 1765 | *** 'C-x v v' in a diffs buffer allows to commit only some of the changes. |
| 1759 | This command is intended to allow you to commit only some of the | 1766 | This command is intended to allow you to commit only some of the |
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 7f0d9e4d862..6ad26cfe674 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el | |||
| @@ -882,7 +882,8 @@ In the latter case, VC mode is deactivated for this buffer." | |||
| 882 | "=" #'vc-diff | 882 | "=" #'vc-diff |
| 883 | "D" #'vc-root-diff | 883 | "D" #'vc-root-diff |
| 884 | "~" #'vc-revision-other-window | 884 | "~" #'vc-revision-other-window |
| 885 | "x" #'vc-delete-file) | 885 | "x" #'vc-delete-file |
| 886 | "!" #'vc-edit-next-command) | ||
| 886 | (fset 'vc-prefix-map vc-prefix-map) | 887 | (fset 'vc-prefix-map vc-prefix-map) |
| 887 | (define-key ctl-x-map "v" 'vc-prefix-map) | 888 | (define-key ctl-x-map "v" 'vc-prefix-map) |
| 888 | 889 | ||
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 24300e014af..25bb0c848d8 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el | |||
| @@ -1917,8 +1917,11 @@ Return t if the buffer had changes, nil otherwise." | |||
| 1917 | (setq files (cadr vc-fileset)) | 1917 | (setq files (cadr vc-fileset)) |
| 1918 | (setq backend (car vc-fileset)))) | 1918 | (setq backend (car vc-fileset)))) |
| 1919 | ((null backend) (setq backend (vc-backend (car files))))) | 1919 | ((null backend) (setq backend (vc-backend (car files))))) |
| 1920 | (let ((completion-table | 1920 | ;; Override any `vc-filter-command-function' value, as user probably |
| 1921 | (vc-call-backend backend 'revision-completion-table files))) | 1921 | ;; doesn't want to edit the command to get the completions. |
| 1922 | (let* ((vc-filter-command-function #'list) | ||
| 1923 | (completion-table | ||
| 1924 | (vc-call-backend backend 'revision-completion-table files))) | ||
| 1922 | (if completion-table | 1925 | (if completion-table |
| 1923 | (completing-read prompt completion-table | 1926 | (completing-read prompt completion-table |
| 1924 | nil nil initial-input 'vc-revision-history default) | 1927 | nil nil initial-input 'vc-revision-history default) |
| @@ -2744,28 +2747,17 @@ with its diffs (if the underlying VCS supports that)." | |||
| 2744 | (setq vc-parent-buffer-name nil))) | 2747 | (setq vc-parent-buffer-name nil))) |
| 2745 | 2748 | ||
| 2746 | ;;;###autoload | 2749 | ;;;###autoload |
| 2747 | (defun vc-print-branch-log (branch &optional arg) | 2750 | (defun vc-print-branch-log (branch) |
| 2748 | "Show the change log for BRANCH root in a window. | 2751 | "Show the change log for BRANCH root in a window." |
| 2749 | Optional prefix ARG non-nil requests an opportunity for the user | ||
| 2750 | to edit the VC shell command that will be run to generate the | ||
| 2751 | log." | ||
| 2752 | ;; The original motivation for ARG was to make it possible to | ||
| 2753 | ;; produce a log of more than one Git branch without modifying the | ||
| 2754 | ;; print-log VC API. The user can append the other branches to the | ||
| 2755 | ;; command line arguments to 'git log'. See bug#57807. | ||
| 2756 | (interactive | 2752 | (interactive |
| 2757 | (let* ((backend (vc-responsible-backend default-directory)) | 2753 | (let* ((backend (vc-responsible-backend default-directory)) |
| 2758 | (rootdir (vc-call-backend backend 'root default-directory))) | 2754 | (rootdir (vc-call-backend backend 'root default-directory))) |
| 2759 | (list | 2755 | (list |
| 2760 | (vc-read-revision "Branch to log: " (list rootdir) backend) | 2756 | (vc-read-revision "Branch to log: " (list rootdir) backend)))) |
| 2761 | current-prefix-arg))) | ||
| 2762 | (when (equal branch "") | 2757 | (when (equal branch "") |
| 2763 | (error "No branch specified")) | 2758 | (error "No branch specified")) |
| 2764 | (let* ((backend (vc-responsible-backend default-directory)) | 2759 | (let* ((backend (vc-responsible-backend default-directory)) |
| 2765 | (rootdir (vc-call-backend backend 'root default-directory)) | 2760 | (rootdir (vc-call-backend backend 'root default-directory))) |
| 2766 | (vc-filter-command-function (if arg | ||
| 2767 | #'vc-user-edit-command | ||
| 2768 | vc-filter-command-function))) | ||
| 2769 | (vc-print-log-internal backend | 2761 | (vc-print-log-internal backend |
| 2770 | (list rootdir) branch t | 2762 | (list rootdir) branch t |
| 2771 | (when (> vc-log-show-limit 0) vc-log-show-limit)))) | 2763 | (when (> vc-log-show-limit 0) vc-log-show-limit)))) |
| @@ -3243,6 +3235,33 @@ log entries should be gathered." | |||
| 3243 | (vc-call-backend (vc-responsible-backend default-directory) | 3235 | (vc-call-backend (vc-responsible-backend default-directory) |
| 3244 | 'update-changelog args)) | 3236 | 'update-changelog args)) |
| 3245 | 3237 | ||
| 3238 | (defvar vc-filter-command-function) | ||
| 3239 | |||
| 3240 | ;;;###autoload | ||
| 3241 | (defun vc-edit-next-command () | ||
| 3242 | "Request editing the next VC shell command before execution. | ||
| 3243 | This is a prefix command. It affects only a VC command executed | ||
| 3244 | immediately after this one." | ||
| 3245 | (interactive) | ||
| 3246 | (letrec ((minibuffer-depth (minibuffer-depth)) | ||
| 3247 | (command this-command) | ||
| 3248 | (keys (key-description (this-command-keys))) | ||
| 3249 | (old vc-filter-command-function) | ||
| 3250 | (echofun (lambda () keys)) | ||
| 3251 | (postfun | ||
| 3252 | (lambda () | ||
| 3253 | (unless (or (eq this-command command) | ||
| 3254 | (> (minibuffer-depth) minibuffer-depth)) | ||
| 3255 | (remove-hook 'post-command-hook postfun) | ||
| 3256 | (remove-hook 'prefix-command-echo-keystrokes-functions | ||
| 3257 | echofun) | ||
| 3258 | (setq vc-filter-command-function old))))) | ||
| 3259 | (add-hook 'post-command-hook postfun) | ||
| 3260 | (add-hook 'prefix-command-echo-keystrokes-functions echofun) | ||
| 3261 | (setq vc-filter-command-function | ||
| 3262 | (lambda (&rest args) | ||
| 3263 | (apply #'vc-user-edit-command (apply old args)))))) | ||
| 3264 | |||
| 3246 | (defun vc-default-responsible-p (_backend _file) | 3265 | (defun vc-default-responsible-p (_backend _file) |
| 3247 | "Indicate whether BACKEND is responsible for FILE. | 3266 | "Indicate whether BACKEND is responsible for FILE. |
| 3248 | The default is to return nil always." | 3267 | The default is to return nil always." |