unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 031e1c2: Regexp-quote literal symbols when grepping
       [not found] ` <20210918114626.6FF8F20ABE@vcs0.savannah.gnu.org>
@ 2021-09-18 23:47   ` Dmitry Gutov
  2021-09-19  7:35     ` Mattias Engdegård
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Gutov @ 2021-09-18 23:47 UTC (permalink / raw)
  To: emacs-devel, Mattias Engdegård

On 18.09.2021 14:46, Mattias Engdeg�rd wrote:
> +(defun semantic-symref-grep--quote-extended (string)
> +  "Quote STRING as an extended-syntax regexp."
> +  (replace-regexp-in-string (rx (in ".^$*+?|{}[]()|\\"))
> +                            (lambda (s) (concat "\\" s))
> +                            string nil t))
> +
>   (cl-defmethod semantic-symref-perform-search ((tool semantic-symref-tool-grep))
>     "Perform a search with Grep."
>     ;; Grep doesn't support some types of searches.
> @@ -151,7 +157,10 @@ This shell should support pipe redirect syntax."
>                             ((eq (oref tool searchtype) 'regexp)
>                              "-nE ")
>                             (t "-nw ")))
> -         (greppat (oref tool searchfor))
> +         (searchfor (oref tool searchfor))
> +         (greppat (if (eq (oref tool searchtype) 'regexp)
> +                      searchfor
> +                    (semantic-symref-grep--quote-extended searchfor)))

When the search is not 'regexp', we're using the default regexp mode of 
Grep, which is Basic, not Extended.

So this doesn't seem like the right change (yet?).

It's not particularly breaking for xref-find-references because of its 
post-filtering step, and because most of these chars are rarely present 
in symbol names, but it probably breaks 'M-x semantic-symref' (which 
doesn't do any post-filtering) because \? and \+ are actually special in 
Basic regexps. I haven't been able to test it, though.

It does break xref-find-references for symbols with '+' somewhere in the 
middle, like 'antlr-c++-mode-extra'.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: master 031e1c2: Regexp-quote literal symbols when grepping
  2021-09-18 23:47   ` master 031e1c2: Regexp-quote literal symbols when grepping Dmitry Gutov
@ 2021-09-19  7:35     ` Mattias Engdegård
  0 siblings, 0 replies; 2+ messages in thread
From: Mattias Engdegård @ 2021-09-19  7:35 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: emacs-devel

19 sep. 2021 kl. 01.47 skrev Dmitry Gutov <dgutov@yandex.ru>:

> When the search is not 'regexp', we're using the default regexp mode of Grep, which is Basic, not Extended.

Sorry, this was a silly mistake, now rectified. Thanks you!




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-19  7:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210918114625.2175.90107@vcs0.savannah.gnu.org>
     [not found] ` <20210918114626.6FF8F20ABE@vcs0.savannah.gnu.org>
2021-09-18 23:47   ` master 031e1c2: Regexp-quote literal symbols when grepping Dmitry Gutov
2021-09-19  7:35     ` Mattias Engdegård

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).