From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: `calc-show-banner' Date: 29 May 2002 15:06:30 +0900 Sender: emacs-devel-admin@gnu.org Message-ID: Reply-To: Miles Bader NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1022652529 16747 127.0.0.1 (29 May 2002 06:08:49 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 29 May 2002 06:08:49 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17Cwdc-0004M0-00 for ; Wed, 29 May 2002 08:08:48 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17Cwvn-0003kJ-00 for ; Wed, 29 May 2002 08:27:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17Cwe5-0002EK-00; Wed, 29 May 2002 02:09:17 -0400 Original-Received: from [210.143.35.56] (helo=TYO202.gate.nec.co.jp) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 17Cwbe-00029L-00; Wed, 29 May 2002 02:06:46 -0400 Original-Received: from mailgate4.nec.co.jp ([10.7.69.197]) by TYO202.gate.nec.co.jp (8.11.6/3.7W01080315) with ESMTP id g4T66fJ13660; Wed, 29 May 2002 15:06:41 +0900 (JST) Original-Received: from mailsv.nec.co.jp (mailgate51.nec.co.jp [10.7.69.196]) by mailgate4.nec.co.jp (8.11.6/3.7W-MAILGATE-NEC) with ESMTP id g4T66eR23961; Wed, 29 May 2002 15:06:40 +0900 (JST) Original-Received: from mcsss2.ucom.lsi.nec.co.jp ([10.30.114.133]) by mailsv.nec.co.jp (8.11.6/3.7W-MAILSV-NEC) with ESMTP id g4T66Wu23415; Wed, 29 May 2002 15:06:38 +0900 (JST) Original-Received: from mcspd15.ucom.lsi.nec.co.jp (mcspd15 [10.30.114.174]) by mcsss2.ucom.lsi.nec.co.jp (8.10.2+Sun/3.7Wlsi_mx_6.0) with ESMTP id g4T66VK19554; Wed, 29 May 2002 15:06:31 +0900 (JST) Original-Received: by mcspd15.ucom.lsi.nec.co.jp (Postfix, from userid 31295) id 506A23722; Wed, 29 May 2002 15:06:30 +0900 (JST) Original-To: Colin Walters System-Type: i686-pc-linux-gnu Blat: Foop Original-Lines: 29 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:4471 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:4471 --=-=-= 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: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=calc-banner-0.patch Content-Description: Patch to make calc's banner-line optional 2002-05-29 Miles Bader * 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 ;; Maintainer: Colin Walters @@ -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)) --=-=-= -- A zen-buddhist walked into a pizza shop and said, "Make me one with everything." --=-=-=--