unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#44108: calc windows should be marked as dedicated
@ 2020-10-20 23:02 Boruch Baum
  2020-10-20 23:09 ` bug#44108: Needs to be performed whenever windows are created Boruch Baum
  2020-10-22  7:45 ` bug#44108: Patch for this bug Boruch Baum
  0 siblings, 2 replies; 7+ messages in thread
From: Boruch Baum @ 2020-10-20 23:02 UTC (permalink / raw)
  To: 44108

Windows that display calc buffers (ie. the stack buffer and the trail
buffer) are typically small-sized single-use windows, yet they are not
marked as dedicated. The consequence is that functions that perform
`pop-to-buffer' or `display-buffer' can use one of them as targets,
which will always be undesirable. A simple example, the one that
prompted this bug report, is when I was in a calc buffer and issued calc
command "u v" to display a 'units description' buffer. This is a long
and wide buffer, yet was displayed in the short and narrow calc trail
window. I vaguely recall having this also happen in the past with help
buffers, but was only motivated now to submit the report.

The solution is that when the calc and calc trail buffers are created,
they should be marked (set-window-dedicated-p)

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7'286 0036 9E45 1595 8BC0





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

* bug#44108: Needs to be performed whenever windows are created
  2020-10-20 23:02 bug#44108: calc windows should be marked as dedicated Boruch Baum
@ 2020-10-20 23:09 ` Boruch Baum
  2020-10-22  7:45 ` bug#44108: Patch for this bug Boruch Baum
  1 sibling, 0 replies; 7+ messages in thread
From: Boruch Baum @ 2020-10-20 23:09 UTC (permalink / raw)
  To: 44108

I need to elaborate on my initial report: people who use calc a lot will
be closing and re-opening windows used for the same calc buffers, so the
(set-window-dedicated-p) operation needs to be done at each window
creation event for calc and calc-trail windows, not at buffer creation
events.

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0





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

* bug#44108: Patch for this bug
  2020-10-20 23:02 bug#44108: calc windows should be marked as dedicated Boruch Baum
  2020-10-20 23:09 ` bug#44108: Needs to be performed whenever windows are created Boruch Baum
@ 2020-10-22  7:45 ` Boruch Baum
  2020-10-31  7:54   ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Boruch Baum @ 2020-10-22  7:45 UTC (permalink / raw)
  To: 44108

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

Attached.

--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0

[-- Attachment #2: calc-dedicated-windows.patch --]
[-- Type: text/x-diff, Size: 973 bytes --]

diff --git a/calc.el b/calc.el
index 4bebd5f..90dcce6 100644
--- a/calc.el
+++ b/calc.el
@@ -1472,6 +1472,7 @@ commands given here will actually operate on the *Calculator* stack."
       (and (windowp full-display)
            (window-point full-display)
            (select-window full-display))
+      (set-window-dedicated-p nil t)
       (calc-check-defines)
       (when (and calc-said-hello interactive)
         (sit-for 2)
@@ -2136,7 +2137,8 @@ the United States."
               (if calc-trail-window-hook
                   (run-hooks 'calc-trail-window-hook)
                 (let ((w (split-window nil (/ (* (window-width) 2) 3) t)))
-                  (set-window-buffer w calc-trail-buffer)))
+                  (set-window-buffer w calc-trail-buffer)
+                  (set-window-dedicated-p w t)))
               (calc-wrapper
                (setq overlay-arrow-string calc-trail-overlay
                      overlay-arrow-position calc-trail-pointer)

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

* bug#44108: Patch for this bug
  2020-10-22  7:45 ` bug#44108: Patch for this bug Boruch Baum
@ 2020-10-31  7:54   ` Eli Zaretskii
  2020-11-07  8:17     ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2020-10-31  7:54 UTC (permalink / raw)
  To: Boruch Baum; +Cc: 44108

> Date: Thu, 22 Oct 2020 03:45:09 -0400
> From: Boruch Baum <boruch_baum@gmx.com>
> 
> diff --git a/calc.el b/calc.el
> index 4bebd5f..90dcce6 100644
> --- a/calc.el
> +++ b/calc.el
> @@ -1472,6 +1472,7 @@ commands given here will actually operate on the *Calculator* stack."
>        (and (windowp full-display)
>             (window-point full-display)
>             (select-window full-display))
> +      (set-window-dedicated-p nil t)
>        (calc-check-defines)
>        (when (and calc-said-hello interactive)
>          (sit-for 2)
> @@ -2136,7 +2137,8 @@ the United States."
>                (if calc-trail-window-hook
>                    (run-hooks 'calc-trail-window-hook)
>                  (let ((w (split-window nil (/ (* (window-width) 2) 3) t)))
> -                  (set-window-buffer w calc-trail-buffer)))
> +                  (set-window-buffer w calc-trail-buffer)
> +                  (set-window-dedicated-p w t)))
>                (calc-wrapper
>                 (setq overlay-arrow-string calc-trail-overlay
>                       overlay-arrow-position calc-trail-pointer)

Thanks.

Would people who routinely use Calc please chime in and comment on
this?  Could this have some adverse consequences in some use cases?
Should we have a user option for controlling this behavior?





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

* bug#44108: Patch for this bug
  2020-10-31  7:54   ` Eli Zaretskii
@ 2020-11-07  8:17     ` Eli Zaretskii
  2020-11-07  8:59       ` martin rudalics
  2020-11-14 13:04       ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Eli Zaretskii @ 2020-11-07  8:17 UTC (permalink / raw)
  To: boruch_baum; +Cc: 44108

Ping!  Could someone please chime in?
If no comments are heard, I will push this change conditioned on a new
defcustom, in one week's time.

> Date: Sat, 31 Oct 2020 09:54:16 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 44108@debbugs.gnu.org
> 
> > Date: Thu, 22 Oct 2020 03:45:09 -0400
> > From: Boruch Baum <boruch_baum@gmx.com>
> > 
> > diff --git a/calc.el b/calc.el
> > index 4bebd5f..90dcce6 100644
> > --- a/calc.el
> > +++ b/calc.el
> > @@ -1472,6 +1472,7 @@ commands given here will actually operate on the *Calculator* stack."
> >        (and (windowp full-display)
> >             (window-point full-display)
> >             (select-window full-display))
> > +      (set-window-dedicated-p nil t)
> >        (calc-check-defines)
> >        (when (and calc-said-hello interactive)
> >          (sit-for 2)
> > @@ -2136,7 +2137,8 @@ the United States."
> >                (if calc-trail-window-hook
> >                    (run-hooks 'calc-trail-window-hook)
> >                  (let ((w (split-window nil (/ (* (window-width) 2) 3) t)))
> > -                  (set-window-buffer w calc-trail-buffer)))
> > +                  (set-window-buffer w calc-trail-buffer)
> > +                  (set-window-dedicated-p w t)))
> >                (calc-wrapper
> >                 (setq overlay-arrow-string calc-trail-overlay
> >                       overlay-arrow-position calc-trail-pointer)
> 
> Thanks.
> 
> Would people who routinely use Calc please chime in and comment on
> this?  Could this have some adverse consequences in some use cases?
> Should we have a user option for controlling this behavior?
> 
> 
> 
> 





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

* bug#44108: Patch for this bug
  2020-11-07  8:17     ` Eli Zaretskii
@ 2020-11-07  8:59       ` martin rudalics
  2020-11-14 13:04       ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: martin rudalics @ 2020-11-07  8:59 UTC (permalink / raw)
  To: Eli Zaretskii, boruch_baum; +Cc: 44108

 > Ping!  Could someone please chime in?
 > If no comments are heard, I will push this change conditioned on a new
 > defcustom, in one week's time.

IMHO _any_ use of dedicated windows in Emacs should be optional so a
defcustom is certainly a good idea.

Note that 'display-buffer' already processes a 'dedicated' action alist
entry so if 'calc' used it in this context, the option would already be
available now.

martin





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

* bug#44108: Patch for this bug
  2020-11-07  8:17     ` Eli Zaretskii
  2020-11-07  8:59       ` martin rudalics
@ 2020-11-14 13:04       ` Eli Zaretskii
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2020-11-14 13:04 UTC (permalink / raw)
  To: boruch_baum; +Cc: 44108-done

> Date: Sat, 07 Nov 2020 10:17:15 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: 44108@debbugs.gnu.org
> 
> Ping!  Could someone please chime in?
> If no comments are heard, I will push this change conditioned on a new
> defcustom, in one week's time.

Done.





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

end of thread, other threads:[~2020-11-14 13:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-20 23:02 bug#44108: calc windows should be marked as dedicated Boruch Baum
2020-10-20 23:09 ` bug#44108: Needs to be performed whenever windows are created Boruch Baum
2020-10-22  7:45 ` bug#44108: Patch for this bug Boruch Baum
2020-10-31  7:54   ` Eli Zaretskii
2020-11-07  8:17     ` Eli Zaretskii
2020-11-07  8:59       ` martin rudalics
2020-11-14 13:04       ` Eli Zaretskii

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