From: Juri Linkov <juri@linkov.net>
To: Stefan Kangas <stefan@marxist.se>
Cc: 52518@debbugs.gnu.org
Subject: bug#52518: Log only vc-command-messages
Date: Thu, 16 Dec 2021 19:15:38 +0200 [thread overview]
Message-ID: <8635ms8ryd.fsf@mail.linkov.net> (raw)
In-Reply-To: <CADwFkmmi04Qwejdqt8mPGQqY1-CAhreuVGnXuadFGBbZZRDsLA@mail.gmail.com> (Stefan Kangas's message of "Wed, 15 Dec 2021 14:02:32 -0800")
[-- Attachment #1: Type: text/plain, Size: 490 bytes --]
>> (when vc-command-messages
>> - (let ((inhibit-message (eq (selected-window) (active-minibuffer-window))))
>> + (let ((inhibit-message
>> + (or (eq vc-command-messages 'log)
>> + (eq (selected-window) (active-minibuffer-window)))))
>
> Should these be refactored into a function of their own? It seems
> a tad repetitive as is.
I agree these should be refactored. I was unsure if selected-window
changes during function execution, but this would be better:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vc-inhibit-message.patch --]
[-- Type: text/x-diff, Size: 2751 bytes --]
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index 346974bdba..4adc01fbfc 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -127,8 +127,12 @@ vc-delete-logbuf-window
:group 'vc)
(defcustom vc-command-messages nil
- "If non-nil, display run messages from back-end commands."
- :type 'boolean
+ "If non-nil, log run messages from back-end commands.
+If `log', messages are logged to the *Messages* buffer, but not displayed.
+Other non-nil values also display run messages in the echo area."
+ :type '(choice (const :tag "No display and no log" nil)
+ (const :tag "Display and log messages" t)
+ (const :tag "Only log messages without displaying" log))
:group 'vc)
(defcustom vc-suppress-confirm nil
@@ -311,7 +315,10 @@ vc-do-command
(substring command 0 -1)
command)
" " (vc-delistify flags)
- " " (vc-delistify files))))
+ " " (vc-delistify files)))
+ (vc-inhibit-message
+ (or (eq vc-command-messages 'log)
+ (eq (selected-window) (active-minibuffer-window)))))
(save-current-buffer
(unless (or (eq buffer t)
(and (stringp buffer)
@@ -335,7 +342,7 @@ vc-do-command
(apply #'start-file-process command (current-buffer)
command squeezed))))
(when vc-command-messages
- (let ((inhibit-message (eq (selected-window) (active-minibuffer-window))))
+ (let ((inhibit-message vc-inhibit-message))
(message "Running in background: %s" full-command)))
;; Get rid of the default message insertion, in case we don't
;; set a sentinel explicitly.
@@ -345,11 +352,11 @@ vc-do-command
(when vc-command-messages
(vc-run-delayed
(let ((message-truncate-lines t)
- (inhibit-message (eq (selected-window) (active-minibuffer-window))))
+ (inhibit-message vc-inhibit-message))
(message "Done in background: %s" full-command)))))
;; Run synchronously
(when vc-command-messages
- (let ((inhibit-message (eq (selected-window) (active-minibuffer-window))))
+ (let ((inhibit-message vc-inhibit-message))
(message "Running in foreground: %s" full-command)))
(let ((buffer-undo-list t))
(setq status (apply #'process-file command nil t nil squeezed)))
@@ -364,7 +371,7 @@ vc-do-command
(if (integerp status) (format "status %d" status) status)
full-command))
(when vc-command-messages
- (let ((inhibit-message (eq (selected-window) (active-minibuffer-window))))
+ (let ((inhibit-message vc-inhibit-message))
(message "Done (status=%d): %s" status full-command)))))
(vc-run-delayed
(run-hook-with-args 'vc-post-command-functions
next prev parent reply other threads:[~2021-12-16 17:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 17:31 bug#52518: Log only vc-command-messages Juri Linkov
2021-12-15 22:02 ` Stefan Kangas
2021-12-16 17:15 ` Juri Linkov [this message]
2021-12-16 18:01 ` Stefan Kangas
2021-12-16 19:17 ` Juri Linkov
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=8635ms8ryd.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=52518@debbugs.gnu.org \
--cc=stefan@marxist.se \
/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).