From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: nljlistbox2@gmail.com (N. Jackson) Newsgroups: gmane.emacs.bugs Subject: bug#20764: 25.0.50; Minor improvements for calculator.el Date: Wed, 17 Jun 2015 10:43:40 -0300 Message-ID: <87twu6h2lv.fsf@moondust.localdomain> References: <20150608.023951.324799427836228432.chriszheng99@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1434548674 899 80.91.229.3 (17 Jun 2015 13:44:34 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Jun 2015 13:44:34 +0000 (UTC) Cc: 20764@debbugs.gnu.org To: Chris Zheng Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 17 15:44:24 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z5Dda-0000lq-AV for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Jun 2015 15:44:18 +0200 Original-Received: from localhost ([::1]:46990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5DdY-0008V6-S2 for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Jun 2015 09:44:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5DdP-0008Pq-MK for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2015 09:44:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z5DdL-0008CV-AR for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2015 09:44:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:42570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5DdL-0008CQ-7x for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2015 09:44:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Z5DdK-0007bz-Uq for bug-gnu-emacs@gnu.org; Wed, 17 Jun 2015 09:44:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: nljlistbox2@gmail.com (N. Jackson) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Jun 2015 13:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20764 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 20764-submit@debbugs.gnu.org id=B20764.143454863229234 (code B ref 20764); Wed, 17 Jun 2015 13:44:02 +0000 Original-Received: (at 20764) by debbugs.gnu.org; 17 Jun 2015 13:43:52 +0000 Original-Received: from localhost ([127.0.0.1]:57030 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5Dd9-0007bR-AO for submit@debbugs.gnu.org; Wed, 17 Jun 2015 09:43:52 -0400 Original-Received: from mail-qk0-f180.google.com ([209.85.220.180]:35946) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z5Dd6-0007bA-MY for 20764@debbugs.gnu.org; Wed, 17 Jun 2015 09:43:49 -0400 Original-Received: by qkfe185 with SMTP id e185so26209721qkf.3 for <20764@debbugs.gnu.org>; Wed, 17 Jun 2015 06:43:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=gcvUbq10DzVCHocWnU/ogf68zPEyXYYW2mViGKeGMLc=; b=udh9rKLovEMkKpIo+bo9LipKlJwAc1J1rOx3ydV9cZ7k/A6kdg0RAWMvoNjQkFVwXq +Q0KdhudFexgIIRSNhHL5uMAyVXzXWxX5s3Ml1RnAN5WJpF2UgX+o6zHfX5D4d6TDETN eCxn43ledJw2no9ipNgzMSJTig4u7poAXPXjE8hwzF9W2/mxYYDL8x9mnKGco2AzxUEz t7HHAqcDoGOGXZNUSUe/P79uNJXuYsm2Bn3r2jgTdymPI0P52J/LpS8FvIvXOFlRJZ7b TN9rwgf7InlNkBUsEiVl6xs/zpxkADpPF/vTVGMtFTjHPZtumdQKNsCjarnjwCqxCSaW pR5w== X-Received: by 10.140.31.54 with SMTP id e51mr7783072qge.95.1434548623229; Wed, 17 Jun 2015 06:43:43 -0700 (PDT) Original-Received: from moondust.localdomain.nodomain.none (T8722.WPA.Dal.Ca. [134.190.135.34]) by mx.google.com with ESMTPSA id b38sm2156426qkh.36.2015.06.17.06.43.41 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jun 2015 06:43:42 -0700 (PDT) In-Reply-To: <20150608.023951.324799427836228432.chriszheng99@gmail.com> (Chris Zheng's message of "Mon, 08 Jun 2015 02:39:51 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:104022 Archived-At: At 15:39 -0300 on Sunday 2015-06-07, Chris Zheng wrote: > Hello, Emacs. > > I find the calculator.el in Emacs is handy. However, there are two > things I'd like to see changed. > > 1. Press F1 results in `??bad key?? (f1)'. > 2. Can't enter exponent by `E'. > > Both of them can be reproduced by: (1) emacs -Q; (2) M-x calculator; (3) > Press `F1' or `E'. I have the following patch trying to fix the above > two things. Please let me know if I'm doing things wrong. > > * calculator.el (calculator-mode-map): Bind `E' for `calculator-exp'. > (calculator-last-input): Fix a bug that press F1 results in > `??bad key?? (f1)'. > --- > lisp/calculator.el | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lisp/calculator.el b/lisp/calculator.el > index 4027887..d20faa3 100644 > --- a/lisp/calculator.el > +++ b/lisp/calculator.el > @@ -394,7 +394,7 @@ Used for repeating operations in calculator-repR/L.") > [kp-5] [kp-6] [kp-7] [kp-8] [kp-9]) > (calculator-op [kp-divide] [kp-multiply]) > (calculator-decimal "." [kp-decimal]) > - (calculator-exp "e") > + (calculator-exp "e" "E") > (calculator-dec/deg-mode "D") > (calculator-set-register "s") > (calculator-get-register "g") > @@ -1219,7 +1219,7 @@ arguments." > "Last char (or event or event sequence) that was read. > Use KEYS if given, otherwise use `this-command-keys'." > (let ((inp (or keys (this-command-keys)))) > - (if (or (stringp inp) (not (arrayp inp))) > + (if (or (stringp inp) (not (arrayp inp)) (member inp '([f1] [help]))) > inp > ;; Translates kp-x to x and [tries to] create a string to lookup > ;; operators; assume all symbols are translatable via Two cents from another calc user: `E' is already bound. It is bound to calc-exp, the exponential function e^x. For example (where "Calc: " is the calculator prompt and the stack is shown above it): --- Emacs Calculator Mode --- . Calc: 1 --- Emacs Calculator Mode --- 1: 1 . Calc: E --- Emacs Calculator Mode --- 1: 2.71828182846 . This is not to be confused with `e' which introduces the exponent when entering a number in scientific notation: --- Emacs Calculator Mode --- . Calc: 1e3 --- Emacs Calculator Mode --- 1: 1000 . It would be a disaster if the exponential function were no longer available! As far as F1 for help goes, it is incongruent with the calculator interface. For different types of help, `?', `h i', `C-h m' etc. are available. However, F1 is familiar for users from other platforms, so I think it might be a good addition for the benefit of new or infrequent users.