[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: |
Mon, 05 Apr 2021 01:55:18 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
>> This is the simplest implementation:
>> #+begin_src emacs-lisp
>> (defun project-find-word (regexp)
>> "Word-based version of ‘project-find-regexp’.
>> Modifies the ‘xref-search-program-alist’ template
>> to add the option ‘-w’ that matches whole words."
>> (interactive (list (project--read-regexp)))
>> (let ((xref-search-program-alist
>> (mapcar (lambda (p)
>> (cons (car p) (replace-regexp-in-string "<C>" "-w \\&"
>> (cdr p))))
>> xref-search-program-alist)))
>> (project-find-regexp regexp)))
>> #+end_src
>
> Wouldn't it work the same if you instead modify the regexp to be surrounded
> with \b...\b?
Indeed, with more typing. Ideally, there should be an isearch command
that will send the constructed regexp to 'project-find-regexp' from
isearch word-mode, symbol-mode like:
#+begin_src emacs-lisp
(define-key isearch-mode-map "\C-xpg" 'isearch-project-find-regexp)
(defun isearch-project-find-regexp ()
(interactive)
(let ((isearch-recursive-edit nil))
(isearch-done nil t)
(isearch-clean-overlays))
(let ((regexp (cond ((functionp isearch-regexp-function)
(funcall isearch-regexp-function isearch-string))
(isearch-regexp-function (word-search-regexp
isearch-string))
(isearch-regexp isearch-string)
(t (regexp-quote isearch-string)))))
(project-find-regexp regexp))
(and isearch-recursive-edit (exit-recursive-edit)))
#+end_src
But unfortunately it fails on ripgrep with:
Search failed with status 123: regex parse error
Maybe because ripgrep can't swallow Emacs regexps.
- bug#47012: xref copies keymap properties to minibuffer, (continued)
- bug#47012: xref copies keymap properties to minibuffer, Dmitry Gutov, 2021/04/01
- bug#47012: xref copies keymap properties to minibuffer, Eli Zaretskii, 2021/04/02
- bug#47012: xref copies keymap properties to minibuffer, Dmitry Gutov, 2021/04/02
- bug#47012: xref copies keymap properties to minibuffer, Eli Zaretskii, 2021/04/03
- bug#47012: xref copies keymap properties to minibuffer, Dmitry Gutov, 2021/04/03
- bug#47012: xref copies keymap properties to minibuffer, Eli Zaretskii, 2021/04/03
- bug#47012: xref copies keymap properties to minibuffer, Juri Linkov, 2021/04/02
- bug#47012: xref copies keymap properties to minibuffer, Dmitry Gutov, 2021/04/01
- bug#47012: xref copies keymap properties to minibuffer, Juri Linkov, 2021/04/02
- bug#47012: xref copies keymap properties to minibuffer, Dmitry Gutov, 2021/04/02
- bug#47012: xref copies keymap properties to minibuffer,
Juri Linkov <=
- bug#47012: xref copies keymap properties to minibuffer, Dmitry Gutov, 2021/04/04