unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Boruch Baum <boruch_baum@gmx.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 43295@debbugs.gnu.org
Subject: bug#43295: 26.1: calc-mode header line [UPDATED PATCH]
Date: Thu, 10 Sep 2020 19:40:59 -0400	[thread overview]
Message-ID: <20200910234058.nbeslitt52h5r2po@E15-2016.optimum.net> (raw)
In-Reply-To: <87zh5x2tmc.fsf@gnus.org>

[-- Attachment #1: Type: text/plain, Size: 2289 bytes --]

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 backward
   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 (modifed
   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))))))


--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0

[-- Attachment #2: calc28.patch --]
[-- Type: text/x-diff, Size: 1224 bytes --]

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

  reply	other threads:[~2020-09-10 23:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 18:31 bug#43295: 26.1: calc-mode header line [UPDATED PATCH] Boruch Baum
2020-09-10 21:45 ` Lars Ingebrigtsen
2020-09-10 23:40   ` Boruch Baum [this message]
2020-09-11 12:15     ` Lars Ingebrigtsen
2020-09-11 13:37       ` Boruch Baum
2020-09-11 13:55         ` Eli Zaretskii
2020-09-13  0:43       ` Boruch Baum
2020-09-13 13:15         ` Lars Ingebrigtsen
2020-09-13 14:54           ` Boruch Baum
2020-09-13 14:56             ` Lars Ingebrigtsen
2020-09-13 15:03             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200910234058.nbeslitt52h5r2po@E15-2016.optimum.net \
    --to=boruch_baum@gmx.com \
    --cc=43295@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).