bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47012: xref copies keymap properties to minibuffer


From: Juri Linkov
Subject: bug#47012: xref copies keymap properties to minibuffer
Date: Wed, 24 Mar 2021 22:38:34 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>> FWIW, it's was project.el's problem, not xref's.
>
> I thought it's the xref's problem because Help says it's in xref.el.
> Typing 'C-h f project--read-regexp RET' shows:
>
>   project--read-regexp is a Lisp function in ‘xref.el’.
>
> But this is because I tried to override this function in the init file:
>
> ;; Redefine to use `minibuffer-history':
> (with-eval-after-load 'project
>   (defun project--read-regexp ()
>     (let ((sym (thing-at-point 'symbol t)))
>       (read-regexp "Find regexp"
>                    (and sym (regexp-quote sym))
>                    'minibuffer-history))))
>
> Oh, well, need to find another way to do this
> (no feature request for this :-)

Actually, can't do this without feature request,
and can't use it as is, because never use regexp
while searching in project, whereas it pollutes
the regexp history for commands where I really
use regexps, not just strings.

A simple patch could be a saver to use with e.g.
(setq project-regexp-history-variable 'minibuffer-history):

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index b6a886f731..280a8d8929 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -781,9 +781,12 @@ project--find-regexp-in-files
       (user-error "No matches for: %s" regexp))
     xrefs))
 
+(defvar project-regexp-history-variable nil)
+
 (defun project--read-regexp ()
   (let ((sym (thing-at-point 'symbol t)))
-    (read-regexp "Find regexp" (and sym (regexp-quote sym)))))
+    (read-regexp "Find regexp" (and sym (regexp-quote sym))
+                 project-regexp-history-variable)))
 
 ;;;###autoload
 (defun project-find-file ()

reply via email to

[Prev in Thread] Current Thread [Next in Thread]