[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117379: * calculator.el (calculator-standard-displa
From: |
Eli Barzilay |
Subject: |
[Emacs-diffs] trunk r117379: * calculator.el (calculator-standard-displayer): Fix bug in use of |
Date: |
Mon, 23 Jun 2014 05:15:25 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117379
revision-id: address@hidden
parent: address@hidden
committer: Eli Barzilay <address@hidden>
branch nick: trunk
timestamp: Mon 2014-06-23 01:14:23 -0400
message:
* 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 117340.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/calculator.el
calculator.el-20091113204419-o5vbwnq5f7feedwu-1770
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-06-22 23:12:17 +0000
+++ b/lisp/ChangeLog 2014-06-23 05:14:23 +0000
@@ -1,3 +1,11 @@
+2014-06-23 Eli Barzilay <address@hidden>
+
+ * 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.
+
2014-06-22 Mario Lang <address@hidden>
* textmodes/rst.el (rst-comment-region): From from -> from.
@@ -194,6 +202,48 @@
rlogin is anymore.
(dun-help): Bump version number; update contact info.
+2014-06-15 Eli Barzilay <address@hidden>
+
+ * calculator.el (calculator-prompt, calculator-remove-zeros)
+ (calculator-mode-hook, calculator-operators, calculator-stack)
+ (calculator-mode): Tweak docstring.
+ (calculator-user-operators): Tweak docstring, fix a bug in the last
+ example.
+ (calculator-displayer): `std' case has an optional boolean.
+ (calculator-displayers): Use the new boolean to group in decimal mode.
+ (calculator-mode-map, calculator, calculator-message)
+ (calculator-op-arity, calculator-add-operators)
+ (calculator-string-to-number, calculator-displayer-prev)
+ (calculator-displayer-next, calculator-remove-zeros)
+ (calculator-eng-display, calculator-number-to-string)
+ (calculator-update-display, calculator-last-input)
+ (calculator-clear-fragile, calculator-digit, calculator-decimal)
+ (calculator-exp, calculator-saved-move, calculator-clear)
+ (calculator-copy, calculator-put-value, calculator-help)
+ (calculator-expt, calculator-truncate): Minor code improvements.
+ (calculator-need-3-lines): New function pulling out code from
+ `calculator'.
+ (calculator-get-display): Renamed from `calculator-get-prompt', and
+ improved.
+ (calculator-push-curnum): Renamed from `calculator-curnum-value', and
+ extended for all uses of it. All callers changed.
+ (calculator-groupize-number): New utility for splitting a number into
+ groups.
+ (calculator-standard-displayer): Improve code, new optional argument to
+ use comma-split groups, make second argument optional too to use with
+ 'left/'right inputs. All callers changed.
+ (calculator-reduce-stack-once): New utility, doing the meat of what
+ `calculator-reduce-stack' used to do, much improved (mostly using
+ `pcase' for conciseness and clarity).
+ (calculator-reduce-stack): Now doing just the reduction loop using
+ `calculator-reduce-stack-once'.
+ (calculator-funcall): Improved code, make it work in v24.3.1 too.
+ (calculator-last-input): Improved code, remove some old cruft.
+ (calculator-quit): Kill `calculator-buffer' in electric mode too.
+ (calculator-integer-p): Removed.
+ (calculator-fact): Improved code, make it work on non-integer values
+ too (using truncated numbers).
+
2014-06-15 Michael Albinus <address@hidden>
Sync with Tramp 2.2.10.
=== modified file 'lisp/calculator.el'
--- a/lisp/calculator.el 2014-06-15 04:52:34 +0000
+++ b/lisp/calculator.el 2014-06-23 05:14:23 +0000
@@ -1019,8 +1019,9 @@
(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 @@
(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 @@
(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??"))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117379: * calculator.el (calculator-standard-displayer): Fix bug in use of,
Eli Barzilay <=