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: Sat, 12 Sep 2020 20:43:24 -0400 [thread overview]
Message-ID: <20200913004324.pwpzxe74zq7sqr74@E15-2016.optimum.net> (raw)
In-Reply-To: <878sdgzeze.fsf@gnus.org>
[-- Attachment #1: Type: text/plain, Size: 512 bytes --]
On 2020-09-11 14:15, Lars Ingebrigtsen wrote:
> Could you send a new patch that has all the changes that you want that I
> can just apply? Adding discussion into the patch itself isn't very
> helpful. :-)
In the attached patch:
1) the hunk @1421 restores the behavior that Eli wants
2) the hunk @2010 corrects the width calculation in that case
3) the hunk @2133 better handles the header line for the trail display
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
[-- Attachment #2: calc-003.patch --]
[-- Type: text/x-diff, Size: 3495 bytes --]
--- /home/optimum/calc.el 2020-09-11 15:58:55.263774535 -0400
+++ ./calc.el 2020-09-11 13:21:07.485259155 -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 ?-))
@@ -1421,13 +1419,22 @@
(make-local-variable 'overlay-arrow-string)
(when calc-show-banner
(calc--header-line "Emacs Calculator Trail" "Calc Trail"
- (/ (window-width) 3) -3)))
+ (/ (window-width) 3) -3))
+ (when (zerop (buffer-size))
+ (let ((buffer-read-only nil))
+ (insert (propertize "Emacs Calculator Trail\n" 'face 'italic)))))
(defun calc-create-buffer ()
"Create and initialize a buffer for the Calculator."
(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"
+ (if calc-display-trail
+ (/ (* (window-width) 2) 3)
+ (window-width))
+ 1))
(setq max-lisp-eval-depth (max max-lisp-eval-depth 1000))
(when calc-always-load-extensions
(require 'calc-ext))
@@ -2010,7 +2017,7 @@
(erase-buffer)
(when calc-show-banner
(calc--header-line "Emacs Calculator Mode" "Emacs Calc"
- (* 2 (/ (window-width) 3)) -3))
+ (window-width) 1))
(while thing
(goto-char (point-min))
(insert (math-format-stack-value (car thing)) "\n")
@@ -2133,29 +2140,32 @@
(defun calc-trail-display (flag &optional no-refresh interactive)
(interactive "P\ni\np")
(let ((win (get-buffer-window (calc-trail-buffer))))
- (if (setq calc-display-trail
+ (cond
+ ((setq calc-display-trail
(not (if flag (memq flag '(nil 0)) win)))
- (if (null win)
- (progn
+ (when (null win)
(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)))
+ (setq win (split-window nil (/ (* (window-width) 2) 3) t))
+ (set-window-buffer win calc-trail-buffer))
(calc-wrapper
(setq overlay-arrow-string calc-trail-overlay
overlay-arrow-position calc-trail-pointer)
(or no-refresh
(if interactive
(calc-do-refresh)
- (calc-refresh))))))
- (if win
- (progn
+ (calc-refresh)))))
+ (with-current-buffer calc-trail-buffer
+ (when calc-show-banner
+ (calc--header-line "Emacs Calculator Trail" "Calc Trail"
+ (window-width win) -3))))
+ (win ; not calc-display-trail
(delete-window win)
(calc-wrapper
(or no-refresh
(if interactive
(calc-do-refresh)
- (calc-refresh))))))))
+ (calc-refresh)))))))
calc-trail-buffer)
(defun calc-trail-here ()
next prev parent reply other threads:[~2020-09-13 0:43 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
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 [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200913004324.pwpzxe74zq7sqr74@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 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.