From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Boruch Baum Newsgroups: gmane.emacs.bugs Subject: bug#43295: 26.1: calc-mode header line [UPDATED PATCH] Date: Thu, 10 Sep 2020 19:40:59 -0400 Message-ID: <20200910234058.nbeslitt52h5r2po@E15-2016.optimum.net> References: <20200909183127.oi3uhf6hmcswfkns@E15-2016.optimum.net> <87zh5x2tmc.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="iu5epvuds54qhji5" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38232"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: NeoMutt/20180716 Cc: 43295@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Sep 11 01:42:40 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kGWDA-0009qy-E0 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 11 Sep 2020 01:42:40 +0200 Original-Received: from localhost ([::1]:43734 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGWD9-00074u-A3 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 10 Sep 2020 19:42:39 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44902) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGWCZ-00074W-4g for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2020 19:42:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58368) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kGWCY-00046A-ML for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2020 19:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kGWCY-00066f-HN for bug-gnu-emacs@gnu.org; Thu, 10 Sep 2020 19:42:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Boruch Baum Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 10 Sep 2020 23:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43295 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed patch Original-Received: via spool by 43295-submit@debbugs.gnu.org id=B43295.159978127423409 (code B ref 43295); Thu, 10 Sep 2020 23:42:02 +0000 Original-Received: (at 43295) by debbugs.gnu.org; 10 Sep 2020 23:41:14 +0000 Original-Received: from localhost ([127.0.0.1]:41681 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGWBl-00065V-VY for submit@debbugs.gnu.org; Thu, 10 Sep 2020 19:41:14 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:44105) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGWBh-00065F-BL for 43295@debbugs.gnu.org; Thu, 10 Sep 2020 19:41:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1599781262; bh=dalQJIS1+ffl0++xzRscXAol2/P3W0/NGafH7/lZdA0=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=IEp7NoK4ikh/w9lcKqy4PCMS007yXtmzGUAF+FuslxmbV1WmVNghG71qsqNnhlyBz ZnluKcKog8ZhwqOsYxaQa8JEbfLRVE3xiBNibmJyIQ3SaJVHcOUS6uqRrUo0xHumGC 30FsApLa/ofSE5sxyjUSq39PCPqhdOgkpgAPccLM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from E15-2016.optimum.net ([72.89.170.172]) by mail.gmx.com (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MmULr-1kycJT1AdF-00iRNa; Fri, 11 Sep 2020 01:41:02 +0200 Content-Disposition: inline In-Reply-To: <87zh5x2tmc.fsf@gnus.org> X-Provags-ID: V03:K1:co8+vava7UmUq5YeXPq+j/nPVIDHNmzWZGzcoUuEVZi5bupD/T9 3zY6xAlDwQnfKYu/c64J8VZn/n9c9C+zLuwRztTEmeoA75C+J84xx1Fp3sHwngnfMGYbKoM wsTBukZxz2XpzoaiCSj88gGEzzFmHQQm9ihclmJNpL3o+idIzTM8DUVXTdT7Ew2Oi4H/qX5 P6SDzl/Ds1G76kocq1k9A== X-UI-Out-Filterresults: notjunk:1;V03:K0:mxOvax/Pn5Y=:2oJhYzadBf4MO/AYGdWC+5 +wcOgnMzonR926xxechgkaKFPHG35UrcHBwXEuNbmEiiUWapIH2wolKDUKWEOqcq3ZY+Y59IL wI5ciEmHu5plTlMSoADCqTVk8GHhxzu1ToErQC/Gu7XNvsGqOCLckJpdTZqn3QBSZvtUyLAfb cpOFTDCSUeqo1SIXMWQn+HRzAZNxDq0D2f0zCMg0JCpC4vGfsxlrXNOFhjCFL2mktVvqGKoWj Xy5U1yYM1geeRTYaMp6oQ/CfqTx/TsgJc9DSuKwdFUdSxHAbYppe867hNNiVEg8MP6S2awGBl 5c0b4iKPrJrbR1gbu04MVMsROA8CClsvcoZNRY79BToHt9CLTD3WBSC9ZUXbQogNn80aglCwT aIplAyhzLay5mkwcc/BSuv88sSn4UvNjTuktzey1ofefNCRP9RjDoCJZjzu4SC6CMULLqsHqg 6qIK3flCTW7S9eypZ0Gx19kKw1Pc5Ft+SV9nBw5+Ql5Aek3bK9ZVjuEFT8UHIT76AQANutRNa i2zqdB7p5kT0evJLAhLJHdVKtVsXtZCEKr5pbVORlw6DWyRtbv+XV8Aj5XxLPvdr3+XtdqluB 2MKPljb/zQAhXgKGkhQe86SBHaUFuhOyakNeVMjNe+H1C81dHeyYp8mKTKsihoZ0+EL2OLnzj 9jDj4ApmAAzPA9JvAcRQFAhg6xtxEGifWes2+s7aZpaqEnhBrp1+Zy7e9A9K6HyG24H3Qrzmu oio4vcHPTsSOEQiChRNjMfTnJqucDxknQwoEWAzLKm/DFGlrhmPe3R8LR7aW69gc3NH0xECq X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:187783 Archived-At: --iu5epvuds54qhji5 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2020-09-10 23:45, Lars Ingebrigtsen wrote: > Thanks; I applied it to Emacs 28, but it needed some changes because it > didn't apply cleanly (and it didn't set the header in the main calc > buffer?) But it looks like it works now, at least, but you should > perhaps take a look at the result and see whether it looks like you > imagined... I see a few things. Here are some comments, with reference to a new patch, attached, which is a diff based upon the savannah-git (my calc28.el). 1) I notice that I had forgotten to remove two lines of coding notes to myself @lines ~1395. They can be removed. 2) You removed two lines I had @lines ~1428, and copied a modified version of them to @lines ~2008. I think the absence of the two lines ~1428 may be cause the problem that you mentioned. 3) I see an additional problem with your modification to the patch that you'll notice upon starting calc with a very narrow window. Your line ~2009 reads (* 2 (/ (window-width) 3)) -3)) which is code for the trail buffer, but it should be for the main buffer, like in my line ~1429 + (/ (* (window-width) 2) 3) 1) 3) If you modify ~2009, then that snippet might be redundant together with my snippet ~1428, but it shouldn't do any harm (but remove the comment line 'Added by Lars?'). 4) You also did something that I welcome, but that was done at Eli Zaretskii's insistence, so you may want to co-ordinate with him about it. My very original patch looked like your final result @line ~1419, but Eli on-list insisted that was wrong on the basis of 'breaking backw= ard compatibility', because in the old behavior, the trail buffer always had a title line inside the buffer even when calc-show-banner was NIL. My position was that's a bug. That part should really read (modife= d from my original): (if calc-show-banner (calc--header-line "Emacs Calculator Trail" "Calc Trail" (/ (window-width) 3) -3) (when (zerop (buffer-size)) (let ((buffer-read-only nil)) (insert (propertize "Emacs Calculator Trail\n" 'face 'italic)))))) =2D- hkp://keys.gnupg.net CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0 --iu5epvuds54qhji5 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="calc28.patch" --- /home/optimum/calc28.el 2020-09-10 18:57:51.000000000 -0400 +++ /home/optimum/calc28-new.el 2020-09-10 18:55:01.360827855 -0400 @@ -1396,8 +1396,6 @@ (let* ((len-long (length long)) (len-short (length short)) (fudge (or fudge 0)) - ;; fudge for trail is: -3 (added to len-long) - ;; (width ) for trail (factor (if (> width (+ len-long fudge)) len-long len-short)) (size (/ (- width factor) 2)) (fill (make-string size ?-)) @@ -1428,6 +1426,9 @@ (set-buffer (get-buffer-create "*Calculator*")) (or (derived-mode-p 'calc-mode) (calc-mode)) + (when calc-show-banner + (calc--header-line "Emacs Calculator Mode" "Emacs Calc" + (/ (* (window-width) 2) 3) 1)) (setq max-lisp-eval-depth (max max-lisp-eval-depth 1000)) (when calc-always-load-extensions (require 'calc-ext)) @@ -2008,6 +2009,7 @@ (calc-any-evaltos nil)) (setq calc-any-selections nil) (erase-buffer) +;; Added by Lars? (when calc-show-banner (calc--header-line "Emacs Calculator Mode" "Emacs Calc" (* 2 (/ (window-width) 3)) -3)) --iu5epvuds54qhji5--