GNU bug report logs - #52518
Log only vc-command-messages

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> linkov.net>

Date: Wed, 15 Dec 2021 17:33:02 UTC

Severity: wishlist

Tags: patch

Fixed in version 29.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 52518 in the body.
You can then email your comments to 52518 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#52518; Package emacs. (Wed, 15 Dec 2021 17:33:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> linkov.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 15 Dec 2021 17:33:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Log only vc-command-messages
Date: Wed, 15 Dec 2021 19:31:07 +0200
[Message part 1 (text/plain, inline)]
Tags: patch

It's useful to customize vc-command-messages to t
to be able to inspect the performed vc commands
in the *Messages* buffer.  When something goes wrong,
it's clearly visible what command caused the problem.

But displaying such all vc commands in the echo area
causes too much noise.  Here is an option to not
display such messages, only log in the *Messages* buffer:

[vc-command-messages-log.patch (text/x-diff, inline)]
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index 346974bdba..894ca060eb 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
@@ -335,7 +339,9 @@ 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
+			 (or (eq vc-command-messages 'log)
+			     (eq (selected-window) (active-minibuffer-window)))))
 		    (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 +351,15 @@ 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
+			   (or (eq vc-command-messages 'log)
+			       (eq (selected-window) (active-minibuffer-window)))))
 		      (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
+		     (or (eq vc-command-messages 'log)
+			 (eq (selected-window) (active-minibuffer-window)))))
 		(message "Running in foreground: %s" full-command)))
 	    (let ((buffer-undo-list t))
 	      (setq status (apply #'process-file command nil t nil squeezed)))
@@ -364,7 +374,9 @@ 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
+		     (or (eq vc-command-messages 'log)
+			 (eq (selected-window) (active-minibuffer-window)))))
 		(message "Done (status=%d): %s" status full-command)))))
 	(vc-run-delayed
 	  (run-hook-with-args 'vc-post-command-functions

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52518; Package emacs. (Wed, 15 Dec 2021 22:03:01 GMT) Full text and rfc822 format available.

Message #8 received at 52518 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Juri Linkov <juri <at> linkov.net>
Cc: 52518 <at> debbugs.gnu.org
Subject: Re: bug#52518: Log only vc-command-messages
Date: Wed, 15 Dec 2021 14:02:32 -0800
Juri Linkov <juri <at> linkov.net> writes:

> It's useful to customize vc-command-messages to t
> to be able to inspect the performed vc commands
> in the *Messages* buffer.  When something goes wrong,
> it's clearly visible what command caused the problem.
>
> But displaying such all vc commands in the echo area
> causes too much noise.  Here is an option to not
> display such messages, only log in the *Messages* buffer:

Good idea.

>  		(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)))))
>  		    (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 +351,15 @@ 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
> +			   (or (eq vc-command-messages 'log)
> +			       (eq (selected-window) (active-minibuffer-window)))))
>  		      (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
> +		     (or (eq vc-command-messages 'log)
> +			 (eq (selected-window) (active-minibuffer-window)))))
>  		(message "Running in foreground: %s" full-command)))
>  	    (let ((buffer-undo-list t))
>  	      (setq status (apply #'process-file command nil t nil squeezed)))
> @@ -364,7 +374,9 @@ 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
> +		     (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.




Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 15 Dec 2021 22:03:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52518; Package emacs. (Thu, 16 Dec 2021 17:36:04 GMT) Full text and rfc822 format available.

Message #13 received at 52518 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 52518 <at> debbugs.gnu.org
Subject: Re: bug#52518: Log only vc-command-messages
Date: Thu, 16 Dec 2021 19:15:38 +0200
[Message part 1 (text/plain, inline)]
>>  	    (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:

[vc-inhibit-message.patch (text/x-diff, inline)]
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

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52518; Package emacs. (Thu, 16 Dec 2021 18:02:02 GMT) Full text and rfc822 format available.

Message #16 received at 52518 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Juri Linkov <juri <at> linkov.net>
Cc: 52518 <at> debbugs.gnu.org
Subject: Re: bug#52518: Log only vc-command-messages
Date: Thu, 16 Dec 2021 10:01:22 -0800
Juri Linkov <juri <at> linkov.net> writes:

> I agree these should be refactored.  I was unsure if selected-window
> changes during function execution, but this would be better:

Thanks.  Some documentation comments:

> 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."

Would this be simpler?

    If non-nil, display and log run messages from back-end commands.
    If `log', messages are logged to the *Messages* buffer but not
    displayed.

> +  :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))

Perhaps the first one could be:

    No messages

Perhaps the last one could be:

    Log messages




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#52518; Package emacs. (Thu, 16 Dec 2021 19:18:02 GMT) Full text and rfc822 format available.

Message #19 received at 52518 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: 52518 <at> debbugs.gnu.org
Subject: Re: bug#52518: Log only vc-command-messages
Date: Thu, 16 Dec 2021 21:17:14 +0200
close 52518 29.0.50
thanks

> Would this be simpler?
>
>     If non-nil, display and log run messages from back-end commands.
>     If `log', messages are logged to the *Messages* buffer but not
>     displayed.
>
>> +  :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))
>
> Perhaps the first one could be:
>
>     No messages
>
> Perhaps the last one could be:
>
>     Log messages

Thanks for the suggestions.  Now pushed to master with all corrections.
I'm not sure if a NEWS entry is needed, since this option is useful mostly
for debugging.




bug marked as fixed in version 29.0.50, send any further explanations to 52518 <at> debbugs.gnu.org and Juri Linkov <juri <at> linkov.net> Request was from Juri Linkov <juri <at> linkov.net> to control <at> debbugs.gnu.org. (Thu, 16 Dec 2021 19:18:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 14 Jan 2022 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 243 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.