Make Calc windows dedicated by default

* 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.
This commit is contained in:
Eli Zaretskii 2020-11-14 15:02:13 +02:00
parent 29a59aad1c
commit ca023e69e2
2 changed files with 16 additions and 1 deletions

View file

@ -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
---

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