GNU bug report logs - #12985
eval-last-sexp looks broken when executed twice

Previous Next

Package: emacs;

Reported by: Kelly Dean <kellydeanch <at> yahoo.com>

Date: Sun, 25 Nov 2012 01:54:02 UTC

Severity: minor

Tags: notabug

Merged with 15655

Done: Juri Linkov <juri <at> jurta.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> jurta.org>
To: Kelly Dean <kellydeanch <at> yahoo.com>
Cc: 12985 <at> debbugs.gnu.org
Subject: bug#12985: eval-last-sexp looks broken when executed twice
Date: Thu, 09 May 2013 00:19:09 +0300
>> It seems a better design would be to always include the string, even
>> the first time, when displaying in the echo area, and never include
>> the string when printing into the buffer, regardless of the invoking
>> command name. This is simpler, and it's how eval-expression already works.
>
> Thank you for suggesting a new design.  I agree it is better
> than the current design.  The patch below implements it and
> removes the feature of behaving differently when called twice.

Since this feature will use a better design now,
more commands could benefit from this feature:
`C-M-x' (`eval-defun' and `edebug-eval-defun')
and `ielm-send-input'.

=== modified file 'lisp/emacs-lisp/lisp-mode.el'
--- lisp/emacs-lisp/lisp-mode.el	2013-05-06 20:23:40 +0000
+++ lisp/emacs-lisp/lisp-mode.el	2013-05-08 21:12:52 +0000
@@ -928,6 +928,8 @@ (defun eval-defun-2 ()
 		 ;; will make eval-region return.
 		 (goto-char ,end)
 		 ',form))))))
+  (let ((str (eval-expression-print-format (car values))))
+    (if str (princ str)))
   ;; The result of evaluation has been put onto VALUES.  So return it.
   (car values))
 

=== modified file 'lisp/emacs-lisp/edebug.el'
--- lisp/emacs-lisp/edebug.el	2013-04-08 02:21:59 +0000
+++ lisp/emacs-lisp/edebug.el	2013-05-08 21:17:06 +0000
@@ -528,7 +528,10 @@ (defun edebug-eval-defun (edebug-it)
 			(put (nth 1 form) 'saved-face nil)))))
     (setq edebug-result (eval (eval-sexp-add-defvars form) lexical-binding))
     (if (not edebugging)
-	(princ edebug-result)
+	(prog1
+	    (princ edebug-result)
+	  (let ((str (eval-expression-print-format edebug-result)))
+	    (if str (princ str))))
       edebug-result)))
 
 
=== modified file 'lisp/ielm.el'
--- lisp/ielm.el	2013-01-01 09:11:05 +0000
+++ lisp/ielm.el	2013-05-08 21:10:23 +0000
@@ -408,7 +408,8 @@ (defun ielm-eval-input (input-string)
 	(condition-case nil
 	    ;; Self-referential objects cause loops in the printer, so
 	    ;; trap quits here. May as well do errors, too
-	    (setq ielm-output (concat ielm-output (pp-to-string ielm-result)))
+	    (setq ielm-output (concat ielm-output (pp-to-string ielm-result)
+				      (eval-expression-print-format ielm-result)))
 	  (error (setq ielm-error-type "IELM Error")
 		 (setq ielm-result "Error during pretty-printing (bug in pp)"))
 	  (quit  (setq ielm-error-type "IELM Error")





This bug report was last modified 11 years and 152 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.