]> git.eshelyaron.com Git - emacs.git/commitdiff
Make Calc windows dedicated by default
authorEli Zaretskii <eliz@gnu.org>
Sat, 14 Nov 2020 13:02:13 +0000 (15:02 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 14 Nov 2020 13:02:13 +0000 (15:02 +0200)
* lisp/calc/calc.el (calc-make-windows-dedicated): New defcustom.
(calc, calc-trail-display): Set Calc windows dedicated if
calc-make-windows-dedicated is non-nil.  Patch by Boruch Baum
<boruch_baum@gmx.com>.  (Bug#44108)

* etc/NEWS (Calc): Announce the new behavior.

etc/NEWS
lisp/calc/calc.el

index f21c4cb02cfa0a6431477e4f5d322e420e8a59e5..0f7b64ddd16ed29e0cb1d9d1a6d329805f496dd0 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1250,6 +1250,11 @@ and the result is not truncated in any way.
 *** The '/' operator now has higher precedence in (La)TeX input mode.
 It no longer has lower precedence than '+' and '-'.
 
+---
+*** Calc now marks its windows dedicated.
+The new user option 'calc-make-windows-dedicated' controls this.  It
+is t by default; set to nil to get back the old behavior.
+
 ** term-mode
 
 ---
index bde7bd4e2bdbe35e700d8e2d0e554e959b7a2b93..5716189b34299ea567f7a64f953f363600486878 100644 (file)
@@ -1435,6 +1435,12 @@ commands given here will actually operate on the *Calculator* stack."
     (require 'calc-ext)
     (calc-set-language calc-language calc-language-option t)))
 
+(defcustom calc-make-windows-dedicated t
+  "If non-nil, windows displaying Calc buffers will be marked dedicated.
+See `window-dedicated-p' for what that means."
+  :version "28.1"
+  :type 'boolean)
+
 ;;;###autoload
 (defun calc (&optional arg full-display interactive)
   "The Emacs Calculator.  Full documentation is listed under `calc-mode'."
@@ -1480,6 +1486,8 @@ commands given here will actually operate on the *Calculator* stack."
       (and (windowp full-display)
            (window-point full-display)
            (select-window full-display))
+      (and calc-make-windows-dedicated
+           (set-window-dedicated-p nil t))
       (calc-check-defines)
       (when (and calc-said-hello interactive)
         (sit-for 2)
@@ -2140,7 +2148,9 @@ 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)
+                  (and calc-make-windows-dedicated
+                       (set-window-dedicated-p nil t))))
               (calc-wrapper
                (setq overlay-arrow-string calc-trail-overlay
                      overlay-arrow-position calc-trail-pointer)