GNU bug report logs - #20764
25.0.50; Minor improvements for calculator.el

Previous Next

Package: emacs;

Reported by: Chris Zheng <chriszheng99 <at> gmail.com>

Date: Sun, 7 Jun 2015 18:48:02 UTC

Severity: minor

Tags: fixed, patch

Found in version 25.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 20764 in the body.
You can then email your comments to 20764 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#20764; Package emacs. (Sun, 07 Jun 2015 18:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Chris Zheng <chriszheng99 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 07 Jun 2015 18:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Chris Zheng <chriszheng99 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; Minor improvements for calculator.el
Date: Mon, 08 Jun 2015 02:39:51 +0800
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.

Best Regards,
Chris


From 12e6d1e28060ba1ef2218a1ad37e26e02c4a1cb0 Mon Sep 17 00:00:00 2001
From: Chris Zheng <chriszheng99 <at> gmail.com>
Date: Sat, 6 Jun 2015 08:48:25 +0200
Subject: [PATCH] Minor improvements for lisp/calculator.el.

* 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
-- 
2.4.2



In GNU Emacs 25.0.50.2 (x86_64-w64-mingw32)
 of 2015-06-05 on KAEL
Windowing system distributor `Microsoft Corp.', version 6.3.9600
Configured using:
 `configure --prefix=/z/emacs --host=x86_64-w64-mingw32
 --target=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --with-wide-int
 --with-jpeg --with-xpm --with-png --with-tiff --with-rsvg --with-xml2
 --with-gnutls --with-sound=yes --with-file-notification=yes
 --without-dbus --without-imagemagick 'CFLAGS=-O3 -fomit-frame-pointer
 -g0 -pipe' 'LDFLAGS=-static-libgcc -static-libstdc++ -static -s
 -Wl,-s''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20764; Package emacs. (Wed, 17 Jun 2015 13:44:02 GMT) Full text and rfc822 format available.

Message #8 received at 20764 <at> debbugs.gnu.org (full text, mbox):

From: nljlistbox2 <at> gmail.com (N. Jackson)
To: Chris Zheng <chriszheng99 <at> gmail.com>
Cc: 20764 <at> debbugs.gnu.org
Subject: Re: bug#20764: 25.0.50; Minor improvements for calculator.el
Date: Wed, 17 Jun 2015 10:43:40 -0300
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 <RET>

    --- 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20764; Package emacs. (Wed, 17 Jun 2015 14:48:01 GMT) Full text and rfc822 format available.

Message #11 received at 20764 <at> debbugs.gnu.org (full text, mbox):

From: Jay Belanger <jay.p.belanger <at> gmail.com>
To: nljlistbox2 <at> gmail.com (N. Jackson)
Cc: 20764 <at> debbugs.gnu.org, jay.p.belanger <at> gmail.com,
 Chris Zheng <chriszheng99 <at> gmail.com>
Subject: Re: bug#20764: 25.0.50; Minor improvements for calculator.el
Date: Wed, 17 Jun 2015 09:47:40 -0500
>> 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'.
...
> Two cents from another calc user:

Emacs has two built-in calculators; calculator.el, which is a basic
scientific calculator, and Calc, which is more extensive.

The original bug report was for calculator.el, in which E is currently
undefined.  I'm not sure who should address this bug report, but if
nobody else does, I will.

> 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.

Good point, I can make the change (for F1 only) in Calc, too.

Jay




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20764; Package emacs. (Wed, 17 Jun 2015 16:50:07 GMT) Full text and rfc822 format available.

Message #14 received at 20764 <at> debbugs.gnu.org (full text, mbox):

From: nljlistbox2 <at> gmail.com (N. Jackson)
To: Jay Belanger <jay.p.belanger <at> gmail.com>
Cc: 20764 <at> debbugs.gnu.org, Chris Zheng <chriszheng99 <at> gmail.com>
Subject: Re: bug#20764: 25.0.50; Minor improvements for calculator.el
Date: Wed, 17 Jun 2015 13:12:42 -0300
At 11:47 -0300 on Wednesday 2015-06-17, Jay Belanger wrote:

