From: Eli Zaretskii <eliz@gnu.org>
To: Devon Sean McCullough <Emacs-hacker2023@jovi.net>
Cc: 70931@debbugs.gnu.org
Subject: bug#70931: 29.3; scratch
Date: Tue, 14 May 2024 13:46:17 +0300 [thread overview]
Message-ID: <86ikzgwu12.fsf@gnu.org> (raw)
In-Reply-To: <a05b3f9743752358033dd9bb08824b16@jovi.net> (message from Devon Sean McCullough on Tue, 14 May 2024 04:52:59 -0500)
> Date: Tue, 14 May 2024 04:52:59 -0500
> From: Devon Sean McCullough <Emacs-hacker2023@jovi.net>
>
> $ Open -n -a /Applications/Emacs.app --args -Q
>
> (find-file "/tmp/x") ; then Control-J
>
> ;; A buffer appears named x
> ;; containing the text #<buffer x>
> ;; but that text should instead be in the buffer named *scratch*
Thanks. This was caused by a too-eager simplification made back when
Emacs 26 was being developed.
Does the patch below give good results?
CC'ing Stefan in case he has comments.
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 84814c9..d96fbbd 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1557,13 +1557,16 @@ elisp--eval-last-sexp
(pcase-let*
((`(,insert-value ,no-truncate ,char-print-limit)
(eval-expression-get-print-arguments eval-last-sexp-arg-internal)))
- ;; Setup the lexical environment if lexical-binding is enabled.
- (elisp--eval-last-sexp-print-value
- (eval (macroexpand-all
- (eval-sexp-add-defvars
- (elisp--eval-defun-1 (macroexpand (elisp--preceding-sexp)))))
- lexical-binding)
- (if insert-value (current-buffer) t) no-truncate char-print-limit)))
+ ;; The expression might change to a different buffer, so record that
+ ;; now.
+ (let ((output (if insert-value (current-buffer) t)))
+ ;; Setup the lexical environment if lexical-binding is enabled.
+ (elisp--eval-last-sexp-print-value
+ (eval (macroexpand-all
+ (eval-sexp-add-defvars
+ (elisp--eval-defun-1 (macroexpand (elisp--preceding-sexp)))))
+ lexical-binding)
+ output no-truncate char-print-limit))))
(defun elisp--eval-last-sexp-print-value
(value output &optional no-truncate char-print-limit)
next prev parent reply other threads:[~2024-05-14 10:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-14 9:52 bug#70931: 29.3; scratch Devon Sean McCullough
2024-05-14 10:46 ` Eli Zaretskii [this message]
[not found] ` <390268bbc2b43d05b04a76625bd3beac@jovi.net>
2024-05-14 11:57 ` Eli Zaretskii
2024-05-18 9:57 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86ikzgwu12.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=70931@debbugs.gnu.org \
--cc=Emacs-hacker2023@jovi.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.