diff options
author | Eli Barzilay <eli@barzilay.org> | 2014-06-23 01:14:23 -0400 |
---|---|---|
committer | Eli Barzilay <eli@barzilay.org> | 2014-06-23 01:14:23 -0400 |
commit | cc43334a3e3dd1937a9f43ebbdaa89297fc34a1c (patch) | |
tree | 78f0058c75d676b3f7b163d46c077452019c22db /lisp/calculator.el | |
parent | 200fc9496f7e2d53610e31634fdcd750d1870279 (diff) | |
download | emacs-cc43334a3e3dd1937a9f43ebbdaa89297fc34a1c.tar.gz emacs-cc43334a3e3dd1937a9f43ebbdaa89297fc34a1c.tar.bz2 emacs-cc43334a3e3dd1937a9f43ebbdaa89297fc34a1c.zip |
* calculator.el (calculator-standard-displayer): Fix bug in use of
`calculator-groupize-number'.
(calculator-funcall): Fix broken `cl-flet' use by moving it into the
`eval' code, so it works in v24.3.1 too.
(calculator-last-input): Comment to clarify purpose.
Also add back a ChangeLog blurb for previous commit 2014-06-15T04:52:34Z!eli@barzilay.org.
Diffstat (limited to 'lisp/calculator.el')
-rw-r--r-- | lisp/calculator.el | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/lisp/calculator.el b/lisp/calculator.el index 52dc8c53661..9ffa6b1a64b 100644 --- a/lisp/calculator.el +++ b/lisp/calculator.el @@ -1019,8 +1019,9 @@ number of digits displayed (`calculator-number-digits')." (s (calculator-remove-zeros (format s num))) (s (if (or (not group-p) (string-match-p "[eE]" s)) s (replace-regexp-in-string - "\\([0-9]+\\)\\(?:\\.\\|$\\)" - (lambda (s) (calculator-groupize-number s 3 ",")) + "\\([0-9]+\\)\\(?:\\..*\\|$\\)" + (lambda (_) (calculator-groupize-number + (match-string 1 s) 3 ",")) s nil nil 1)))) s))) @@ -1197,12 +1198,13 @@ arguments." (let ((TX (and X (calculator-truncate X))) (TY (and Y (calculator-truncate Y))) (DX (if (and X calculator-deg) (/ (* X pi) 180) X)) - (L calculator-saved-list)) - (cl-flet ((F (&optional x y) (calculator-funcall f x y)) - (D (x) (if calculator-deg (/ (* x 180) float-pi) x))) - (eval `(let ((X ,X) (Y ,Y) (DX ,DX) (TX ,TX) (TY ,TY) (L ',L)) - ,f) - t))))) + (L calculator-saved-list) + (fF `(calculator-funcall ',f x y)) + (fD `(if calculator-deg (/ (* x 180) float-pi) x))) + (eval `(cl-flet ((F (&optional x y) ,fF) (D (x) ,fD)) + (let ((X ,X) (Y ,Y) (DX ,DX) (TX ,TX) (TY ,TY) (L ',L)) + ,f)) + t)))) ;;;--------------------------------------------------------------------- ;;; Input interaction @@ -1213,9 +1215,12 @@ Use KEYS if given, otherwise use `this-command-keys'." (let ((inp (or keys (this-command-keys)))) (if (or (stringp inp) (not (arrayp inp))) inp - ;; translates kp-x to x and [tries to] create a string to lookup + ;; Translates kp-x to x and [tries to] create a string to lookup ;; operators; assume all symbols are translatable via - ;; `function-key-map' or with an 'ascii-character property + ;; `function-key-map' or with an 'ascii-character property. This + ;; is needed because we have key bindings for kp-* (which might be + ;; the wrong thing to do) so they don't get translated in + ;; `this-command-keys'. (concat (mapcar (lambda (k) (if (numberp k) k (or (get k 'ascii-character) (error "??bad key??")))) |