GNU bug report logs - #42337
[PATCH] Use display-buffer to make the calc popup

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Viktor Obeling <viktor@HIDDEN>; Keywords: patch; dated Sun, 12 Jul 2020 21:18:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 42337 <at> debbugs.gnu.org:


Received: (at 42337) by debbugs.gnu.org; 5 Aug 2020 14:05:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 05 10:05:57 2020
Received: from localhost ([127.0.0.1]:51880 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1k3K3I-0002nD-Ok
	for submit <at> debbugs.gnu.org; Wed, 05 Aug 2020 10:05:57 -0400
Received: from quimby.gnus.org ([95.216.78.240]:42220)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1k3K3H-0002mv-AP
 for 42337 <at> debbugs.gnu.org; Wed, 05 Aug 2020 10:05:55 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=G43Um+/5eqb1IOecFhqlgkl2A4QVBDYPw9NLLIFDIyQ=; b=mUnOpm9hN2xI1b+rHHaPIo1tdK
 TftWRMz6NazwMyFKBy/RzenysdsXBGbbPhxQZ/ufzjfE+6Wv8EXHy7qffWPgNgue1zJFrZ6oViYT3
 79C6LxKAFTJtq/QVLbtUaP4XnsLtDWvRYgunZr3uAxnaay2dJGfWo/JBaZMSChTe/9TI=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1k3K34-0005Vo-4V; Wed, 05 Aug 2020 16:05:48 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Viktor Obeling <viktor@HIDDEN>
Subject: Re: bug#42337: [PATCH] Use display-buffer to make the calc popup
References: <87a704cyhn.fsf@HIDDEN>
Date: Wed, 05 Aug 2020 16:05:40 +0200
In-Reply-To: <87a704cyhn.fsf@HIDDEN> (Viktor Obeling's message of
 "Sun, 12 Jul 2020 21:41:24 +0200")
Message-ID: <877dudkx1n.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Viktor Obeling <viktor@HIDDEN> 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. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 42337
Cc: 42337 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Viktor Obeling <viktor@HIDDEN> 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@HIDDEN, 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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#42337; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 12 Jul 2020 21:17:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jul 12 17:17:39 2020
Received: from localhost ([127.0.0.1]:46928 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jujLv-00021v-Bm
	for submit <at> debbugs.gnu.org; Sun, 12 Jul 2020 17:17:39 -0400
Received: from lists.gnu.org ([209.51.188.17]:46756)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <viktor@HIDDEN>) id 1juhrB-0008Eq-HR
 for submit <at> debbugs.gnu.org; Sun, 12 Jul 2020 15:41:50 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:47794)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <viktor@HIDDEN>)
 id 1juhrB-00033E-A1
 for bug-gnu-emacs@HIDDEN; Sun, 12 Jul 2020 15:41:49 -0400
Received: from mailrelay4-3.pub.mailoutpod1-cph3.one.com ([46.30.212.13]:60534)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <viktor@HIDDEN>)
 id 1juhr9-00080f-3S
 for bug-gnu-emacs@HIDDEN; Sun, 12 Jul 2020 15:41:49 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=obeling.org; s=20191106;
 h=content-type:mime-version:message-id:date:subject:to:from:from;
 bh=+T81VJTnGPRTIk62eV7gCWflJJRiBTgOadkxJvzg2wY=;
 b=PPIFZprWSZXuvTalR/VY9gdovU/iDruFAYU83bKTrdJcTMV8ckv1OTNpFkD1x8n5iBjRe1WpAAbiy
 3/EhGaH4NoavzdEBlxU554F4TEY7FaIzF4yfs0kZRuNZSHmfGJ0UfNXkEPcAeYQlPMx3ClZx7QWYaU
 WWo9095q48vdr5CLhNYTChYCWDu8WoWOG8rWqnmW03rvru2uS4NcOhjMx0JyBquVUCPtMvFvJxaZzh
 jqrA3CjMN8rhgGROx4Yrso0JnkQ8M16o0gE9gviqLqfvEqsYC8sAPMa/nm/zBqaiRpxrb4sYUMuH4w
 sdt6dWo1Av24epfbyBv3v86CSi/rEoQ==
X-HalOne-Cookie: edf67f1e9f41d2deb78065fae97051f7942121f2
X-HalOne-ID: abaecf5f-c477-11ea-9b1c-d0431ea8bb10
Received: from mon.localdomain (7-14-107-185.static.kviknet.dk [185.107.14.7])
 by mailrelay4.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA
 id abaecf5f-c477-11ea-9b1c-d0431ea8bb10;
 Sun, 12 Jul 2020 19:41:40 +0000 (UTC)
User-agent: mu4e 1.4.10; emacs 26.3
From: Viktor Obeling <viktor@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Use display-buffer to make the calc popup
Date: Sun, 12 Jul 2020 21:41:24 +0200
Message-ID: <87a704cyhn.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: none client-ip=46.30.212.13; envelope-from=viktor@HIDDEN;
 helo=mailrelay4-3.pub.mailoutpod1-cph3.one.com
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/12 15:41:40
X-ACL-Warn: Detected OS   = FreeBSD 9.x or newer [fuzzy]
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01,
 SPF_HELO_NONE=0.001, SPF_NONE=0.001,
 URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 12 Jul 2020 17:17:38 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=0001-Use-display-buffer-to-make-the-calc-popup.patch

From e18d2f85504669e24c9f060c5b36e14c60ba6957 Mon Sep 17 00:00:00 2001
From: Viktor Obeling <vpo@HIDDEN>
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


--=-=-=
Content-Type: text/plain


--
Viktor Obeling

--=-=-=--




Acknowledgement sent to Viktor Obeling <viktor@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#42337; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 5 Aug 2020 14:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.