summaryrefslogtreecommitdiff
path: root/src/minibuf.c
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2024-05-27 21:18:17 +0300
committerJuri Linkov <juri@linkov.net>2024-05-27 21:19:53 +0300
commit2cadad6f8ce47921cb014d2c5dd3e897e85c47ce (patch)
tree75a925557845a41af3588289e99054d244913a5c /src/minibuf.c
parent804f36d5abdbc38a4664a341aaea563195f79b03 (diff)
downloademacs-2cadad6f8ce47921cb014d2c5dd3e897e85c47ce.tar.gz
emacs-2cadad6f8ce47921cb014d2c5dd3e897e85c47ce.tar.bz2
emacs-2cadad6f8ce47921cb014d2c5dd3e897e85c47ce.zip
minibuffer-allow-text-properties can be buffer-local and affects completions
* doc/lispref/minibuf.texi (Text from Minibuffer): Mention that minibuffer-allow-text-properties can be let-bound or buffer-local in the minibuffer. Correct the description of minibuffer-allow-text-properties to explain what it did even before applying code changes in this patch. Remove wrong example for read-no-blanks-input. * lisp/imenu.el (imenu--completion-buffer): Set buffer-local minibuffer-allow-text-properties to t. (imenu--completion-buffer): Get text property 'imenu-choice'. (imenu--flatten-index-alist): Propertize annotation with text property 'imenu-choice'. * lisp/simple.el (choose-completion): Don't remove text properties from the returned completion string since the value of minibuffer-allow-text-properties is already respected in completion--replace. * src/minibuf.c (read_minibuf): Preserve text properties not only when allow_props is non-nil but also in case when minibuffer_allow_text_properties is non-nil. (Fread_from_minibuffer): Mention in the docstring that minibuffer-allow-text-properties can be buffer-local in the minibuffer. (minibuffer-allow-text-properties): Improve docstring to describe when text properties are discarded. https://lists.gnu.org/archive/html/emacs-devel/2024-05/msg00949.html
Diffstat (limited to 'src/minibuf.c')
-rw-r--r--src/minibuf.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/minibuf.c b/src/minibuf.c
index 9c1c86680d4..1dfee0a59c9 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -563,7 +563,8 @@ If the current buffer is not a minibuffer, return its entire contents. */)
DEFALT specifies the default value for the sake of history commands.
- If ALLOW_PROPS, do not throw away text properties.
+ If ALLOW_PROPS or `minibuffer-allow-text-properties' (possibly
+ buffer-local) is non-nil, do not throw away text properties.
if INHERIT_INPUT_METHOD, the minibuffer inherits the
current input method. */
@@ -928,7 +929,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
/* Make minibuffer contents into a string. */
Fset_buffer (minibuffer);
- if (allow_props)
+ if (allow_props || minibuffer_allow_text_properties)
val = Fminibuffer_contents ();
else
val = Fminibuffer_contents_no_properties ();
@@ -1321,7 +1322,8 @@ Sixth arg DEFAULT-VALUE, if non-nil, should be a string, which is used
Seventh arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
the current input method and the setting of `enable-multibyte-characters'.
-If the variable `minibuffer-allow-text-properties' is non-nil,
+If the variable `minibuffer-allow-text-properties' is non-nil
+ (either let-bound or buffer-local in the minibuffer),
then the string which is returned includes whatever text properties
were present in the minibuffer. Otherwise the value has no text properties.
@@ -2464,9 +2466,10 @@ basic completion functions like `try-completion' and `all-completions'. */);
DEFVAR_BOOL ("minibuffer-allow-text-properties",
minibuffer_allow_text_properties,
doc: /* Non-nil means `read-from-minibuffer' should not discard text properties.
-This also affects `read-string', but it does not affect `read-minibuffer',
-`read-no-blanks-input', or any of the functions that do minibuffer input
-with completion; they always discard text properties. */);
+The value could be let-bound or buffer-local in the minibuffer.
+This also affects `read-string', or any of the functions that do
+minibuffer input with completion, but it does not affect `read-minibuffer'
+that always discards text properties. */);
minibuffer_allow_text_properties = 0;
DEFVAR_LISP ("minibuffer-prompt-properties", Vminibuffer_prompt_properties,