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

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

Re: Use Vertico + consult to do the search for an exact word.


From: Hongyi Zhao
Subject: Re: Use Vertico + consult to do the search for an exact word.
Date: Fri, 2 Jun 2023 09:53:11 +0800

On Fri, Jun 2, 2023 at 2:56 AM Tassilo Horn <tsdh@gnu.org> wrote:
>
> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
> >> That's because $ is a word-character in the syntax-table of the mode
> >> you are using in that buffer.  You can try
> >> \([^a-zA-Z]\|\b\)id\([^a-zA-Z]\|\b\) which should also find $id$ and
> >> 1id02.
> >
> > Yes. This works, as shown in the attached screenshot. But the input is
> > rather cumbersome. Are there more efficient/concise regexp patterns
> > for this goal?
>
> Well, \bid\b should be enough, actually.  I don't understand why it
> seems like the $s in $id$ in your latex buffer have word syntax.  I've
> just tried both the stock latex-mode and AUCTeX and with both the $s
> don't have word syntax.
>
> Could you please put point on such a $ and report the output of M-x
> describe-char RET?  I'm mostly interested in the line
>
>   syntax: $     which means: math
>
> which might be
>
>   syntax: w     which means: word
>
> on your side for whatever reason.

See below:

;;; output begin here
             position: 14582 of 24975 (58%), column: 6
            character: $ (displayed as $) (codepoint 36, #o44, #x24)
              charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x24
               script: latin
               syntax: $     which means: math
             category: .:Base, a:ASCII, l:Latin, r:Roman
             to input: type "C-x 8 RET 24" or "C-x 8 RET DOLLAR SIGN"
          buffer code: #x24
            file code: #x24 (encoded by coding system utf-8-unix)
              display: by this font (glyph code):
    ftcrhb:-PfEd-DejaVuSansMono Nerd Font
Mono-regular-normal-normal-*-20-*-*-*-m-0-iso10646-1 (#x07)

Character code properties: customize what to show
  name: DOLLAR SIGN
  general-category: Sc (Symbol, Currency)
  decomposition: (36) ('$')

There are text properties here:
  face                 font-latex-math-face
  fontified            t
  wrap-prefix          " "
;;; output end here

> Also, please try if regexp isearch works as expected, i.e., C-u C-s
> \bid\b should also find the id in $id$.  If you both have $ in math
> syntax and isearch works but consult doesn't, then I'd ask at the
> consult community.

This method works, as shown in the attached screenshot.

> Bye,
> Tassilo

Regards,
Zhao

Attachment: image.png
Description: PNG image


reply via email to

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