>>> 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'.
> ...
>> Two cents from another calc user:
>
> Emacs has two built-in calculators; calculator.el, which is a basic
> scientific calculator, and Calc, which is more extensive.
>
> The original bug report was for calculator.el

Oops, missed that. Sorry. Please disregard what I wrote. (Although
adding F1 for help seems plausible for both calculators.)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20764; Package emacs. (Tue, 23 Feb 2016 10:32:01 GMT) Full text and rfc822 format available.

Message #17 received at 20764 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jay Belanger <jay.p.belanger <at> gmail.com>
Cc: 20764 <at> debbugs.gnu.org, "N. Jackson" <nljlistbox2 <at> gmail.com>,
 Chris Zheng <chriszheng99 <at> gmail.com>
Subject: Re: bug#20764: 25.0.50; Minor improvements for calculator.el
Date: Tue, 23 Feb 2016 21:31:08 +1100
Jay Belanger <jay.p.belanger <at> gmail.com> writes:

> Good point, I can make the change (for F1 only) in Calc, too.

I tried `M-x calculator' now, and both F1 and E seemed to be doing what
you'd expect, so I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 23 Feb 2016 10:32:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 20764 <at> debbugs.gnu.org and Chris Zheng <chriszheng99 <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 23 Feb 2016 10:32:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20764; Package emacs. (Tue, 23 Feb 2016 16:41:02 GMT) Full text and rfc822 format available.

Message #24 received at 20764 <at> debbugs.gnu.org (full text, mbox):

From: Chris Zheng <chriszheng99 <at> gmail.com>
To: larsi <at> gnus.org
Cc: 20764 <at> debbugs.gnu.org, jay.p.belanger <at> gmail.com, nljlistbox2 <at> gmail.com
Subject: Re: bug#20764: 25.0.50; Minor improvements for calculator.el
Date: Wed, 24 Feb 2016 00:40:11 +0800
From: Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#20764: 25.0.50; Minor improvements for calculator.el
Date: Tue, 23 Feb 2016 21:31:08 +1100

> I tried `M-x calculator' now, and both F1 and E seemed to be doing what
> you'd expect, so I'm closing this bug report.

Hello Lars,

Thank you. It is indeed fixed in the master branch, but the issue is
still in the pretest 25.0.91. Do you test it in the master branch?

Would you please port the fix to the emacs-25 branch? If so, it will
be fixed in 25.1. I think the commits are:

6148555 * | * lisp/calculator.el (calculator-define-key): Undo last change
c77b816 * | * lisp/calculator.el (calculator-define-key): Silence warning
f248292 * | * lisp/calculator.el: more improvements and bugfixes.
1b4570b * | * lisp/calculator.el: Re-do key bindings.
e875e68 * | * lisp/calculator.el: improve radix modes
5d74a02 * | * lisp/calculator.el: better reading of register names
fb9ed79 * | * lisp/calculator.el: General improvements

Thank you,
Chris




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20764; Package emacs. (Tue, 23 Feb 2016 17:52:01 GMT) Full text and rfc822 format available.

Message #27 received at 20764 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Chris Zheng <chriszheng99 <at> gmail.com>
Cc: 20764 <at> debbugs.gnu.org, jay.p.belanger <at> gmail.com, larsi <at> gnus.org,
 nljlistbox2 <at> gmail.com
Subject: Re: bug#20764: 25.0.50; Minor improvements for calculator.el
Date: Tue, 23 Feb 2016 19:50:42 +0200
> Date: Wed, 24 Feb 2016 00:40:11 +0800
> From: Chris Zheng <chriszheng99 <at> gmail.com>
> Cc: 20764 <at> debbugs.gnu.org, jay.p.belanger <at> gmail.com, nljlistbox2 <at> gmail.com
> 
> Hello Lars,
> 
> Thank you. It is indeed fixed in the master branch, but the issue is
> still in the pretest 25.0.91. Do you test it in the master branch?
> 
> Would you please port the fix to the emacs-25 branch? If so, it will
> be fixed in 25.1. I think the commits are:
> 
> 6148555 * | * lisp/calculator.el (calculator-define-key): Undo last change
> c77b816 * | * lisp/calculator.el (calculator-define-key): Silence warning
> f248292 * | * lisp/calculator.el: more improvements and bugfixes.
> 1b4570b * | * lisp/calculator.el: Re-do key bindings.
> e875e68 * | * lisp/calculator.el: improve radix modes
> 5d74a02 * | * lisp/calculator.el: better reading of register names
> fb9ed79 * | * lisp/calculator.el: General improvements

