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'.
This commit is contained in:
parent
cf91cee781
commit
26b75b456e
4 changed files with 69 additions and 38 deletions
|
|
@ -1,3 +1,8 @@
|
|||
2013-12-20 Jay Belanger <jay.p.belanger@gmail.com>
|
||||
|
||||
* calc.texi (Stack Manipulation Commands): Mention using the variable
|
||||
`calc-context-sensitive-enter' for `calc-enter' and `calc-pop'.
|
||||
|
||||
2013-12-12 Michael Albinus <michael.albinus@gmx.de>
|
||||
|
||||
* tramp.texi (direntry): Use ssh but rsh.
|
||||
|
|
|
|||
|
|
@ -11801,6 +11801,18 @@ Thus @kbd{M-@key{DEL}} by itself removes the second-from-top stack element,
|
|||
leaving the first, third, fourth, and so on; @kbd{M-3 M-@key{DEL}} 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
|
||||
non-@code{nil} (@pxref{Customizing Calc}), these commands will become
|
||||
context sensitive. For example, instead of duplicating the top of the stack,
|
||||
@key{RET} 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 @@ is @code{nil}.
|
|||
@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 non-@code{nil},
|
||||
then the @code{calc-enter} will copy the element at the cursor to the
|
||||
top of the stack. The default value of
|
||||
@code{calc-context-sensitive-enter} is @code{nil}.
|
||||
The commands @code{calc-enter} and @code{calc-pop} will typically
|
||||
duplicate the top of the stack. If
|
||||
@code{calc-context-sensitive-enter} is non-@code{nil}, then the
|
||||
@code{calc-enter} 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
|
||||
@code{nil}.
|
||||
@end defvar
|
||||
|
||||
@defvar calc-undo-length
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
2013-12-20 Jay Belanger <jay.p.belanger@gmail.com>
|
||||
|
||||
* calc/calc.el (calc-enter, calc-pop): Use the variable
|
||||
`calc-context-sensitive-enter'.
|
||||
|
||||
2013-12-20 Lars Magne Ingebrigtsen <larsi@gnus.org>
|
||||
|
||||
* net/shr.el (shr-insert): Protect against infloops in degenerate
|
||||
|
|
|
|||
|
|
@ -429,7 +429,8 @@ when converting units."
|
|||
|
||||
(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 @@ the United States."
|
|||
|
||||
(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)))))
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue