1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

New command log-view-copy-revision-as-kill

* lisp/vc/log-view.el (log-view-copy-revision-as-kill): New
command.
(log-view-mode-map): Bind it.
* doc/emacs/maintaining.texi (VC Change Log):
* etc/NEWS: Document it.
This commit is contained in:
Timo Myyrä 2025-09-21 11:12:55 +03:00 committed by Sean Whitton
parent 3271d9fc96
commit 2ce33b66c5
3 changed files with 25 additions and 0 deletions

View file

@ -1244,6 +1244,11 @@ Display the changeset diff between the revision at point and the next
earlier revision (@code{log-view-diff-changeset}). This shows the
changes to all files made in that revision.
@item w
Copy the revision of the marked log entries into the kill ring, as if
you had killed them with @kbd{M-w}. Multiple entries will be separated
by a space.
@item @key{RET}
In a compact-style log buffer (e.g., the one created by @kbd{C-x v L}),
toggle between showing and hiding the full log entry for the revision at

View file

@ -2393,6 +2393,13 @@ You can get back the old behavior with something like this:
In addition, a new command 'U' removes all marks.
---
*** A new command 'log-view-copy-revision-as-kill' added.
The new 'log-view-copy-revision-as-kill' command copies the revision of
the log entry at point to the kill-ring. When multiple log entries are
marked the command copies all revisions in a single space separated
string. The command is bound by default to `w' in log-view-mode-map.
** Diff mode
+++

View file

@ -136,6 +136,7 @@
"f" #'log-view-find-revision
"n" #'log-view-msg-next
"p" #'log-view-msg-prev
"w" #'log-view-copy-revision-as-kill
"TAB" #'log-view-msg-next
"<backtab>" #'log-view-msg-prev)
@ -749,6 +750,18 @@ considered file(s)."
log-view-vc-fileset)))
fr to)))
(defun log-view-copy-revision-as-kill ()
"Copy the revision under point, as a string, to the `kill-ring'."
(interactive)
(let ((revisions (log-view-get-marked)))
(if (length> revisions 1)
(let ((found (string-join revisions " ")))
(kill-new found)
(message "%s" found))
(when-let* ((rev (or (car revisions) (cadr (log-view-current-entry)))))
(kill-new rev)
(message "%s" rev)))))
(provide 'log-view)
;;; log-view.el ends here