From 6c8f113e705fe7f58695fdeda04aaa6a9c9b8a93 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 15 Feb 2013 18:47:50 -0500 Subject: [PATCH] * lisp/simple.el (eval-expression): Let `exp' set the mark. Fixes: debbugs:13724 --- lisp/ChangeLog | 16 ++++++++++------ lisp/simple.el | 16 ++++++++-------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 99704a0b532..064ad686fca 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,11 +1,15 @@ +2013-02-15 Stefan Monnier + + * simple.el (eval-expression): Let `exp' set the mark (bug#13724). + 2013-02-15 Alan Mackenzie * 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 @@ -52,8 +56,8 @@ 2013-02-14 Michael Albinus - * 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 diff --git a/lisp/simple.el b/lisp/simple.el index 849f7dac55c..138c2420309 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -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)))) -- 2.39.5