all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: nljlistbox2@gmail.com (N. Jackson)
To: Chris Zheng <chriszheng99@gmail.com>
Cc: 20764@debbugs.gnu.org
Subject: bug#20764: 25.0.50; Minor improvements for calculator.el
Date: Wed, 17 Jun 2015 10:43:40 -0300	[thread overview]
Message-ID: <87twu6h2lv.fsf@moondust.localdomain> (raw)
In-Reply-To: <20150608.023951.324799427836228432.chriszheng99@gmail.com> (Chris Zheng's message of "Mon, 08 Jun 2015 02:39:51 +0800")

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.





  reply	other threads:[~2015-06-17 13:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-07 18:39 bug#20764: 25.0.50; Minor improvements for calculator.el Chris Zheng
2015-06-17 13:43 ` N. Jackson [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87twu6h2lv.fsf@moondust.localdomain \
    --to=nljlistbox2@gmail.com \
    --cc=20764@debbugs.gnu.org \
    --cc=chriszheng99@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.