* bug#42337: [PATCH] Use display-buffer to make the calc popup
@ 2020-07-12 19:41 Viktor Obeling
2020-08-05 14:05 ` Lars Ingebrigtsen
0 siblings, 1 reply; 3+ messages in thread
From: Viktor Obeling @ 2020-07-12 19:41 UTC (permalink / raw)
To: 42337
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0001-Use-display-buffer-to-make-the-calc-popup.patch --]
[-- Type: text/x-patch, Size: 3030 bytes --]
From e18d2f85504669e24c9f060c5b36e14c60ba6957 Mon Sep 17 00:00:00 2001
From: Viktor Obeling <vpo@mon.localdomain>
Date: Sun, 12 Jul 2020 17:58:28 +0200
Subject: [PATCH] Use display-buffer to make the calc popup
* lisp/calc/calc.el (calc--popup-buffer, calc):
Allows the user to more easily customize the buffer placement by
using display-buffer-alist.
Copyright-paperwork-exempt: yes
---
lisp/calc/calc.el | 40 +++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 4e4fb67173..5f3b2877d3 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -1394,6 +1394,19 @@ calc-create-buffer
(require 'calc-ext)
(calc-set-language calc-language calc-language-option t)))
+(defun calc--popup-buffer (buffer alist)
+ "Action function for `display-buffer'."
+ (let ((w (get-largest-window)))
+ (when (and pop-up-windows
+ (> (window-height w)
+ (+ window-min-height calc-window-height 2)))
+ (setq w (split-window w
+ (- (window-height w)
+ calc-window-height 2)
+ nil))
+ (set-window-buffer w buffer)
+ (select-window w))))
+
;;;###autoload
(defun calc (&optional arg full-display interactive)
"The Emacs Calculator. Full documentation is listed under `calc-mode'."
@@ -1412,25 +1425,14 @@ calc
(calc-quit)
(calc-create-buffer)
(setq calc-was-keypad-mode nil)
- (if (or (eq full-display t)
- (and (null full-display) calc-full-mode))
- (switch-to-buffer (current-buffer) t)
- (if (get-buffer-window (current-buffer))
- (select-window (get-buffer-window (current-buffer)))
- (if calc-window-hook
- (run-hooks 'calc-window-hook)
- (let ((w (get-largest-window)))
- (if (and pop-up-windows
- (> (window-height w)
- (+ window-min-height calc-window-height 2)))
- (progn
- (setq w (split-window w
- (- (window-height w)
- calc-window-height 2)
- nil))
- (set-window-buffer w (current-buffer))
- (select-window w))
- (pop-to-buffer (current-buffer)))))))
+ (cond ((or (eq full-display t)
+ (and (null full-display) calc-full-mode))
+ (switch-to-buffer (current-buffer) t))
+ ((get-buffer-window (current-buffer))
+ (select-window (get-buffer-window (current-buffer))))
+ (calc-window-hook
+ (run-hooks 'calc-window-hook))
+ (t (pop-to-buffer (current-buffer) (cons #'calc--popup-buffer nil))))
(with-current-buffer (calc-trail-buffer)
(and calc-display-trail
(= (window-width) (frame-width))
--
2.26.2
[-- Attachment #2: Type: text/plain, Size: 19 bytes --]
--
Viktor Obeling
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#42337: [PATCH] Use display-buffer to make the calc popup
2020-07-12 19:41 bug#42337: [PATCH] Use display-buffer to make the calc popup Viktor Obeling
@ 2020-08-05 14:05 ` Lars Ingebrigtsen
2020-09-14 14:59 ` Lars Ingebrigtsen
0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-05 14:05 UTC (permalink / raw)
To: Viktor Obeling; +Cc: 42337
Viktor Obeling <viktor@obeling.org> writes:
> * lisp/calc/calc.el (calc--popup-buffer, calc):
> Allows the user to more easily customize the buffer placement by
> using display-buffer-alist.
I'm not super-familiar with how display-buffer-alist etc works these
days, but as far as I can tell, the patch looks sensible to me.
However, it's more than 15 lines long (even though much of it is
rearranging line), so to apply it, we'd need an FSF copyright
assignment. Would you be willing to sign that?
If so, here's the thing to get you started:
----
Please email the following information to assign@gnu.org, and we
will send you the assignment form for your past and future changes.
Please use your full legal name (in ASCII characters) as the subject
line of the message.
----------------------------------------------------------------------
REQUEST: SEND FORM FOR PAST AND FUTURE CHANGES
[What is the name of the program or package you're contributing to?]
Emacs
[Did you copy any files or text written by someone else in these changes?
Even if that material is free software, we need to know about it.]
[Do you have an employer who might have a basis to claim to own
your changes? Do you attend a school which might make such a claim?]
[For the copyright registration, what country are you a citizen of?]
[What year were you born?]
[Please write your email address here.]
[Please write your postal address here.]
[Which files have you changed so far, and which new files have you written
so far?]
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#42337: [PATCH] Use display-buffer to make the calc popup
2020-08-05 14:05 ` Lars Ingebrigtsen
@ 2020-09-14 14:59 ` Lars Ingebrigtsen
0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-14 14:59 UTC (permalink / raw)
To: Viktor Obeling; +Cc: 42337
Lars Ingebrigtsen <larsi@gnus.org> writes:
> However, it's more than 15 lines long (even though much of it is
> rearranging line), so to apply it, we'd need an FSF copyright
> assignment. Would you be willing to sign that?
That was five weeks ago, and there was no response, to I'm closing this
bug report. If progress can be made here, please respond to the debbugs
address and we'll reopen the bug report.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-14 14:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-12 19:41 bug#42337: [PATCH] Use display-buffer to make the calc popup Viktor Obeling
2020-08-05 14:05 ` Lars Ingebrigtsen
2020-09-14 14:59 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.