I don't understand: the original bug report described 2 minor issues
and provided a 2-line fix for them.  How come we are now back-porting
no less than 7 commits from master?  Can't we install on emacs-25 just
those two changed lines?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20764; Package emacs. (Wed, 24 Feb 2016 01:25:01 GMT) Full text and rfc822 format available.

Message #30 received at 20764 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 20764 <at> debbugs.gnu.org, jay.p.belanger <at> gmail.com,
 Chris Zheng <chriszheng99 <at> gmail.com>, nljlistbox2 <at> gmail.com
Subject: Re: bug#20764: 25.0.50; Minor improvements for calculator.el
Date: Wed, 24 Feb 2016 12:23:31 +1100
Eli Zaretskii <eliz <at> gnu.org> writes:

> I don't understand: the original bug report described 2 minor issues
> and provided a 2-line fix for them.  How come we are now back-porting
> no less than 7 commits from master?  Can't we install on emacs-25 just
> those two changed lines?

It was fixed in a completely different way, I think...

Anyway, these aren't bugs (but rather enhacements), so I think it's
correct that it just went to the trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20764; Package emacs. (Wed, 24 Feb 2016 03:48:02 GMT) Full text and rfc822 format available.

Message #33 received at 20764 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 20764 <at> debbugs.gnu.org, jay.p.belanger <at> gmail.com, chriszheng99 <at> gmail.com,
 nljlistbox2 <at> gmail.com
Subject: Re: bug#20764: 25.0.50; Minor improvements for calculator.el
Date: Wed, 24 Feb 2016 05:47:30 +0200
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: Chris Zheng <chriszheng99 <at> gmail.com>,  20764 <at> debbugs.gnu.org,  jay.p.belanger <at> gmail.com,  nljlistbox2 <at> gmail.com
> Date: Wed, 24 Feb 2016 12:23:31 +1100
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > I don't understand: the original bug report described 2 minor issues
> > and provided a 2-line fix for them.  How come we are now back-porting
> > no less than 7 commits from master?  Can't we install on emacs-25 just
> > those two changed lines?
> 
> It was fixed in a completely different way, I think...
> 
> Anyway, these aren't bugs (but rather enhacements), so I think it's
> correct that it just went to the trunk.

The report did feel like bugs, so I'm okay with installing the 2-line
solution on emacs-25.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20764; Package emacs. (Wed, 24 Feb 2016 03:55:02 GMT) Full text and rfc822 format available.

Message #36 received at 20764 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 20764 <at> debbugs.gnu.org, jay.p.belanger <at> gmail.com, chriszheng99 <at> gmail.com,
 nljlistbox2 <at> gmail.com
Subject: Re: bug#20764: 25.0.50; Minor improvements for calculator.el
Date: Wed, 24 Feb 2016 14:54:21 +1100
Eli Zaretskii <eliz <at> gnu.org> writes:

> The report did feel like bugs, so I'm okay with installing the 2-line
> solution on emacs-25.

Sure, go ahead.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#20764; Package emacs. (Wed, 24 Feb 2016 20:38:01 GMT) Full text and rfc822 format available.

Message #39 received at 20764-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 20764-done <at> debbugs.gnu.org, jay.p.belanger <at> gmail.com,
 chriszheng99 <at> gmail.com, nljlistbox2 <at> gmail.com
Subject: Re: bug#20764: 25.0.50; Minor improvements for calculator.el
Date: Wed, 24 Feb 2016 22:36:49 +0200
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: chriszheng99 <at> gmail.com,  20764 <at> debbugs.gnu.org,  jay.p.belanger <at> gmail.com,  nljlistbox2 <at> gmail.com
> Date: Wed, 24 Feb 2016 14:54:21 +1100
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > The report did feel like bugs, so I'm okay with installing the 2-line
> > solution on emacs-25.
> 
> Sure, go ahead.  :-)

Done.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 24 Mar 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 89 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.