summaryrefslogtreecommitdiff
path: root/lisp/calc
diff options
context:
space:
mode:
authorJay Belanger <jay.p.belanger@gmail.com>2013-11-16 22:22:24 -0600
committerJay Belanger <jay.p.belanger@gmail.com>2013-11-16 22:22:24 -0600
commit014690de705b6be7c55aa0b9ea85694c4fa1fd73 (patch)
treecf6baa4e80e412e7be0453ca21c1fb325367c926 /lisp/calc
parent0f679e866c6aaf8cebd9291bd715bc99eea511ae (diff)
downloademacs-014690de705b6be7c55aa0b9ea85694c4fa1fd73.tar.gz
* calc/calc.el (calc-context-sensitive-enter): New variable.
(calc-enter): Use `calc-context-sensitive-enter'. * doc/misc/calc.texi (Customizing Calc): Mention the new variable `calc-context-sensitive-enter'.
Diffstat (limited to 'lisp/calc')
-rw-r--r--lisp/calc/calc.el14
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index 2795a177a41..72d456957c7 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -146,6 +146,7 @@
(declare-function calc-set-language "calc-lang" (lang &optional option no-refresh))
(declare-function calc-edit-finish "calc-yank" (&optional keep))
(declare-function calc-edit-cancel "calc-yank" ())
+(declare-function calc-locate-cursor-element "calc-yank" (pt))
(declare-function calc-do-quick-calc "calc-aent" ())
(declare-function calc-do-calc-eval "calc-aent" (str separator args))
(declare-function calc-do-keypad "calc-keypd" (&optional full-display interactive))
@@ -426,6 +427,13 @@ when converting units."
:version "24.3"
:type 'boolean)
+(defcustom calc-context-sensitive-enter
+ nil
+ "If non-nil, the stack element under the cursor will be copied by `calc-enter'."
+ :group 'calc
+ :version "24.4"
+ :type 'boolean)
+
(defcustom calc-undo-length
100
"The number of undo steps that will be preserved when Calc is quit."
@@ -2257,8 +2265,10 @@ the United States."
((= n 0)
(calc-push-list (calc-top-list (calc-stack-size))))
(t
- (calc-push-list (calc-top-list n))))))
-
+ (if (not calc-context-sensitive-enter)
+ (calc-push-list (calc-top-list n))
+ (let ((num (max 1 (calc-locate-cursor-element (point)))))
+ (calc-push-list (calc-top-list n num))))))))
(defun calc-pop (n)
(interactive "P")