From: Gregory Heytings <gregory@heytings.org>
To: "Nicolas P. Rougier (inria)" <nicolas.rougier@inria.fr>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: Reading text properties from a yanked text
Date: Sun, 27 Nov 2022 07:10:57 +0000 [thread overview]
Message-ID: <3d2972a5f53227c7ff8a@heytings.org> (raw)
In-Reply-To: <m1mt8cyjkr.fsf@inria.fr>
>
> For example this returns (face bold):
>
> (with-temp-buffer
> (insert (propertize "Hello" 'face 'bold))
> (kill-region (point-min) (point-max))
> (yank)
> (text-properties-at 0
> (buffer-substring (point-min) (point-max))))
>
> While this returns nil:
>
> (with-temp-buffer
> (insert (propertize "Hello" 'face 'bold))
> (kill-region (point-min) (point-max))
> (insert (format "(text-properties-at 0 \"%s\")"
> (current-kill 0)))
> (eval-buffer))
>
The Lisp reader does not see the text properties of the text it reads.
Unless you use the special "#(...)" construct, in which text properties
are explicitly specified, and case you'll get them. E.g. you can eval the
following
(text-properties-at 0 #("Hello" 0 4 (face bold)))
to get what you want.
next prev parent reply other threads:[~2022-11-27 7:10 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-26 21:35 Reading text properties from a yanked text Nicolas P. Rougier (inria)
2022-11-26 23:03 ` [External] : " Drew Adams
2022-11-27 6:07 ` Nicolas P. Rougier (inria)
2022-11-27 7:08 ` Stefan Monnier
2022-11-26 23:26 ` Gregory Heytings
2022-11-27 6:08 ` Nicolas P. Rougier (inria)
2022-11-27 6:14 ` Eli Zaretskii
2022-11-27 6:16 ` Nicolas P. Rougier (inria)
2022-11-27 7:10 ` Eli Zaretskii
2022-11-27 7:29 ` Nicolas P. Rougier (inria)
2022-12-01 23:25 ` Richard Stallman
2022-11-27 7:10 ` Gregory Heytings [this message]
2022-11-27 7:14 ` Gregory Heytings
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3d2972a5f53227c7ff8a@heytings.org \
--to=gregory@heytings.org \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=nicolas.rougier@inria.fr \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).