]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow text properties in minibuffer output unconditionally
authorEshel Yaron <me@eshelyaron.com>
Mon, 13 May 2024 20:03:31 +0000 (22:03 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 13 May 2024 20:16:44 +0000 (22:16 +0200)
(minibuffer-allow-text-properties): Obsolete.
(read_minibuf): Drop 'allow_props' argument.
(choose-completion): Retain text properties.

doc/lispref/minibuf.texi
lisp/erc/erc.el
lisp/imenu.el
lisp/isearch.el
lisp/minibuffer.el
lisp/org/org-protocol.el
lisp/replace.el
lisp/simple.el
src/minibuf.c

index 59f63ed7901056db8960833d557ad1f302af5a52..4a5064e8d28630e4987e256f1b50140dc8f82219 100644 (file)
@@ -184,12 +184,6 @@ symbol @code{t}, history is not recorded.  You can optionally specify
 a starting position in the history list as well.  @xref{Minibuffer
 History}.
 
-If the variable @code{minibuffer-allow-text-properties} is
-non-@code{nil}, then the string that is returned includes whatever text
-properties were present in the minibuffer.  Otherwise all the text
-properties are stripped when the value is returned.  (By default this
-variable is @code{nil}.)
-
 @vindex minibuffer-prompt-properties
 The text properties in @code{minibuffer-prompt-properties} are applied
 to the prompt.  By default, this property list defines a face to use
@@ -350,25 +344,6 @@ or a list of strings.
 See @code{read-regexp} above for details of how these values are used.
 @end defopt
 
-@defvar minibuffer-allow-text-properties
-If this variable is @code{nil}, the default, then
-@code{read-from-minibuffer} strips all text properties from the
-minibuffer input before returning it.  Otherwise, the minibuffer input
-is returned as is, along with its text properties.  Moreover, if this
-variable is non-@code{nil}, most text properties on strings from the
-completion table are preserved as well.
-
-@lisp
-(let ((minibuffer-allow-text-properties t))
-  (completing-read "String: " (list (propertize "foobar" 'data 'zot))))
-=> #("foobar" 3 6 (data zot))
-@end lisp
-
-In this example, the user typed @samp{foo} and then hit the @kbd{TAB}
-key, so the text properties are only preserved on the last three
-characters.
-@end defvar
-
 @vindex minibuffer-mode-map
 @defvar minibuffer-local-map
 This
@@ -469,20 +444,9 @@ This function reads a Lisp object using the minibuffer, and returns it
 without evaluating it.  The arguments @var{prompt} and @var{initial} are
 used as in @code{read-from-minibuffer}.
 
-This is a simplified interface to the
-@code{read-from-minibuffer} function:
-
-@smallexample
-@group
-(read-minibuffer @var{prompt} @var{initial})
-@equiv{}
-(let (minibuffer-allow-text-properties)
-  (read-from-minibuffer @var{prompt} @var{initial} nil t))
-@end group
-@end smallexample
-
-Here is an example in which we supply the string @code{"(testing)"} as
-initial input:
+This is a simplified interface to the @code{read-from-minibuffer}
+function.  Here is an example in which we supply the string
+@code{"(testing)"} as initial input:
 
 @smallexample
 @group
index c92fd42322ac784f5ba19f29b90cc4425e902d5f..5ac1016558489147681eebf92e6845fcfe34ce89 100644 (file)
@@ -5700,8 +5700,7 @@ If FACE is non-nil, it will be used to propertize the prompt.  If it is nil,
 (defun erc-input-message ()
   "Read input from the minibuffer."
   (interactive)
-  (let ((minibuffer-allow-text-properties t)
-        (read-map minibuffer-local-map))
+  (let ((read-map minibuffer-local-map))
     (insert (read-from-minibuffer "Message: "
                                   (string last-command-event)
                                  read-map))
index 2b1d4f5ce8546273c09f8e11d31b2f9dc1e38dfd..3b9b77bb4fcf4b2500e0498c4f41d3dbc7c59fae 100644 (file)
@@ -758,8 +758,8 @@ Return one of the entries in index-alist or nil."
           (unless imenu-eager-completion-buffer
             (minibuffer-completion-help)))
       (setq name (completing-read prompt
-                                 prepared-index-alist
-                                 nil t nil 'imenu--history-list name)))
+                                 prepared-index-alist
+                                 nil t nil 'imenu--history-list name)))
 
     (when (stringp name)
       (setq choice (assoc name prepared-index-alist))
index 88921c3179c6dbbe81ddd65ed5068a110fc2bb4c..43b8afad10a4ba68042e885cffedcd33c5a38c4f 100644 (file)
@@ -1846,9 +1846,7 @@ The following additional command keys are active while editing.
    (let* ((message-log-max nil)
          ;; Binding minibuffer-history-symbol to nil is a work-around
          ;; for some incompatibility with gmhist.
-         (minibuffer-history-symbol)
-         ;; Search string might have meta information on text properties.
-         (minibuffer-allow-text-properties t))
+         (minibuffer-history-symbol))
      (setq isearch-new-string
           (minibuffer-with-setup-hook
                (let ((setup (minibuffer-lazy-highlight-setup)))
index b5ce4a57e0fad8bd63552a64407d9427cf0bde09..ad88822ff16510a39889712a61b116a2b884cd25 100644 (file)
@@ -1425,14 +1425,8 @@ Moves point to the end of the new text."
   ;; The properties on `newtext' include things like the
   ;; `completions-first-difference' face, which we don't want to
   ;; include upon insertion.
-  (setq newtext (copy-sequence newtext)) ;Don't modify the arg by side-effect.
-  (if minibuffer-allow-text-properties
-      ;; If we're preserving properties, then just remove the faces
-      ;; and other properties added by the completion machinery.
-      (remove-text-properties 0 (length newtext) '(face completion-score)
-                              newtext)
-    ;; Remove all text properties.
-    (set-text-properties 0 (length newtext) nil newtext))
+  (setq newtext (copy-sequence newtext))
+  (remove-text-properties 0 (length newtext) '(face) newtext)
   ;; Maybe this should be in subr.el.
   ;; You'd think this is trivial to do, but details matter if you want
   ;; to keep markers "at the right place" and be robust in the face of
@@ -6198,6 +6192,9 @@ This applies to `completions-auto-update-mode', which see."
 (defvar minibuffer-help-form nil "Unused obsolete variable.")
 (make-obsolete-variable 'minibuffer-help-form 'help-form "30.1")
 
+(defvar minibuffer-allow-text-properties nil "Unused obsolete variable.")
+(make-obsolete-variable 'minibuffer-allow-text-properties nil "30.1")
+
 (defvar-local minibuffer-hint-timer nil)
 
 (defcustom minibuffer-hint-idle-time 0.4
index 61a9229adf10ab6526244f0d4d8615410065de01..6b6664fc375eac397824e89b62daaebd1b79633b 100644 (file)
@@ -745,8 +745,7 @@ the cdr of an element in `org-publish-project-alist', reuse
         (working-suffix (if (plist-get project-plist :base-extension)
                             (concat "." (plist-get project-plist :base-extension))
                           ".org"))
-        (insert-default-directory t)
-        (minibuffer-allow-text-properties nil))
+        (insert-default-directory t))
 
     (setq base-url (read-string "Base URL of published content: " base-url nil base-url t))
     (or (string-suffix-p "/" base-url)
index ce18f6269edc08121b2777955220f0b52fcf8060..14b16172e45da2cd2e100e5c7e9a181326ceb25a 100644 (file)
@@ -228,7 +228,6 @@ wants to replace FROM with TO."
                                (query-replace-descr (cdr from-to))))
                      query-replace-defaults))
            (symbol-value query-replace-from-history-variable)))
-         (minibuffer-allow-text-properties t) ; separator uses text-properties
          (default (when (and query-replace-read-from-default (not regexp-flag))
                     (funcall query-replace-read-from-default)))
          (prompt
index 3eb3874f1165e04d7d432ceac9c156e6bf65b8ca..154f3f587de129a804a9c934a1487a3da4e32576 100644 (file)
@@ -10169,8 +10169,7 @@ minibuffer, but don't quit the completions window."
                (setq beg (or (previous-single-property-change
                               beg 'completion--string)
                              beg))
-               (substring-no-properties
-                (get-text-property beg 'completion--string))))))
+               (get-text-property beg 'completion--string)))))
 
       (unless (buffer-live-p buffer)
         (error "Destination buffer is dead"))
index 74588c20c23336667df6c6ca822782d6ad45a11a..569316c13568d191d1dfafdf21453e105f789dd1 100644 (file)
@@ -563,16 +563,14 @@ 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 INHERIT_INPUT_METHOD, the minibuffer inherits the
    current input method.  */
 
 static Lisp_Object
-read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
-             bool expflag,
-             Lisp_Object histvar, Lisp_Object histpos, Lisp_Object defalt,
-             bool allow_props, bool inherit_input_method)
+read_minibuf (Lisp_Object map, Lisp_Object initial,
+             Lisp_Object prompt, bool expflag, Lisp_Object histvar,
+             Lisp_Object histpos, Lisp_Object defalt,
+             bool inherit_input_method)
 {
   Lisp_Object val;
   specpdl_ref count = SPECPDL_INDEX ();
@@ -910,10 +908,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
 
   /* Make minibuffer contents into a string.  */
   Fset_buffer (minibuffer);
-  if (allow_props)
-    val = Fminibuffer_contents ();
-  else
-    val = Fminibuffer_contents_no_properties ();
+  val = Fminibuffer_contents ();
 
   /* VAL is the string of minibuffer text.  */
 
@@ -1301,10 +1296,6 @@ 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,
- then the string which is returned includes whatever text properties
- were present in the minibuffer.  Otherwise the value has no text properties.
-
 If `inhibit-interaction' is non-nil, this function will signal an
   `inhibited-interaction' error.
 
@@ -1363,7 +1354,6 @@ and some related functions, which use zero-indexing for POSITION.  */)
   val = read_minibuf (keymap, initial_contents, prompt,
                      !NILP (read),
                      histvar, histpos, default_value,
-                     minibuffer_allow_text_properties,
                      !NILP (inherit_input_method));
   return val;
 }
@@ -2328,11 +2318,6 @@ is added with
 Some uses of the echo area also raise that frame (since they use it too).  */);
   minibuffer_auto_raise = 0;
 
-  DEFVAR_BOOL ("minibuffer-allow-text-properties",
-              minibuffer_allow_text_properties,
-              doc: /* Whether `read-from-minibuffer' preserves text properties.  */);
-  minibuffer_allow_text_properties = 0;
-
   DEFVAR_LISP ("minibuffer-prompt-properties", Vminibuffer_prompt_properties,
               doc: /* Text properties that are added to minibuffer prompts.
 These are in addition to the basic `field' property, and stickiness