unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Sean Whitton <spwhitton@spwhitton.name>
To: Juri Linkov <juri@linkov.net>
Cc: 57807@debbugs.gnu.org
Subject: bug#57807: 29.0.50; Make vc-print-branch-log able to log multiple branches
Date: Sat, 24 Sep 2022 16:18:59 -0700	[thread overview]
Message-ID: <87r100bbto.fsf@melete.silentflame.com> (raw)
In-Reply-To: <86v8pc5yff.fsf@mail.linkov.net> (Juri Linkov's message of "Sat,  24 Sep 2022 22:57:16 +0300")

[-- Attachment #1: Type: text/plain, Size: 735 bytes --]

Hello,

On Sat 24 Sep 2022 at 10:57PM +03, Juri Linkov wrote:

>>> But 'M-!' has a clear connection with editing a shell command.  So
>>> 'C-x v !' looks like the best candidate among all considered so far.
>>
>> I'm running into the problem that you pointed out in another thread.
>> How do we apply vc-filter-command-function to the final VC command
>> that's to be run without also applying it to intermediate VC commands,
>> e.g. in vc-read-revision?
>
> Maybe there is no problem to apply the editing filter to all commands,
> I don't know.  First need to try to see how it really works.

Here's the WIP patch, hopefully it works well enough for testing.

I think it's considerably worse than C-u C-x v b l tbh.

-- 
Sean Whitton

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-WIP-Add-vc-edit-next-command.patch --]
[-- Type: text/x-patch, Size: 2200 bytes --]

From 8521996056c980d096f1ec935c34345f265d3665 Mon Sep 17 00:00:00 2001
From: Sean Whitton <spwhitton@spwhitton.name>
Date: Sat, 24 Sep 2022 16:17:56 -0700
Subject: [PATCH] WIP Add vc-edit-next-command.

---
 lisp/vc/vc-hooks.el |  3 ++-
 lisp/vc/vc.el       | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 7f0d9e4d86..6ad26cfe67 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -882,7 +882,8 @@ vc-prefix-map
   "="   #'vc-diff
   "D"   #'vc-root-diff
   "~"   #'vc-revision-other-window
-  "x"   #'vc-delete-file)
+  "x"   #'vc-delete-file
+  "!"   #'vc-edit-next-command)
 (fset 'vc-prefix-map vc-prefix-map)
 (define-key ctl-x-map "v" 'vc-prefix-map)
 
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 4950a1a32d..595288d30f 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -3244,6 +3244,31 @@ vc-update-change-log
   (vc-call-backend (vc-responsible-backend default-directory)
                    'update-changelog args))
 
+(defvar vc-filter-command-function)
+
+;;;###autoload
+(defun vc-edit-next-command ()
+  "Request editing the next VC shell command before execution.
+This is a prefix command.  It affects only a VC command executed
+immediately after this one."
+  (interactive)
+  (letrec ((command this-command)
+           (keys (key-description (this-command-keys)))
+           (old vc-filter-command-function)
+           (echofun (lambda () keys))
+           (postfun
+            (lambda ()
+              (unless (eq this-command command)
+                (remove-hook 'post-command-hook postfun)
+                (remove-hook 'prefix-command-echo-keystrokes-functions
+                             echofun)
+                (setq vc-filter-command-function old)))))
+    (add-hook 'post-command-hook postfun)
+    (add-hook 'prefix-command-echo-keystrokes-functions echofun)
+    (setq vc-filter-command-function
+          (lambda (&rest args)
+            (apply #'vc-user-edit-command (apply old args))))))
+
 (defun vc-default-responsible-p (_backend _file)
   "Indicate whether BACKEND is responsible for FILE.
 The default is to return nil always."
-- 
2.30.2


  reply	other threads:[~2022-09-24 23:18 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-14 17:19 bug#57807: 29.0.50; Make vc-print-branch-log able to log multiple branches Sean Whitton
2022-09-14 17:41 ` Eli Zaretskii
2022-09-14 22:42   ` Sean Whitton
2022-09-15  5:33     ` Eli Zaretskii
2022-09-15 16:18       ` Sean Whitton
2022-09-15 16:48         ` Eli Zaretskii
2022-09-15 22:29           ` Sean Whitton
2022-09-14 19:17 ` Juri Linkov
2022-09-14 22:44   ` Sean Whitton
2022-09-15  6:59     ` Juri Linkov
2022-09-15 16:15       ` Sean Whitton
2022-09-15 17:27         ` Juri Linkov
2022-09-15 22:29           ` Sean Whitton
2022-09-16  6:59             ` Juri Linkov
2022-09-18 21:48               ` Sean Whitton
2022-09-19  6:42                 ` Juri Linkov
2022-09-20 22:54                   ` Sean Whitton
2022-09-21 18:52                     ` Juri Linkov
2022-09-21 19:39                       ` Sean Whitton
2022-09-22  6:39                         ` Juri Linkov
2022-09-22 16:10                           ` Sean Whitton
2022-09-22 18:44                             ` Juri Linkov
2022-09-22 21:20                               ` Sean Whitton
2022-09-23  6:42                                 ` Juri Linkov
2022-09-23 16:34                                   ` Sean Whitton
2022-09-24 19:20                                   ` Sean Whitton
2022-09-24 19:57                                     ` Juri Linkov
2022-09-24 23:18                                       ` Sean Whitton [this message]
2022-09-25  7:29                                         ` Juri Linkov
2022-09-26 22:33                                           ` Sean Whitton
2022-09-27 18:59                                             ` Juri Linkov
2022-09-28  1:15                                               ` bug#57807: vc-edit-next-command (was bug#57807: 29.0.50; Make vc-print-branch-log able to log multiple branches) Sean Whitton
     [not found]                                               ` <87k05ofgfe.fsf_-_@melete.silentflame.com>
2022-09-28 17:53                                                 ` Juri Linkov
     [not found]                                                 ` <86pmff5qtf.fsf@mail.linkov.net>
2022-09-28 20:41                                                   ` Sean Whitton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r100bbto.fsf@melete.silentflame.com \
    --to=spwhitton@spwhitton.name \
    --cc=57807@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).