diff options
| author | Jay Belanger | 2013-12-19 22:53:24 -0600 |
|---|---|---|
| committer | Jay Belanger | 2013-12-19 22:53:24 -0600 |
| commit | 26b75b456e536c1fb2d3979e07e82455b2d9c1ca (patch) | |
| tree | 561e8613962554d95c73ea3516bf37ae6377fef1 | |
| parent | cf91cee781fa7919d437faccf048e23d35af8ae8 (diff) | |
| download | emacs-26b75b456e536c1fb2d3979e07e82455b2d9c1ca.tar.gz emacs-26b75b456e536c1fb2d3979e07e82455b2d9c1ca.zip | |
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'.
| -rw-r--r-- | doc/misc/ChangeLog | 5 | ||||
| -rw-r--r-- | doc/misc/calc.texi | 24 | ||||
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/calc/calc.el | 73 |
4 files changed, 69 insertions, 38 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 8db1f7fa23b..fc07ad6dc08 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-12-20 Jay Belanger <jay.p.belanger@gmail.com> | ||
| 2 | |||
| 3 | * calc.texi (Stack Manipulation Commands): Mention using the variable | ||
| 4 | `calc-context-sensitive-enter' for `calc-enter' and `calc-pop'. | ||
| 5 | |||
| 1 | 2013-12-12 Michael Albinus <michael.albinus@gmx.de> | 6 | 2013-12-12 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 7 | ||
| 3 | * tramp.texi (direntry): Use ssh but rsh. | 8 | * tramp.texi (direntry): Use ssh but rsh. |
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index 0154c82750a..425cd349784 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi | |||
| @@ -11801,6 +11801,18 @@ Thus @kbd{M-@key{DEL}} by itself removes the second-from-top stack element, | |||
| 11801 | leaving the first, third, fourth, and so on; @kbd{M-3 M-@key{DEL}} deletes | 11801 | leaving the first, third, fourth, and so on; @kbd{M-3 M-@key{DEL}} deletes |
| 11802 | the third stack element. | 11802 | the third stack element. |
| 11803 | 11803 | ||
| 11804 | The above commands do not depend on the location of the cursor. | ||
| 11805 | If the customizable variable @code{calc-context-sensitive-enter} is | ||
| 11806 | non-@code{nil} (@pxref{Customizing Calc}), these commands will become | ||
| 11807 | context sensitive. For example, instead of duplicating the top of the stack, | ||
| 11808 | @key{RET} will copy the element at the cursor to the top of the | ||
| 11809 | stack. With a positive numeric prefix, a copy of the element at the | ||
| 11810 | cursor and the appropriate number of preceding elements will be placed | ||
| 11811 | at the top of the stack. A negative prefix will still duplicate the | ||
| 11812 | specified element of the stack regardless of the cursor position. | ||
| 11813 | Similarly, @key{DEL} will remove the corresponding elements from the | ||
| 11814 | stack. | ||
| 11815 | |||
| 11804 | @kindex @key{TAB} | 11816 | @kindex @key{TAB} |
| 11805 | @pindex calc-roll-down | 11817 | @pindex calc-roll-down |
| 11806 | To exchange the top two elements of the stack, press @key{TAB} | 11818 | To exchange the top two elements of the stack, press @key{TAB} |
| @@ -35697,11 +35709,13 @@ is @code{nil}. | |||
| 35697 | @end defvar | 35709 | @end defvar |
| 35698 | 35710 | ||
| 35699 | @defvar calc-context-sensitive-enter | 35711 | @defvar calc-context-sensitive-enter |
| 35700 | The command @code{calc-enter} will typically duplicate the top of the | 35712 | The commands @code{calc-enter} and @code{calc-pop} will typically |
| 35701 | stack. If @code{calc-context-sensitive-enter} is non-@code{nil}, | 35713 | duplicate the top of the stack. If |
| 35702 | then the @code{calc-enter} will copy the element at the cursor to the | 35714 | @code{calc-context-sensitive-enter} is non-@code{nil}, then the |
| 35703 | top of the stack. The default value of | 35715 | @code{calc-enter} will copy the element at the cursor to the |
| 35704 | @code{calc-context-sensitive-enter} is @code{nil}. | 35716 | top of the stack and @code{calc-pop} will delete the element at the |
| 35717 | cursor. The default value of @code{calc-context-sensitive-enter} is | ||
| 35718 | @code{nil}. | ||
| 35705 | @end defvar | 35719 | @end defvar |
| 35706 | 35720 | ||
| 35707 | @defvar calc-undo-length | 35721 | @defvar calc-undo-length |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 464a3b11ce8..b502aa946ad 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-12-20 Jay Belanger <jay.p.belanger@gmail.com> | ||
| 2 | |||
| 3 | * calc/calc.el (calc-enter, calc-pop): Use the variable | ||
| 4 | `calc-context-sensitive-enter'. | ||
| 5 | |||
| 1 | 2013-12-20 Lars Magne Ingebrigtsen <larsi@gnus.org> | 6 | 2013-12-20 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 7 | ||
| 3 | * net/shr.el (shr-insert): Protect against infloops in degenerate | 8 | * net/shr.el (shr-insert): Protect against infloops in degenerate |
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 72d456957c7..64549268e6e 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el | |||
| @@ -429,7 +429,8 @@ when converting units." | |||
| 429 | 429 | ||
| 430 | (defcustom calc-context-sensitive-enter | 430 | (defcustom calc-context-sensitive-enter |
| 431 | nil | 431 | nil |
| 432 | "If non-nil, the stack element under the cursor will be copied by `calc-enter'." | 432 | "If non-nil, the stack element under the cursor will be copied by `calc-enter' |
| 433 | and deleted by `calc-pop'." | ||
| 433 | :group 'calc | 434 | :group 'calc |
| 434 | :version "24.4" | 435 | :version "24.4" |
| 435 | :type 'boolean) | 436 | :type 'boolean) |
| @@ -2259,41 +2260,47 @@ the United States." | |||
| 2259 | 2260 | ||
| 2260 | (defun calc-enter (n) | 2261 | (defun calc-enter (n) |
| 2261 | (interactive "p") | 2262 | (interactive "p") |
| 2262 | (calc-wrapper | 2263 | (let ((num (if calc-context-sensitive-enter (max 1 (calc-locate-cursor-element (point)))))) |
| 2263 | (cond ((< n 0) | 2264 | (calc-wrapper |
| 2264 | (calc-push-list (calc-top-list 1 (- n)))) | 2265 | (cond ((< n 0) |
| 2265 | ((= n 0) | 2266 | (calc-push-list (calc-top-list 1 (- n)))) |
| 2266 | (calc-push-list (calc-top-list (calc-stack-size)))) | 2267 | ((= n 0) |
| 2267 | (t | 2268 | (calc-push-list (calc-top-list (calc-stack-size)))) |
| 2268 | (if (not calc-context-sensitive-enter) | 2269 | (num |
| 2269 | (calc-push-list (calc-top-list n)) | 2270 | (calc-push-list (calc-top-list n num))) |
| 2270 | (let ((num (max 1 (calc-locate-cursor-element (point))))) | 2271 | (t |
| 2271 | (calc-push-list (calc-top-list n num)))))))) | 2272 | (calc-push-list (calc-top-list n))))) |
| 2273 | (if (and calc-context-sensitive-enter (> n 0)) (calc-cursor-stack-index (+ num n))))) | ||
| 2272 | 2274 | ||
| 2273 | (defun calc-pop (n) | 2275 | (defun calc-pop (n) |
| 2274 | (interactive "P") | 2276 | (interactive "P") |
| 2275 | (calc-wrapper | 2277 | (let ((num (if calc-context-sensitive-enter (max 1 (calc-locate-cursor-element (point)))))) |
| 2276 | (let* ((nn (prefix-numeric-value n)) | 2278 | (calc-wrapper |
| 2277 | (top (and (null n) (calc-top 1)))) | 2279 | (let* ((nn (prefix-numeric-value n)) |
| 2278 | (cond ((and (null n) | 2280 | (top (and (null n) (calc-top 1)))) |
| 2279 | (eq (car-safe top) 'incomplete) | 2281 | (cond ((and calc-context-sensitive-enter (> num 1)) |
| 2280 | (> (length top) (if (eq (nth 1 top) 'intv) 3 2))) | 2282 | (calc-pop-stack nn num)) |
| 2281 | (calc-pop-push-list 1 (let ((tt (copy-sequence top))) | 2283 | ((and (null n) |
| 2282 | (setcdr (nthcdr (- (length tt) 2) tt) nil) | 2284 | (eq (car-safe top) 'incomplete) |
| 2283 | (list tt)))) | 2285 | (> (length top) (if (eq (nth 1 top) 'intv) 3 2))) |
| 2284 | ((< nn 0) | 2286 | (calc-pop-push-list 1 (let ((tt (copy-sequence top))) |
| 2285 | (if (and calc-any-selections | 2287 | (setcdr (nthcdr (- (length tt) 2) tt) nil) |
| 2286 | (calc-top-selected 1 (- nn))) | 2288 | (list tt)))) |
| 2287 | (calc-delete-selection (- nn)) | 2289 | ((< nn 0) |
| 2288 | (calc-pop-stack 1 (- nn) t))) | 2290 | (if (and calc-any-selections |
| 2289 | ((= nn 0) | 2291 | (calc-top-selected 1 (- nn))) |
| 2290 | (calc-pop-stack (calc-stack-size) 1 t)) | 2292 | (calc-delete-selection (- nn)) |
| 2291 | (t | 2293 | (calc-pop-stack 1 (- nn) t))) |
| 2292 | (if (and calc-any-selections | 2294 | ((= nn 0) |
| 2293 | (= nn 1) | 2295 | (calc-pop-stack (calc-stack-size) 1 t)) |
| 2294 | (calc-top-selected 1 1)) | 2296 | (t |
| 2295 | (calc-delete-selection 1) | 2297 | (if (and calc-any-selections |
| 2296 | (calc-pop-stack nn))))))) | 2298 | (= nn 1) |
| 2299 | (calc-top-selected 1 1)) | ||
| 2300 | (calc-delete-selection 1) | ||
| 2301 | (calc-pop-stack nn)))))) | ||
| 2302 | (if calc-context-sensitive-enter (calc-cursor-stack-index (1- num))))) | ||
| 2303 | |||
| 2297 | 2304 | ||
| 2298 | 2305 | ||
| 2299 | 2306 | ||