Subject: 26.2; Calculator Trail display fuzziness

From: Rolf Ade <[email-masked]>
Date: Wed, 12 Aug 2020 11:36:33 +0200

By default, calc starts with the *Calc Trail* buffer displayed:

emacs -Q
M-x calc RET

There is a variable to customize this:

C-h v calc-display-trail RET

Though, things are not that simple and clear:

emacs -Q
C-x 3
M-x calc RET

doesn't display the *Calc Trail* buffer, although calc-display-trail has
the (default) value t.

There's this code in calc:

      (with-current-buffer (calc-trail-buffer)
        (and calc-display-trail
             (= (window-width) (frame-width))
             (calc-trail-display 1 t)))

Display of the *Calc Trail* buffer depends on calc-trail-display *and*
the window isn't splitted with split-window-right.

Nowadays we enjoy large Monitors. It's easily possible to have four
buffers displayed side by side each with a (window-width) > 80. I, for
example, use by default a frame-width of 180 and have plenty of room for
other windows left and right.

I don't see why I don't can see the Calculator trail even if the
(window-width) of the buffer has plenty of room for it. And emacs rates
displaying the Calculator Trail importantly enough displayed it by
default.

I suppose something like this would improve emacs behaviour in this
detail:

>From d259f101202d086a00b7906ff584015544cea702 Mon Sep 17 00:00:00 2001
From: Rolf Ade <[email-masked]>
Date: Wed, 12 Aug 2020 11:15:46 +0200
Subject: [PATCH] Suppress Calculator Trail only, if window is too small.

If the user want to see the Calculator Trail (calc-display-trail non
nil) suppress display of the Calculator Trail only if the window width
of the buffer is below the value of the new variable
calc-display-trail-threshold.
* lisp/calc/calc (calc): New Calculator Trail buffer display logic.

Copyright-paperwork-exempt: yes
---
 lisp/calc/calc.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 09b4962107..ad962e6b40 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -738,6 +738,9 @@ calc-window-height
 (defcalcmodevar calc-display-trail t
   "If non-nil, M-x calc creates a window to display Calculator trail.")
 
+(defcalcmodevar calc-display-trail-threshold 80
+  "Minimum windows width to display Calculator trail window.")
+
 (defcalcmodevar calc-show-selections t
   "If non-nil, selected sub-formulas are shown by obscuring rest of formula.
 If nil, selected sub-formulas are highlighted by obscuring the sub-formulas.")
@@ -1433,7 +1436,7 @@ calc
                 (pop-to-buffer (current-buffer)))))))
       (with-current-buffer (calc-trail-buffer)
         (and calc-display-trail
-             (= (window-width) (frame-width))
+             (>= (window-width) calc-display-trail-threshold)
              (calc-trail-display 1 t)))
       (message "Welcome to the GNU Emacs Calculator!  Press `?' or `h' for help, `q' to quit")
       (run-hooks 'calc-start-hook)
-- 
2.11.0