unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50716: 28.0.50; whitespace-report does not use existing windows
@ 2021-09-21  5:07 Gabriel
  2021-09-21  5:30 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Gabriel @ 2021-09-21  5:07 UTC (permalink / raw)
  To: 50716

Description:
The command 'whitespace-report' does not using existing windows, so
every new invocation opens a new window at bottom. This behavior is
different from how other emacs commands handle windows. I expect
'whitespace-report' to behave similarly to other commands (e.g.:
'describe-variable', 'memory-report', etc). The problem seems to be on
'whitespace-display-window'.

Steps to reproduce:
1) 'emacs -Q' from master branch
2) M-x 'whitespace-report'
3) 'C-x o' to move to "*Whitespace Report*" buffer
4) 'C-x k RET' to kill the "*Whitespace Report*" buffer
5) Repeat steps 2-4 multiple times

--
        Gabriel





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

* bug#50716: 28.0.50; whitespace-report does not use existing windows
  2021-09-21  5:07 bug#50716: 28.0.50; whitespace-report does not use existing windows Gabriel
@ 2021-09-21  5:30 ` Lars Ingebrigtsen
  2021-09-21  8:35   ` martin rudalics
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-21  5:30 UTC (permalink / raw)
  To: Gabriel; +Cc: 50716

Gabriel <gabriel376@hotmail.com> writes:

> The command 'whitespace-report' does not using existing windows, so
> every new invocation opens a new window at bottom. This behavior is
> different from how other emacs commands handle windows. I expect
> 'whitespace-report' to behave similarly to other commands (e.g.:
> 'describe-variable', 'memory-report', etc). The problem seems to be on
> 'whitespace-display-window'.

Yup.  Fixed now in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#50716: 28.0.50; whitespace-report does not use existing windows
  2021-09-21  5:30 ` Lars Ingebrigtsen
@ 2021-09-21  8:35   ` martin rudalics
  2021-09-21 16:55     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: martin rudalics @ 2021-09-21  8:35 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Gabriel; +Cc: 50716

@@ -1839,13 +1839,8 @@ cleaning up these problems."
    "Display BUFFER in a new window."
    (goto-char (point-min))
    (set-buffer-modified-p nil)
-  (when (< (window-height) (* 2 window-min-height))
-    (kill-buffer buffer)
-    (error "Window height is too small; \
-can't split window to display whitespace toggle options"))
-  (let ((win (split-window)))
-    (set-window-buffer win buffer)
-    (shrink-window-if-larger-than-buffer win)))
+  (pop-to-buffer buffer)
+  (shrink-window-if-larger-than-buffer))

I think this needs a new doc-string and the last two lines should
probably become something like

(let ((window (display-buffer
	       buffer
	       `((display-buffer-reuse-window
		  display-buffer-below-selected)))))
   (shrink-window-if-larger-than-buffer window))

since the original code did not select the window and tried to show it
below the selected one.

martin





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

* bug#50716: 28.0.50; whitespace-report does not use existing windows
  2021-09-21  8:35   ` martin rudalics
@ 2021-09-21 16:55     ` Lars Ingebrigtsen
  2021-09-22  7:49       ` martin rudalics
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-21 16:55 UTC (permalink / raw)
  To: martin rudalics; +Cc: Gabriel, 50716

martin rudalics <rudalics@gmx.at> writes:

> I think this needs a new doc-string and the last two lines should
> probably become something like
>
> (let ((window (display-buffer
> 	       buffer
> 	       `((display-buffer-reuse-window
> 		  display-buffer-below-selected)))))
>   (shrink-window-if-larger-than-buffer window))
>
> since the original code did not select the window and tried to show it
> below the selected one.

Thanks; pushed now to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#50716: 28.0.50; whitespace-report does not use existing windows
  2021-09-21 16:55     ` Lars Ingebrigtsen
@ 2021-09-22  7:49       ` martin rudalics
  2021-09-22 20:02         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: martin rudalics @ 2021-09-22  7:49 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Gabriel, 50716

-  "Display BUFFER in a new window."

Why did you drop the doc-string?

martin





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

* bug#50716: 28.0.50; whitespace-report does not use existing windows
  2021-09-22  7:49       ` martin rudalics
@ 2021-09-22 20:02         ` Lars Ingebrigtsen
  2021-09-23  8:16           ` martin rudalics
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-22 20:02 UTC (permalink / raw)
  To: martin rudalics; +Cc: Gabriel, 50716

martin rudalics <rudalics@gmx.at> writes:

> -  "Display BUFFER in a new window."
>
> Why did you drop the doc-string?

It's an internal function that has a function name that's descriptive
enough, so the doc string seems superfluous.  If you disagree, feel free
to add a new one.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#50716: 28.0.50; whitespace-report does not use existing windows
  2021-09-22 20:02         ` Lars Ingebrigtsen
@ 2021-09-23  8:16           ` martin rudalics
  0 siblings, 0 replies; 7+ messages in thread
From: martin rudalics @ 2021-09-23  8:16 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Gabriel, 50716

 > It's an internal function that has a function name that's descriptive
 > enough,

Incidentally that function name is quite misleading - we do not display
"windows" but "buffers".

 > so the doc string seems superfluous.  If you disagree, feel free
 > to add a new one.

Done.

martin





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

end of thread, other threads:[~2021-09-23  8:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21  5:07 bug#50716: 28.0.50; whitespace-report does not use existing windows Gabriel
2021-09-21  5:30 ` Lars Ingebrigtsen
2021-09-21  8:35   ` martin rudalics
2021-09-21 16:55     ` Lars Ingebrigtsen
2021-09-22  7:49       ` martin rudalics
2021-09-22 20:02         ` Lars Ingebrigtsen
2021-09-23  8:16           ` martin rudalics

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