all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#20764: 25.0.50; Minor improvements for calculator.el
@ 2015-06-07 18:39 Chris Zheng
  2015-06-17 13:43 ` N. Jackson
  0 siblings, 1 reply; 11+ messages in thread
From: Chris Zheng @ 2015-06-07 18:39 UTC (permalink / raw)
  To: 20764


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






^ permalink raw reply related	[flat|nested] 11+ messages in thread

* bug#20764: 25.0.50; Minor improvements for calculator.el
  2015-06-07 18:39 bug#20764: 25.0.50; Minor improvements for calculator.el Chris Zheng
@ 2015-06-17 13:43 ` N. Jackson
  2015-06-17 14:47   ` Jay Belanger
  0 siblings, 1 reply; 11+ messages in thread
From: N. Jackson @ 2015-06-17 13:43 UTC (permalink / raw)
  To: Chris Zheng; +Cc: 20764

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.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#20764: 25.0.50; Minor improvements for calculator.el
  2015-06-17 13:43 ` N. Jackson
@ 2015-06-17 14:47   ` Jay Belanger
  2015-06-17 16:12     ` N. Jackson
  2016-02-23 10:31     ` Lars Ingebrigtsen
  0 siblings, 2 replies; 11+ messages in thread
From: Jay Belanger @ 2015-06-17 14:47 UTC (permalink / raw)
  To: N. Jackson; +Cc: 20764, Chris Zheng


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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#20764: 25.0.50; Minor improvements for calculator.el
  2015-06-17 14:47   ` Jay Belanger
@ 2015-06-17 16:12     ` N. Jackson
  2016-02-23 10:31     ` Lars Ingebrigtsen
  1 sibling, 0 replies; 11+ messages in thread
From: N. Jackson @ 2015-06-17 16:12 UTC (permalink / raw)
  To: Jay Belanger; +Cc: 20764, Chris Zheng

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






^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#20764: 25.0.50; Minor improvements for calculator.el
  2015-06-17 14:47   ` Jay Belanger
  2015-06-17 16:12     ` N. Jackson
@ 2016-02-23 10:31     ` Lars Ingebrigtsen
  2016-02-23 16:40       ` Chris Zheng
  1 sibling, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-23 10:31 UTC (permalink / raw)
  To: Jay Belanger; +Cc: 20764, N. Jackson, Chris Zheng

Jay Belanger <jay.p.belanger@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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#20764: 25.0.50; Minor improvements for calculator.el
  2016-02-23 10:31     ` Lars Ingebrigtsen
@ 2016-02-23 16:40       ` Chris Zheng
  2016-02-23 17:50         ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Chris Zheng @ 2016-02-23 16:40 UTC (permalink / raw)
  To: larsi; +Cc: 20764, jay.p.belanger, nljlistbox2

From: Lars Ingebrigtsen <larsi@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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#20764: 25.0.50; Minor improvements for calculator.el
  2016-02-23 16:40       ` Chris Zheng
@ 2016-02-23 17:50         ` Eli Zaretskii
  2016-02-24  1:23           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2016-02-23 17:50 UTC (permalink / raw)
  To: Chris Zheng; +Cc: 20764, jay.p.belanger, larsi, nljlistbox2

> Date: Wed, 24 Feb 2016 00:40:11 +0800
> From: Chris Zheng <chriszheng99@gmail.com>
> Cc: 20764@debbugs.gnu.org, jay.p.belanger@gmail.com, nljlistbox2@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?





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#20764: 25.0.50; Minor improvements for calculator.el
  2016-02-23 17:50         ` Eli Zaretskii
@ 2016-02-24  1:23           ` Lars Ingebrigtsen
  2016-02-24  3:47             ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-24  1:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 20764, jay.p.belanger, Chris Zheng, nljlistbox2

Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#20764: 25.0.50; Minor improvements for calculator.el
  2016-02-24  1:23           ` Lars Ingebrigtsen
@ 2016-02-24  3:47             ` Eli Zaretskii
  2016-02-24  3:54               ` Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2016-02-24  3:47 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 20764, jay.p.belanger, chriszheng99, nljlistbox2

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Chris Zheng <chriszheng99@gmail.com>,  20764@debbugs.gnu.org,  jay.p.belanger@gmail.com,  nljlistbox2@gmail.com
> Date: Wed, 24 Feb 2016 12:23:31 +1100
> 
> Eli Zaretskii <eliz@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.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#20764: 25.0.50; Minor improvements for calculator.el
  2016-02-24  3:47             ` Eli Zaretskii
@ 2016-02-24  3:54               ` Lars Ingebrigtsen
  2016-02-24 20:36                 ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-24  3:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 20764, jay.p.belanger, chriszheng99, nljlistbox2

Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#20764: 25.0.50; Minor improvements for calculator.el
  2016-02-24  3:54               ` Lars Ingebrigtsen
@ 2016-02-24 20:36                 ` Eli Zaretskii
  0 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2016-02-24 20:36 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 20764-done, jay.p.belanger, chriszheng99, nljlistbox2

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: chriszheng99@gmail.com,  20764@debbugs.gnu.org,  jay.p.belanger@gmail.com,  nljlistbox2@gmail.com
> Date: Wed, 24 Feb 2016 14:54:21 +1100
> 
> Eli Zaretskii <eliz@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.





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-02-24 20:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-07 18:39 bug#20764: 25.0.50; Minor improvements for calculator.el Chris Zheng
2015-06-17 13:43 ` N. Jackson
2015-06-17 14:47   ` Jay Belanger
2015-06-17 16:12     ` N. Jackson
2016-02-23 10:31     ` Lars Ingebrigtsen
2016-02-23 16:40       ` Chris Zheng
2016-02-23 17:50         ` Eli Zaretskii
2016-02-24  1:23           ` Lars Ingebrigtsen
2016-02-24  3:47             ` Eli Zaretskii
2016-02-24  3:54               ` Lars Ingebrigtsen
2016-02-24 20:36                 ` Eli Zaretskii

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.