unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30016: Improve visibility of Process List
@ 2018-01-07 21:54 Juri Linkov
  2018-01-08  3:57 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2018-01-07 21:54 UTC (permalink / raw)
  To: 30016

0. emacs -Q

1. M-& sleep 3600 RET

2. M-& sleep 3600 RET
   Answer “yes” to the question:
   “A command is running in the default buffer.  Use a new buffer? (yes or no) ”

3. Repeat some more times from 2.

4. C-x C-c
   “Active processes exist; kill them and exit anyway? (yes or no) ”

The displayed buffer *Process List* truncates the buffer names
and thus hides the suffixes of the active buffers:

Shell           25550   run     *Async Shell... /dev/pts/17  /bin/bash -c sleep 3600
Shell<1>        25551   run     *Async Shell... /dev/pts/18  /bin/bash -c sleep 3600
Shell<2>        25552   run     *Async Shell... /dev/pts/19  /bin/bash -c sleep 3600
...

These buffer name suffixes are important to see to be able
to switch to the corresponding buffers using the *Buffer List*,
check the output and terminate its process when needed.

So I propose to increase the size of the column for buffer names
in *Process List* to at least fit the longest default buffer name
*Async Shell Command* with suffixes:

diff --git a/lisp/simple.el b/lisp/simple.el
index 87e0b23..6e8930b 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3927,7 +3927,7 @@ process-menu-mode
   (setq tabulated-list-format [("Process" 15 t)
 			       ("PID"      7 t)
 			       ("Status"   7 t)
-			       ("Buffer"  15 t)
+			       ("Buffer"  25 t)
 			       ("TTY"     12 t)
 			       ("Command"  0 t)])
   (make-local-variable 'process-menu-query-only)





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#30016: Improve visibility of Process List
  2018-01-07 21:54 bug#30016: Improve visibility of Process List Juri Linkov
@ 2018-01-08  3:57 ` Eli Zaretskii
  2018-01-08 23:05   ` Juri Linkov
                     ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Eli Zaretskii @ 2018-01-08  3:57 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 30016

> From: Juri Linkov <juri@linkov.net>
> Date: Sun, 07 Jan 2018 23:54:17 +0200
> 
> 4. C-x C-c
>    “Active processes exist; kill them and exit anyway? (yes or no) ”
> 
> The displayed buffer *Process List* truncates the buffer names
> and thus hides the suffixes of the active buffers:
> 
> Shell           25550   run     *Async Shell... /dev/pts/17  /bin/bash -c sleep 3600
> Shell<1>        25551   run     *Async Shell... /dev/pts/18  /bin/bash -c sleep 3600
> Shell<2>        25552   run     *Async Shell... /dev/pts/19  /bin/bash -c sleep 3600
> ...
> 
> These buffer name suffixes are important to see to be able
> to switch to the corresponding buffers using the *Buffer List*,
> check the output and terminate its process when needed.
> 
> So I propose to increase the size of the column for buffer names
> in *Process List* to at least fit the longest default buffer name
> *Async Shell Command* with suffixes:

Any hope of a more clever logic that would eliminate the need for
arbitrary limits?  Who can know whether there are other users of these
facilities which need even wider columns?  E.g., can we display
something like

   *Async Sh...<1>

i.e. make sure the numerical tail is shown?

> diff --git a/lisp/simple.el b/lisp/simple.el
> index 87e0b23..6e8930b 100644
> --- a/lisp/simple.el
> +++ b/lisp/simple.el
> @@ -3927,7 +3927,7 @@ process-menu-mode
>    (setq tabulated-list-format [("Process" 15 t)
>  			       ("PID"      7 t)
>  			       ("Status"   7 t)
> -			       ("Buffer"  15 t)
> +			       ("Buffer"  25 t)
>  			       ("TTY"     12 t)
>  			       ("Command"  0 t)])
>    (make-local-variable 'process-menu-query-only)

If we eventually decide to go with this simple change, there should be
a comment explaining the value and its use case, and perhaps also a
test for that.

Thanks.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#30016: Improve visibility of Process List
  2018-01-08  3:57 ` Eli Zaretskii
@ 2018-01-08 23:05   ` Juri Linkov
  2018-01-10 21:34     ` Juri Linkov
  2018-01-08 23:11   ` Juri Linkov
  2018-01-18 21:44   ` Juri Linkov
  2 siblings, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2018-01-08 23:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30016

>> The displayed buffer *Process List* truncates the buffer names
>> and thus hides the suffixes of the active buffers:
>>
>> Shell           25550   run     *Async Shell... /dev/pts/17  /bin/bash -c sleep 3600
>> Shell<1>        25551   run     *Async Shell... /dev/pts/18  /bin/bash -c sleep 3600
>> Shell<2>        25552   run     *Async Shell... /dev/pts/19  /bin/bash -c sleep 3600
>> ...
>>
>> These buffer name suffixes are important to see to be able
>> to switch to the corresponding buffers using the *Buffer List*,
>> check the output and terminate its process when needed.
>>
>> So I propose to increase the size of the column for buffer names
>> in *Process List* to at least fit the longest default buffer name
>> *Async Shell Command* with suffixes:
>
> Any hope of a more clever logic that would eliminate the need for
> arbitrary limits?  Who can know whether there are other users of these
> facilities which need even wider columns?  E.g., can we display
> something like
>
>    *Async Sh...<1>
>
> i.e. make sure the numerical tail is shown?

Yes, this would be the most universal solution.
And this feature is also necessary in the *Buffer List*
where *Async Shell Command* buffer names are truncated too.

To support arbitrary formatting in ‘tabulated-list-format’ we could try
to add a new column property that would allow specifying what suffix
to leave in truncated columns.  For example, for buffer names it could
leave the buffer name's unique suffix such as “*Async Sh...<1>”,
or for directory names the last directory name in the full path,
e.g. turn “/usr/share/emacs/24.3/lisp/gnus” into “/usr/sha.../gnus”.

Maybe supporting a regexp property should be enough for such feature:

  (setq tabulated-list-format [("Process" 15 t)
                               ("PID"      7 t)
                               ("Status"   7 t)
                               ("Buffer"  15 t
                                :suffix-regexp "\\(<[0-9]+>\\)\\'"")
                               ("TTY"     12 t)
                               ("Command"  0 t)])





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#30016: Improve visibility of Process List
  2018-01-08  3:57 ` Eli Zaretskii
  2018-01-08 23:05   ` Juri Linkov
@ 2018-01-08 23:11   ` Juri Linkov
  2018-01-10 21:28     ` Juri Linkov
  2018-01-18 21:44   ` Juri Linkov
  2 siblings, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2018-01-08 23:11 UTC (permalink / raw)
  To: 30016

Meanwhile I propose another improvement for *Process List* displayed
on ‘C-x C-c’.  Currently it splits the frame side-by-side and displays
the process list far away from the minibuffer containing the question
“Active processes exist; kill them and exit anyway? (yes or no) ”

This patch will display the buffer *Process List* near the minibuffer
to allow easier inspection of the active processes and display the
process list with the full frame width that will help to also see
usually long command lines in their entirety:

diff --git a/lisp/files.el b/lisp/files.el
index 5b8dff7..e9f9cd1 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6917,8 +6917,17 @@ save-buffers-kill-emacs
                   (setq active t))
              (setq processes (cdr processes)))
            (or (not active)
-               (with-current-buffer-window
-                (get-buffer-create "*Process List*") nil
+               (with-displayed-buffer-window
+                (get-buffer-create "*Process List*")
+                `((display-buffer--maybe-same-window
+                   display-buffer-reuse-window
+                   display-buffer--maybe-pop-up-frame-or-window
+                   display-buffer-at-bottom)
+	          ,(if temp-buffer-resize-mode
+		       '(window-height . resize-temp-buffer-window)
+	             '(window-height . fit-window-to-buffer))
+	          ,(when temp-buffer-resize-mode
+	             '(preserve-size . (nil . t))))
                 #'(lambda (window _value)
                     (with-selected-window window
                       (unwind-protect





^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#30016: Improve visibility of Process List
  2018-01-08 23:11   ` Juri Linkov
@ 2018-01-10 21:28     ` Juri Linkov
  0 siblings, 0 replies; 10+ messages in thread
From: Juri Linkov @ 2018-01-10 21:28 UTC (permalink / raw)
  To: 30016

> Meanwhile I propose another improvement for *Process List* displayed
> on ‘C-x C-c’.  Currently it splits the frame side-by-side and displays
> the process list far away from the minibuffer containing the question
> “Active processes exist; kill them and exit anyway? (yes or no) ”
>
> This patch will display the buffer *Process List* near the minibuffer
> to allow easier inspection of the active processes and display the
> process list with the full frame width that will help to also see
> usually long command lines in their entirety:

Actually the same would be useful for *Local Variables* as well:

diff --git a/lisp/files.el b/lisp/files.el
index 5b8dff7..7194b56 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3315,7 +3315,15 @@ hack-local-variables-confirm
 
       ;; Display the buffer and read a choice.
       (save-window-excursion
-	(pop-to-buffer buf)
+	(pop-to-buffer buf `((display-buffer--maybe-same-window
+                              display-buffer-reuse-window
+                              display-buffer--maybe-pop-up-frame-or-window
+                              display-buffer-at-bottom)
+	                     ,(if temp-buffer-resize-mode
+		                  '(window-height . resize-temp-buffer-window)
+	                        '(window-height . fit-window-to-buffer))
+	                     ,(when temp-buffer-resize-mode
+	                        '(preserve-size . (nil . t)))))
 	(let* ((exit-chars '(?y ?n ?\s ?\C-g ?\C-v))
 	       (prompt (format "Please type %s%s: "
 			       (if offer-save "y, n, or !" "y or n")
@@ -6917,8 +6925,17 @@ save-buffers-kill-emacs
                   (setq active t))
              (setq processes (cdr processes)))
            (or (not active)
-               (with-current-buffer-window
-                (get-buffer-create "*Process List*") nil
+               (with-displayed-buffer-window
+                (get-buffer-create "*Process List*")
+                `((display-buffer--maybe-same-window
+                   display-buffer-reuse-window
+                   display-buffer--maybe-pop-up-frame-or-window
+                   display-buffer-at-bottom)
+	          ,(if temp-buffer-resize-mode
+		       '(window-height . resize-temp-buffer-window)
+	             '(window-height . fit-window-to-buffer))
+	          ,(when temp-buffer-resize-mode
+	             '(preserve-size . (nil . t))))
                 #'(lambda (window _value)
                     (with-selected-window window
                       (unwind-protect






^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#30016: Improve visibility of Process List
  2018-01-08 23:05   ` Juri Linkov
@ 2018-01-10 21:34     ` Juri Linkov
  2018-01-11 15:50       ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2018-01-10 21:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30016

>> Any hope of a more clever logic that would eliminate the need for
>> arbitrary limits?  Who can know whether there are other users of these
>> facilities which need even wider columns?  E.g., can we display
>> something like
>>
>>    *Async Sh...<1>
>>
>> i.e. make sure the numerical tail is shown?
>
> Yes, this would be the most universal solution.
> And this feature is also necessary in the *Buffer List*
> where *Async Shell Command* buffer names are truncated too.
>
> To support arbitrary formatting in ‘tabulated-list-format’ we could try
> to add a new column property that would allow specifying what suffix
> to leave in truncated columns.  For example, for buffer names it could
> leave the buffer name's unique suffix such as “*Async Sh...<1>”,
> or for directory names the last directory name in the full path,
> e.g. turn “/usr/share/emacs/24.3/lisp/gnus” into “/usr/sha.../gnus”.

It occurred to me that better would be to make tabulated-list columns
resizable.  So if the default column size truncates an important part,
the user could drag the column separator to make it wider, or use
a new key to resize the column, like ‘C-x {’ and ‘C-x }’ are used
to resize the window.

There is one problem: when ‘yes-or-no-p’ is replaced with ‘y-or-n-p’:

  (fset 'yes-or-no-p 'y-or-n-p)

in ~/.emacs it's impossible to switch to the *Process List* buffer
to do this.  Maybe “(y or n)” prompt should allow all standard keys
as in the “(yes or no)” prompt, but as a special case accepting
“y” or “n” without RET?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#30016: Improve visibility of Process List
  2018-01-10 21:34     ` Juri Linkov
@ 2018-01-11 15:50       ` Eli Zaretskii
  2018-01-11 21:49         ` Juri Linkov
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2018-01-11 15:50 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 30016

> From: Juri Linkov <juri@linkov.net>
> Cc: 30016@debbugs.gnu.org
> Date: Wed, 10 Jan 2018 23:34:53 +0200
> 
> It occurred to me that better would be to make tabulated-list columns
> resizable.  So if the default column size truncates an important part,
> the user could drag the column separator to make it wider, or use
> a new key to resize the column, like ‘C-x {’ and ‘C-x }’ are used
> to resize the window.

This could be a nice feature, but it cannot be the solution for the
problem at hand, because there are session without mice, where
dragging anything is impossible.

> There is one problem: when ‘yes-or-no-p’ is replaced with ‘y-or-n-p’:
> 
>   (fset 'yes-or-no-p 'y-or-n-p)
> 
> in ~/.emacs it's impossible to switch to the *Process List* buffer
> to do this.

What do you mean by "impossible"?  When I try switching to that
buffer, I'm not asked any questions at all, so how does yes-or-no-p
come into play here?





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#30016: Improve visibility of Process List
  2018-01-11 15:50       ` Eli Zaretskii
@ 2018-01-11 21:49         ` Juri Linkov
  2018-01-29 21:50           ` Juri Linkov
  0 siblings, 1 reply; 10+ messages in thread
From: Juri Linkov @ 2018-01-11 21:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30016

>> It occurred to me that better would be to make tabulated-list columns
>> resizable.  So if the default column size truncates an important part,
>> the user could drag the column separator to make it wider, or use
>> a new key to resize the column, like ‘C-x {’ and ‘C-x }’ are used
>> to resize the window.
>
> This could be a nice feature, but it cannot be the solution for the
> problem at hand, because there are session without mice, where
> dragging anything is impossible.

But please notice the part about a key sequence like ‘C-x {’ and ‘C-x }’
to resize columns like resizing windows.

>> There is one problem: when ‘yes-or-no-p’ is replaced with ‘y-or-n-p’:
>>
>>   (fset 'yes-or-no-p 'y-or-n-p)
>>
>> in ~/.emacs it's impossible to switch to the *Process List* buffer
>> to do this.
>
> What do you mean by "impossible"?  When I try switching to that
> buffer, I'm not asked any questions at all, so how does yes-or-no-p
> come into play here?

I meant when *Process List* is displayed on quitting with ‘C-x C-c’
where the minibuffer is active with the prompt “Active processes exist;
kill them and exit anyway?”  It allows switching buffers when an
expected answer is “yes/no”, but doesn't when “y/n”.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#30016: Improve visibility of Process List
  2018-01-08  3:57 ` Eli Zaretskii
  2018-01-08 23:05   ` Juri Linkov
  2018-01-08 23:11   ` Juri Linkov
@ 2018-01-18 21:44   ` Juri Linkov
  2 siblings, 0 replies; 10+ messages in thread
From: Juri Linkov @ 2018-01-18 21:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30016-done

>> diff --git a/lisp/simple.el b/lisp/simple.el
>> index 87e0b23..6e8930b 100644
>> --- a/lisp/simple.el
>> +++ b/lisp/simple.el
>> @@ -3927,7 +3927,7 @@ process-menu-mode
>>    (setq tabulated-list-format [("Process" 15 t)
>>  			       ("PID"      7 t)
>>  			       ("Status"   7 t)
>> -			       ("Buffer"  15 t)
>> +			       ("Buffer"  25 t)
>>  			       ("TTY"     12 t)
>>  			       ("Command"  0 t)])
>>    (make-local-variable 'process-menu-query-only)
>
> If we eventually decide to go with this simple change, there should be
> a comment explaining the value and its use case, and perhaps also a
> test for that.

I added a comment explaining the value and its use case.
With another change that makes its window wider to the frame's width
near the minibuffer, no useful information should be pushed out of sight.

Regarding displaying the column suffixes or making columns resizeable,
both are big tasks and could be implemented in a separate feature request.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* bug#30016: Improve visibility of Process List
  2018-01-11 21:49         ` Juri Linkov
@ 2018-01-29 21:50           ` Juri Linkov
  0 siblings, 0 replies; 10+ messages in thread
From: Juri Linkov @ 2018-01-29 21:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 30016

> I meant when *Process List* is displayed on quitting with ‘C-x C-c’
> where the minibuffer is active with the prompt “Active processes exist;
> kill them and exit anyway?”  It allows switching buffers when an
> expected answer is “yes/no”, but doesn't when “y/n”.

I forgot to let-bind pop-up-windows to nil like we do in other
similar places to disable window popping, but not frame popping:

diff --git a/lisp/files.el b/lisp/files.el
index 00622cf..460ed7a 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3314,7 +3314,13 @@ hack-local-variables-confirm
 
       ;; Display the buffer and read a choice.
       (save-window-excursion
-	(pop-to-buffer buf `((display-buffer--maybe-same-window
+	(let (
+              ;; Disable `pop-up-windows' temporarily to allow
+              ;; `display-buffer--maybe-pop-up-frame-or-window'
+              ;; in the display actions below to pop up a frame
+              ;; if `pop-up-frames' is non-nil, but not to pop up a window.
+              (pop-up-windows nil))
+        (pop-to-buffer buf `((display-buffer--maybe-same-window
                               display-buffer-reuse-window
                               display-buffer--maybe-pop-up-frame-or-window
                               display-buffer-at-bottom)
@@ -3322,7 +3328,7 @@ hack-local-variables-confirm
 		                  '(window-height . resize-temp-buffer-window)
 	                        '(window-height . fit-window-to-buffer))
 	                     ,(when temp-buffer-resize-mode
-	                        '(preserve-size . (nil . t)))))
+	                        '(preserve-size . (nil . t))))))
 	(let* ((exit-chars '(?y ?n ?\s ?\C-g ?\C-v))
 	       (prompt (format "Please type %s%s: "
 			       (if offer-save "y, n, or !" "y or n")
@@ -6924,6 +6930,12 @@ save-buffers-kill-emacs
                   (setq active t))
              (setq processes (cdr processes)))
            (or (not active)
+               (let (
+                     ;; Disable `pop-up-windows' temporarily to allow
+                     ;; `display-buffer--maybe-pop-up-frame-or-window'
+                     ;; in the display actions below to pop up a frame
+                     ;; if `pop-up-frames' is non-nil, but not to pop up a window.
+                     (pop-up-windows nil))
                (with-displayed-buffer-window
                 (get-buffer-create "*Process List*")
                 `((display-buffer--maybe-same-window
@@ -6943,7 +6955,7 @@ save-buffers-kill-emacs
                             (yes-or-no-p "Active processes exist; kill them and exit anyway? "))
                         (when (window-live-p window)
                           (quit-restore-window window 'kill)))))
-                (list-processes t)))))
+                (list-processes t))))))
      ;; Query the user for other things, perhaps.
      (run-hook-with-args-until-failure 'kill-emacs-query-functions)
      (or (null confirm)






^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-01-29 21:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-07 21:54 bug#30016: Improve visibility of Process List Juri Linkov
2018-01-08  3:57 ` Eli Zaretskii
2018-01-08 23:05   ` Juri Linkov
2018-01-10 21:34     ` Juri Linkov
2018-01-11 15:50       ` Eli Zaretskii
2018-01-11 21:49         ` Juri Linkov
2018-01-29 21:50           ` Juri Linkov
2018-01-08 23:11   ` Juri Linkov
2018-01-10 21:28     ` Juri Linkov
2018-01-18 21:44   ` Juri Linkov

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