* lisp/simple.el (eval-expression): Let `exp' set the mark.

Fixes: debbugs:13724
This commit is contained in:
Stefan Monnier
2013-02-15 18:47:50 -05:00
parent f852f6d8c0
commit 6c8f113e70
2 changed files with 18 additions and 14 deletions

View File

@@ -1,11 +1,15 @@
2013-02-15 Stefan Monnier <monnier@iro.umontreal.ca>
* simple.el (eval-expression): Let `exp' set the mark (bug#13724).
2013-02-15 Alan Mackenzie <acm@muc.de>
* emacs-lisp/easy-mmode.el (define-globalized-minor-mode): When a
global minor mode has been enabled, call the minor mode function
for a new buffer once only, after the major mode hook, whilst
allowing that hook explicitly to disable the minor mode.
(MODE-disable-in-buffer): new (generated) function.
(disable-MODE): new (generated) buffer local variable.
(MODE-disable-in-buffer): New (generated) function.
(disable-MODE): New (generated) buffer local variable.
2013-02-15 Jambunathan K <kjambunathan@gmail.com>
@@ -52,8 +56,8 @@
2013-02-14 Michael Albinus <michael.albinus@gmx.de>
* net/tramp.el (tramp-debug-message): Add
`tramp-condition-case-unless-debug'.
* net/tramp.el (tramp-debug-message):
Add `tramp-condition-case-unless-debug'.
(tramp-debug-on-error): New defvar.
(tramp-condition-case-unless-debug): New defun.
(tramp-file-name-handler): Use it.
@@ -207,8 +211,8 @@
* net/tramp-compat.el (top): Declare `remote-file-name-inhibit-cache'
only if it doesn't exist.
* net/tramp-sh.el (tramp-sh-handle-start-file-process): Set
process marker.
* net/tramp-sh.el (tramp-sh-handle-start-file-process):
Set process marker.
2013-02-12 Tassilo Horn <tsdh@gnu.org>

View File

@@ -1293,13 +1293,12 @@ display the result of expression evaluation."
;; We define this, rather than making `eval' interactive,
;; for the sake of completion of names like eval-region, eval-buffer.
(defun eval-expression (eval-expression-arg
&optional eval-expression-insert-value)
"Evaluate EVAL-EXPRESSION-ARG and print value in the echo area.
(defun eval-expression (exp &optional insert-value)
"Evaluate EXP and print value in the echo area.
When called interactively, read an Emacs Lisp expression and
evaluate it.
Value is also consed on to front of the variable `values'.
Optional argument EVAL-EXPRESSION-INSERT-VALUE non-nil (interactively,
Optional argument INSERT-VALUE non-nil (interactively,
with prefix argument) means insert the result into the current buffer
instead of printing it in the echo area. Truncates long output
according to the value of the variables `eval-expression-print-length'
@@ -1315,12 +1314,12 @@ this command arranges for all errors to enter the debugger."
current-prefix-arg))
(if (null eval-expression-debug-on-error)
(push (eval eval-expression-arg lexical-binding) values)
(push (eval exp lexical-binding) values)
(let ((old-value (make-symbol "t")) new-value)
;; Bind debug-on-error to something unique so that we can
;; detect when evalled code changes it.
(let ((debug-on-error old-value))
(push (eval eval-expression-arg lexical-binding) values)
(push (eval exp lexical-binding) values)
(setq new-value debug-on-error))
;; If evalled code has changed the value of debug-on-error,
;; propagate that change to the global binding.
@@ -1328,8 +1327,9 @@ this command arranges for all errors to enter the debugger."
(setq debug-on-error new-value))))
(let ((print-length eval-expression-print-length)
(print-level eval-expression-print-level))
(if eval-expression-insert-value
(print-level eval-expression-print-level)
(deactivate-mark))
(if insert-value
(with-no-warnings
(let ((standard-output (current-buffer)))
(prin1 (car values))))