emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU Emacs raison d'etre


From: Dmitry Gutov
Subject: Re: GNU Emacs raison d'etre
Date: Fri, 22 May 2020 01:19:54 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 21.05.2020 05:28, Eli Zaretskii wrote:
eval-last-sexp uses prin1 to display the result, so it is not
affected, as intended.
But aren't all echo area displays targeted at the user anyway?

I'm not saying the current behavior is necessarily "broken", but perhaps
we could enhance it further.
The intent was to affect messages that are a "surprise" for the user.
eval-last-sexp is invoked by the user, so no surprise here.

But not all 'message' calls are a "surprise". One might even say that the vast majority of them aren't. And yet, they obey set-message-function.

eval-last-sexp uses 'prin1' under the covers. While it's different from 'message', it's not entirely clear to me that it's intended to be different semantically, e.g. used for distinctly different purposes. So I might as well imagine the same code that calls 'message' decide at some point to call 'prin1' (in addition to 'message', or instead).

Looking at its description, it could delegate to 'standard-output', which is overridable. It's not particularly convenient, though.

But this patch would do it:

@@ -1132,7 +1132,7 @@
     ;; Setup the lexical environment if lexical-binding is enabled.
     (elisp--eval-last-sexp-print-value
(eval (eval-sexp-add-defvars (elisp--preceding-sexp)) lexical-binding)
-     (if insert-value (current-buffer) t) no-truncate char-print-limit)))
+     (if insert-value (current-buffer)) no-truncate char-print-limit)))

 (defun elisp--eval-last-sexp-print-value
     (value output &optional no-truncate char-print-limit)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]