* `calc-show-banner'
@ 2002-05-29 6:06 Miles Bader
2002-05-29 7:32 ` `calc-show-banner' Colin Walters
0 siblings, 1 reply; 2+ messages in thread
From: Miles Bader @ 2002-05-29 6:06 UTC (permalink / raw)
Cc: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 666 bytes --]
Hi Colin,
What do you think of the following patch? I added a variable to control
whether calc displays `--- Emacs Calculator Mode ---' above the stack or
not (it seems useless to me, so I don't want to waste the space).
It seems to work OK, based on my um, light testing, but I'm not sure
whether there are additional places that need to be tweaked or not, or
whether I fit it into calc in the best way.
Also, the patch makes a binding to toggle the banner display (`d @' --
couldn't find many unbound keys!), but I'm not sure if it's worth it to
have a command at all, or whether it should just be a .emacs-only variable.
Thanks,
-Miles
Here's the patch:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch to make calc's banner-line optional --]
[-- Type: text/x-patch, Size: 3246 bytes --]
2002-05-29 Miles Bader <miles@gnu.org>
* calc/calc.el (calc-show-banner): New variable.
(calc-refresh): Only show banner if `calc-show-banner' is non-nil.
(calc-mode-var-list): Add `calc-show-banner'.
* calc/calc-ext.el (calc-init-extensions): Add binding for `d@'.
(calc-toggle-banner): New function.
Index: lisp/calc/calc.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calc/calc.el,v
retrieving revision 1.12
diff -u -r1.12 calc.el
--- lisp/calc/calc.el 14 Apr 2002 05:50:05 -0000 1.12
+++ lisp/calc/calc.el 29 May 2002 05:58:16 -0000
@@ -249,6 +249,9 @@
;; Entries are 3-lists: Formula, Height (in lines), Selection (or nil).
(defvar calc-stack '((top-of-stack 1 nil)))
+(defvar calc-show-banner t
+ "*If non-nil, show a friendly greeting above the stack.")
+
;; Index into calc-stack of "top" of stack.
;; This is 1 unless calc-truncate-stack has been used.
;;(defvar calc-stack-top 1)
@@ -581,7 +584,8 @@
(calc-gnuplot-geometry nil)
(calc-graph-default-resolution 15)
(calc-graph-default-resolution-3d 5)
- (calc-invocation-macro nil)))
+ (calc-invocation-macro nil)
+ (calc-show-banner t)))
(defconst calc-local-var-list '(calc-stack
calc-stack-top
@@ -1702,10 +1706,12 @@
(setq calc-any-selections nil
calc-any-evaltos nil)
(erase-buffer)
- (insert "--- Emacs Calculator Mode ---\n")
+ (when calc-show-banner
+ (insert "--- Emacs Calculator Mode ---\n"))
(while thing
(goto-char (point-min))
- (forward-line 1)
+ (when calc-show-banner
+ (forward-line 1))
(insert (math-format-stack-value (car thing)) "\n")
(setq thing (cdr thing)))
(calc-renumber-stack)
Index: lisp/calc/calc-ext.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/calc/calc-ext.el,v
retrieving revision 1.9
diff -u -r1.9 calc-ext.el
--- lisp/calc/calc-ext.el 26 Feb 2002 19:54:21 -0000 1.9
+++ lisp/calc/calc-ext.el 29 May 2002 05:58:13 -0000
@@ -1,6 +1,6 @@
;;; calc-ext.el --- various extension functions for Calc
-;; Copyright (C) 1990, 1991, 1992, 1993, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1991, 1992, 1993, 2001, 2002 Free Software Foundation, Inc.
;; Author: David Gillespie <daveg@synaptics.com>
;; Maintainer: Colin Walters <walters@debian.org>
@@ -250,6 +250,7 @@
(define-key calc-mode-map "d'" 'calc-display-raw)
(define-key calc-mode-map "d " 'calc-refresh)
(define-key calc-mode-map "d\r" 'calc-refresh-top)
+ (define-key calc-mode-map "d@" 'calc-toggle-banner)
(define-key calc-mode-map "f" nil)
(define-key calc-mode-map "f?" 'calc-f-prefix-help)
@@ -1489,6 +1490,11 @@
(if calc-embedded-info (calc-embedded-modes-change var))
(symbol-value (car var)))))
+(defun calc-toggle-banner ()
+ (interactive)
+ (setq calc-show-banner (not calc-show-banner))
+ (calc-refresh))
+
(defun calc-refresh-top (n)
(interactive "p")
(calc-wrapper
@@ -1533,7 +1539,6 @@
(setq num (1- num)))))
(and calc-embedded-active which-var
(calc-embedded-var-change which-var)))
-
(defun calc-push (&rest vals)
(calc-push-list vals))
[-- Attachment #3: Type: text/plain, Size: 88 bytes --]
--
A zen-buddhist walked into a pizza shop and
said, "Make me one with everything."
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: `calc-show-banner'
2002-05-29 6:06 `calc-show-banner' Miles Bader
@ 2002-05-29 7:32 ` Colin Walters
0 siblings, 0 replies; 2+ messages in thread
From: Colin Walters @ 2002-05-29 7:32 UTC (permalink / raw)
On Wed, 2002-05-29 at 02:06, Miles Bader wrote:
> Hi Colin,
>
> What do you think of the following patch? I added a variable to control
> whether calc displays `--- Emacs Calculator Mode ---' above the stack or
> not (it seems useless to me, so I don't want to waste the space).
It looks good to me. Please go ahead and install your patch.
> Also, the patch makes a binding to toggle the banner display (`d @' --
> couldn't find many unbound keys!), but I'm not sure if it's worth it to
> have a command at all, or whether it should just be a .emacs-only variable.
I suspect that few people will use the command, but if you find it
useful I have no objections to it. If you do add it, could you add an
entry in the manual too? (And maybe even a docstring if you feel like
bucking the general trend in calc-ext.el :) )
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-05-29 7:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-29 6:06 `calc-show-banner' Miles Bader
2002-05-29 7:32 ` `calc-show-banner' Colin Walters
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.