GNU bug report logs -
#79480
[PATCH] add `log-view-copy-revision-as-kill' function
Previous Next
To reply to this bug, email your comments to 79480 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79480
; Package
emacs
.
(Sun, 21 Sep 2025 08:29:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Timo Myyrä <timo.myyra <at> bittivirhe.fi>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 21 Sep 2025 08:29:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Tags: patch
Hi,
Here is an patch to implement `w' binding in the log-view-mode-map to
copy the revision string to kill-ring. Helps when the revision is
required in some other command.
This tries to follow the same idiom as in the dired mode where `w'
copies the filename under point to kill ring.
Timo
In GNU Emacs 30.1.90 (build 1, x86_64-unknown-openbsd, X toolkit, cairo
version 1.18.4, Xaw3d scroll bars) of 2025-05-25 built on
asteroid.bittivirhe.fi
Windowing system distributor 'The X.Org Foundation', version 11.0.12101018
System Description: OpenBSD asteroid.bittivirhe.fi 7.7 GENERIC.MP#99 amd64
Configured using:
'configure --build=amd64-unknown-openbsd
--enable-locallisppath=/etc/emacs:/usr/local/share/emacs/30.1.90/site-lisp:/usr/local/share/emacs/site-lisp
--without-sound --with-x-toolkit=athena --prefix=/usr/local
--sysconfdir=/etc --mandir=/usr/local/man --infodir=/usr/local/info
--localstatedir=/var --disable-silent-rules --disable-gtk-doc
'CFLAGS=-O2 -pipe -g' CPPFLAGS=-I/usr/local/include
'LDFLAGS=-L/usr/local/lib -g''
[0001-add-log-view-copy-revision-as-kill-function.patch (text/patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79480
; Package
emacs
.
(Sun, 21 Sep 2025 08:40:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 79480 <at> debbugs.gnu.org (full text, mbox):
> From: Timo Myyrä <timo.myyra <at> bittivirhe.fi>
> Date: Sun, 21 Sep 2025 11:27:44 +0300
>
> Here is an patch to implement `w' binding in the log-view-mode-map to
> copy the revision string to kill-ring. Helps when the revision is
> required in some other command.
> This tries to follow the same idiom as in the dired mode where `w'
> copies the filename under point to kill ring.
Thanks.
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -2330,6 +2330,12 @@ You can get back the old behavior with something like this:
> (with-eval-after-load 'log-view
> (keymap-set log-view-mode-map "m" #'log-view-toggle-mark-entry))
>
> +---
> +*** A new function `log-view-copy-revision-as-kill' added
Heading lines in NEWS must end in a period. Also, please quote 'like
this' in NEWS.
> +The log-view now provides new `log-view-copy-revision-as-kill' function
^^^^^^^^
"command".
Also, there's no need to tell which package provided the new command.
So something like
The new command 'log-view-copy-revision-as-kill' allows copying ...
is better.
And IMO the "-as-kill" part of the command's name is redundant.
> +to copy the revision string under point to the kill-ring. The command is
> +bound by default to `w' in log-view-mode-map.
Please use "at point", not "under point". (Actually, I believe a more
accurate wording is "revision string of the log entry at point".)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79480
; Package
emacs
.
(Sun, 21 Sep 2025 09:08:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 79480 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Sun, Sep 21 2025, Eli Zaretskii wrote:
>> From: Timo Myyrä <timo.myyra <at> bittivirhe.fi>
>> Date: Sun, 21 Sep 2025 11:27:44 +0300
>>
>> Here is an patch to implement `w' binding in the log-view-mode-map to
>> copy the revision string to kill-ring. Helps when the revision is
>> required in some other command.
>> This tries to follow the same idiom as in the dired mode where `w'
>> copies the filename under point to kill ring.
>
> Thanks.
>
>> --- a/etc/NEWS
>> +++ b/etc/NEWS
>> @@ -2330,6 +2330,12 @@ You can get back the old behavior with something like this:
>> (with-eval-after-load 'log-view
>> (keymap-set log-view-mode-map "m" #'log-view-toggle-mark-entry))
>>
>> +---
>> +*** A new function `log-view-copy-revision-as-kill' added
>
> Heading lines in NEWS must end in a period. Also, please quote 'like
> this' in NEWS.
>
>> +The log-view now provides new `log-view-copy-revision-as-kill' function
> ^^^^^^^^
> "command".
>
> Also, there's no need to tell which package provided the new command.
> So something like
>
> The new command 'log-view-copy-revision-as-kill' allows copying ...
>
> is better.
>
> And IMO the "-as-kill" part of the command's name is redundant.
>
>> +to copy the revision string under point to the kill-ring. The command is
>> +bound by default to `w' in log-view-mode-map.
>
> Please use "at point", not "under point". (Actually, I believe a more
> accurate wording is "revision string of the log entry at point".)
Thanks for the quick feedback. I updated the patch accordingly.
I kept the 'as-kill' part as there are multiple commands in emacs with
same suffix. The new command mimics the functionality from dired where
the command is named 'dired-copy-filename-as-kill' so I thought to keep
the similar naming here.
timo
[0001-add-log-view-copy-revision-as-kill-command.patch (text/x-patch, inline)]
From 516fc6115575e201bde859ef320392b99f8e7f7a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Myyr=C3=A4?= <timo.myyra <at> bittivirhe.fi>
Date: Sun, 21 Sep 2025 11:12:55 +0300
Subject: [PATCH] add `log-view-copy-revision-as-kill' command
Add `log-view-copy-revision-as-kill' command to copy revision as string
and bind it `w' key in the log-view-mode-map.
---
etc/NEWS | 6 ++++++
lisp/vc/log-view.el | 7 +++++++
2 files changed, 13 insertions(+)
diff --git a/etc/NEWS b/etc/NEWS
index 059270bff46..ae7478c28ea 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2330,6 +2330,12 @@ You can get back the old behavior with something like this:
(with-eval-after-load 'log-view
(keymap-set log-view-mode-map "m" #'log-view-toggle-mark-entry))
+---
+*** A new command 'log-view-copy-revision-as-kill' added.
+The new command 'log-view-copy-revision-as-kill' copies the revision
+string of the log entry at point to the kill-ring. The command is bound
+by default to 'w' in log-view-mode-map.
+
** Diff mode
+++
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index 3d04676b419..dd610968c7e 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -136,6 +136,7 @@ log-view-mode-map
"n" #'log-view-msg-next
"p" #'log-view-msg-prev
"TAB" #'log-view-msg-next
+ "w" #'log-view-copy-revision-as-kill
"<backtab>" #'log-view-msg-prev)
(easy-menu-define log-view-mode-menu log-view-mode-map
@@ -742,6 +743,12 @@ log-view-diff-common
log-view-vc-fileset)))
fr to)))
+(defun log-view-copy-revision-as-kill ()
+ "Copy the revision string of the log entry at point to the kill-ring."
+ (when-let ((revision (cadr (log-view-current-entry))))
+ (kill-new revision)
+ (message "%s" revision)))
+
(provide 'log-view)
;;; log-view.el ends here
--
2.50.1
This bug report was last modified 3 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.