* Strange inconsistency with face preservation in yanking
@ 2025-01-05 3:40 Yuchen Pei
0 siblings, 0 replies; only message in thread
From: Yuchen Pei @ 2025-01-05 3:40 UTC (permalink / raw)
To: Emacs Devel mailing list
Hi,
If I do
#+begin_src emacs-lisp
(setq bar "
(defun my-hello ()
(message \"hello\")
")
(defun my-insert-copy ()
(insert bar)
(copy-region-as-kill (point-min) (point-max)))
#+end_src
Open a new elisp file, e.g. foo.el in a buffer, and another file with no
extension, e.g. foo in another buffer. Have them both side by side in
two windows.
In the buffer foo.el, if we eval the function call (my-insert-copy),
then switch to the buffer foo, and call (yank) or just do C-y. The text
is pasted without elisp syntax highlight.
However, if we eval the two expressions inside the body of
my-insert-copy one by one, i.e.
(insert bar)
(copy-region-as-kill (point-min) (point-max))
Then switch to the buffer foo, and do C-y
The highlight is preserved.
Why?
Best,
Yuchen
--
Dr Yuchen Pei | https://ypei.org | Timezone: UTC+11
PGP Key: 47F9 D050 1E11 8879 9040 4941 2126 7E93 EF86 DFD0
https://ypei.org/assets/ypei-pubkey.txt
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-01-05 3:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-05 3:40 Strange inconsistency with face preservation in yanking Yuchen Pei
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.