* read-string-from-buffer: Removing text properties
@ 2024-03-08 11:58 Thanos Apollo
2024-03-08 13:08 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Thanos Apollo @ 2024-03-08 11:58 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 995 bytes --]
Hello emacs-devel,
I'm trying to use read-string-from-buffer & I have found some
interesting interactions that it has with text properties.
Example:
(read-string-from-buffer "Prompt" (propertize "warning face" 'face 'warning))
;; Returns: #("warning face" 0 12 (face warning))
Should it not read-string-from-buffer behave similarly to read-string,
and just return a string?
If this is not intentional, just applying substring-no-properties should
resolve this.
Example:
(defun read-string-from-buffer (prompt string)
"Switch to a new buffer to edit STRING in a recursive edit.
Also see `string-edit'."
(string-edit prompt string
(lambda (edited)
(setq string (substring-no-properties edited))
(exit-recursive-edit))
:abort-callback (lambda ()
(exit-recursive-edit)
(error "Aborted edit")))
(recursive-edit)
string)
Thank you,
--
Thanos Apollo
https://thanosapollo.org
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 865 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: read-string-from-buffer: Removing text properties
2024-03-08 11:58 read-string-from-buffer: Removing text properties Thanos Apollo
@ 2024-03-08 13:08 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2024-03-08 13:08 UTC (permalink / raw)
To: Thanos Apollo; +Cc: emacs-devel
> From: Thanos Apollo <public@thanosapollo.org>
> Date: Fri, 08 Mar 2024 13:58:54 +0200
>
> I'm trying to use read-string-from-buffer & I have found some
> interesting interactions that it has with text properties.
>
> Example:
>
> (read-string-from-buffer "Prompt" (propertize "warning face" 'face 'warning))
>
> ;; Returns: #("warning face" 0 12 (face warning))
>
> Should it not read-string-from-buffer behave similarly to read-string,
> and just return a string?
What read-string does is AFAIU controlled by the variable
minibuffer-allow-text-properties, so it doesn't always discard the
text properties.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-08 13:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-08 11:58 read-string-from-buffer: Removing text properties Thanos Apollo
2024-03-08 13:08 ` Eli Zaretskii
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).