[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115623: lisp/calc/calc.el (calc-enter, calc-pop): U
From: |
Jay Belanger |
Subject: |
[Emacs-diffs] trunk r115623: lisp/calc/calc.el (calc-enter, calc-pop): Use the variable |
Date: |
Fri, 20 Dec 2013 04:53:46 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115623
revision-id: address@hidden
parent: address@hidden
committer: Jay Belanger <address@hidden>
branch nick: trunk
timestamp: Thu 2013-12-19 22:53:24 -0600
message:
lisp/calc/calc.el (calc-enter, calc-pop): Use the variable
`calc-context-sensitive-enter'.
doc/misc/calc.texi (Stack Manipulation Commands): Mention using the variable
`calc-context-sensitive-enter' for `calc-enter' and `calc-pop'.
modified:
doc/misc/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-6331
doc/misc/calc.texi calc.texi-20091113204419-o5vbwnq5f7feedwu-6290
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/calc/calc.el calc.el-20091113204419-o5vbwnq5f7feedwu-2306
=== modified file 'doc/misc/ChangeLog'
--- a/doc/misc/ChangeLog 2013-12-12 09:57:56 +0000
+++ b/doc/misc/ChangeLog 2013-12-20 04:53:24 +0000
@@ -1,3 +1,8 @@
+2013-12-20 Jay Belanger <address@hidden>
+
+ * calc.texi (Stack Manipulation Commands): Mention using the variable
+ `calc-context-sensitive-enter' for `calc-enter' and `calc-pop'.
+
2013-12-12 Michael Albinus <address@hidden>
* tramp.texi (direntry): Use ssh but rsh.
=== modified file 'doc/misc/calc.texi'
--- a/doc/misc/calc.texi 2013-11-17 04:22:24 +0000
+++ b/doc/misc/calc.texi 2013-12-20 04:53:24 +0000
@@ -11801,6 +11801,18 @@
leaving the first, third, fourth, and so on; @kbd{M-3 address@hidden deletes
the third stack element.
+The above commands do not depend on the location of the cursor.
+If the customizable variable @code{calc-context-sensitive-enter} is
address@hidden (@pxref{Customizing Calc}), these commands will become
+context sensitive. For example, instead of duplicating the top of the stack,
address@hidden will copy the element at the cursor to the top of the
+stack. With a positive numeric prefix, a copy of the element at the
+cursor and the appropriate number of preceding elements will be placed
+at the top of the stack. A negative prefix will still duplicate the
+specified element of the stack regardless of the cursor position.
+Similarly, @key{DEL} will remove the corresponding elements from the
+stack.
+
@kindex @key{TAB}
@pindex calc-roll-down
To exchange the top two elements of the stack, press @key{TAB}
@@ -35697,11 +35709,13 @@
@end defvar
@defvar calc-context-sensitive-enter
-The command @code{calc-enter} will typically duplicate the top of the
-stack. If @code{calc-context-sensitive-enter} is address@hidden,
-then the @code{calc-enter} will copy the element at the cursor to the
-top of the stack. The default value of
address@hidden is @code{nil}.
+The commands @code{calc-enter} and @code{calc-pop} will typically
+duplicate the top of the stack. If
address@hidden is address@hidden, then the
address@hidden will copy the element at the cursor to the
+top of the stack and @code{calc-pop} will delete the element at the
+cursor. The default value of @code{calc-context-sensitive-enter} is
address@hidden
@end defvar
@defvar calc-undo-length
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-12-20 04:29:08 +0000
+++ b/lisp/ChangeLog 2013-12-20 04:53:24 +0000
@@ -1,3 +1,8 @@
+2013-12-20 Jay Belanger <address@hidden>
+
+ * calc/calc.el (calc-enter, calc-pop): Use the variable
+ `calc-context-sensitive-enter'.
+
2013-12-20 Lars Magne Ingebrigtsen <address@hidden>
* net/shr.el (shr-insert): Protect against infloops in degenerate
=== modified file 'lisp/calc/calc.el'
--- a/lisp/calc/calc.el 2013-11-17 04:22:24 +0000
+++ b/lisp/calc/calc.el 2013-12-20 04:53:24 +0000
@@ -429,7 +429,8 @@
(defcustom calc-context-sensitive-enter
nil
- "If non-nil, the stack element under the cursor will be copied by
`calc-enter'."
+ "If non-nil, the stack element under the cursor will be copied by
`calc-enter'
+and deleted by `calc-pop'."
:group 'calc
:version "24.4"
:type 'boolean)
@@ -2259,41 +2260,47 @@
(defun calc-enter (n)
(interactive "p")
- (calc-wrapper
- (cond ((< n 0)
- (calc-push-list (calc-top-list 1 (- n))))
- ((= n 0)
- (calc-push-list (calc-top-list (calc-stack-size))))
- (t
- (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))))))))
+ (let ((num (if calc-context-sensitive-enter (max 1
(calc-locate-cursor-element (point))))))
+ (calc-wrapper
+ (cond ((< n 0)
+ (calc-push-list (calc-top-list 1 (- n))))
+ ((= n 0)
+ (calc-push-list (calc-top-list (calc-stack-size))))
+ (num
+ (calc-push-list (calc-top-list n num)))
+ (t
+ (calc-push-list (calc-top-list n)))))
+ (if (and calc-context-sensitive-enter (> n 0)) (calc-cursor-stack-index (+
num n)))))
(defun calc-pop (n)
(interactive "P")
- (calc-wrapper
- (let* ((nn (prefix-numeric-value n))
- (top (and (null n) (calc-top 1))))
- (cond ((and (null n)
- (eq (car-safe top) 'incomplete)
- (> (length top) (if (eq (nth 1 top) 'intv) 3 2)))
- (calc-pop-push-list 1 (let ((tt (copy-sequence top)))
- (setcdr (nthcdr (- (length tt) 2) tt) nil)
- (list tt))))
- ((< nn 0)
- (if (and calc-any-selections
- (calc-top-selected 1 (- nn)))
- (calc-delete-selection (- nn))
- (calc-pop-stack 1 (- nn) t)))
- ((= nn 0)
- (calc-pop-stack (calc-stack-size) 1 t))
- (t
- (if (and calc-any-selections
- (= nn 1)
- (calc-top-selected 1 1))
- (calc-delete-selection 1)
- (calc-pop-stack nn)))))))
+ (let ((num (if calc-context-sensitive-enter (max 1
(calc-locate-cursor-element (point))))))
+ (calc-wrapper
+ (let* ((nn (prefix-numeric-value n))
+ (top (and (null n) (calc-top 1))))
+ (cond ((and calc-context-sensitive-enter (> num 1))
+ (calc-pop-stack nn num))
+ ((and (null n)
+ (eq (car-safe top) 'incomplete)
+ (> (length top) (if (eq (nth 1 top) 'intv) 3 2)))
+ (calc-pop-push-list 1 (let ((tt (copy-sequence top)))
+ (setcdr (nthcdr (- (length tt) 2) tt)
nil)
+ (list tt))))
+ ((< nn 0)
+ (if (and calc-any-selections
+ (calc-top-selected 1 (- nn)))
+ (calc-delete-selection (- nn))
+ (calc-pop-stack 1 (- nn) t)))
+ ((= nn 0)
+ (calc-pop-stack (calc-stack-size) 1 t))
+ (t
+ (if (and calc-any-selections
+ (= nn 1)
+ (calc-top-selected 1 1))
+ (calc-delete-selection 1)
+ (calc-pop-stack nn))))))
+ (if calc-context-sensitive-enter (calc-cursor-stack-index (1- num)))))
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115623: lisp/calc/calc.el (calc-enter, calc-pop): Use the variable,
Jay Belanger <=