unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* regular expression in find-tag-regexp
@ 2011-09-29 22:54 Shiyuan
  2011-09-30  6:53 ` Eli Zaretskii
  2011-09-30 22:55 ` Shiyuan
  0 siblings, 2 replies; 6+ messages in thread
From: Shiyuan @ 2011-09-29 22:54 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 754 bytes --]

Hello,
     I notice that the same regular expression will give different matching
result in find-tag-regexp (C-M-.) and in isearch-forward-regexp (C-M-S). \
I have the following tags
MatGetArray_SeqAIJ
MatGetArray(....)
MatGetArray_SeqBAIJ()
MatGetArray_MPIDense()
MatGetArray_SeqDense()
MatGetArray_SeqSBAIJ()
matgetarray_()

If I use the Mat.*GetArray.* to search, find-tag-regexp will only match
MatGetArray_SeqAIJ but isearch-forward-regexp will match all except the
lower case matgetarray(). If I use the MatGetArray, find-tag-regexp will
match all of them including the matgetarray()? Anyone can explain why it is
so? If I want find-tag-regexp to find all of them( with or without the
matgetarray()), what regexp should I use? Thank you.

Shiyuan

[-- Attachment #2: Type: text/html, Size: 808 bytes --]

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

* Re: regular expression in find-tag-regexp
  2011-09-29 22:54 Shiyuan
@ 2011-09-30  6:53 ` Eli Zaretskii
  2011-09-30 22:55 ` Shiyuan
  1 sibling, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2011-09-30  6:53 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Thu, 29 Sep 2011 17:54:00 -0500
> From: Shiyuan <gshy2014@gmail.com>
> 
>      I notice that the same regular expression will give different matching
> result in find-tag-regexp (C-M-.) and in isearch-forward-regexp (C-M-S). \

Where did you use C-M-S?  Was it in the buffer that visits the TAGS
table, or was it in the buffer where you have the source file?
find-tag-regexp does the former.  It uses re-search-forward, btw, not
isearch-forward-regexp.

> If I use the Mat.*GetArray.* to search, find-tag-regexp will only match
> MatGetArray_SeqAIJ but isearch-forward-regexp will match all except the
> lower case matgetarray(). If I use the MatGetArray, find-tag-regexp will
> match all of them including the matgetarray()? Anyone can explain why it is
> so? If I want find-tag-regexp to find all of them( with or without the
> matgetarray()), what regexp should I use? Thank you.

It would help if you show what's in your TAGS file for these
functions.



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

* Re: regular expression in find-tag-regexp
  2011-09-30 22:55 ` Shiyuan
@ 2011-10-01  8:09   ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2011-10-01  8:09 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Fri, 30 Sep 2011 17:55:52 -0500
> From: Shiyuan <gshy2014@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> 
> >> If I use the Mat.*GetArray.* to search, find-tag-regexp will only match
> >> MatGetArray_SeqAIJ but isearch-forward-regexp will match all except the
> >> lower case matgetarray(). If I use the MatGetArray, find-tag-regexp will
> >> match all of them including the matgetarray()? Anyone can explain why it
> is
> >> so? If I want find-tag-regexp to find all of them( with or without the
> >> matgetarray()), what regexp should I use? Thank you.
> 
> >It would help if you show what's in your TAGS file for these
> >functions.
> I open the TAGS with emacs and the "^?" belows indicate  some unprintable
> characters.
> PetscErrorCode MatGetArray_SeqAIJ
> PetscErrorCode  MatGetArray(^?6203,228137
> PetscErrorCode MatGetArray_SeqBAIJ(^?2598,103252
> void PETSC_STDCALL matgetarrayf90_(^?28,985
> void PETSC_STDCALL matgetarray_(^?189,8574
> PetscErrorCode MatGetArray_MPIDense(^?186,6182
> PetscErrorCode MatGetArray_SeqDense(^?1428,50013
> 
> If I use re-search-forward to search the regexp Mat.*GetArray.* on the
> buffer visitng the TAGS file, it can also locate all the lines above. So
> find-tag-regexp with the exact same regexp only gives me one match?

I think there's a possible misunderstanding here.  Did you use
C-M-. once and expected it to find all of these matches?  If so, your
expectations are incorrect.  Here's what the manual says about this
command:


     The command `C-M-.' (`find-tag-regexp') visits the tags that match a
  specified regular expression.  It is just like `M-.' except that it
  does regexp matching instead of substring matching.

"It is just like `M-.'".  And the description of M-. says:

  To find other tags that match the same substring, give `find-tag' a
  numeric argument, as in `C-u M-.'; this does not read a tag name, but
  continues searching the tags table's text for another tag containing
  the same substring last used.

Therefore, the first time you use C-M-., it finds only the first
match.  To find each of the other matches, use "C-u C-M-." time and
again, until you find the match you want. 

Does this resolve the problem?

> and btw what does the number mean in the TAGS file?

The line number where the tag is in its file and the character number
of the first character of that line.



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

* Re: regular expression in find-tag-regexp
@ 2011-10-01 16:03 Shiyuan
  2011-10-01 16:19 ` Drew Adams
  2011-10-01 17:52 ` Eli Zaretskii
  0 siblings, 2 replies; 6+ messages in thread
From: Shiyuan @ 2011-10-01 16:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2314 bytes --]

>>> >> If I use the Mat.*GetArray.* to search, find-tag-regexp will only
match
>>> >> MatGetArray_SeqAIJ but isearch-forward-regexp will match all except
the
>>> >> lower case matgetarray(). If I use the MatGetArray, find-tag-regexp
will
>>> >> match all of them including the matgetarray()? Anyone can explain why
it
>> is
>> >> so? If I want find-tag-regexp to find all of them( with or without the
>> >> matgetarray()), what regexp should I use? Thank you.
>>>

>>
>> If I use re-search-forward to search the regexp Mat.*GetArray.* on the
>> buffer visitng the TAGS file, it can also locate all the lines above. So
>> find-tag-regexp with the exact same regexp only gives me one match?

>I think there's a possible misunderstanding here.  Did you use
>C-M-. once and expected it to find all of these matches?  If so, your
>expectations are incorrect.  Here's what the manual says about this
>command:


   > The command `C-M-.' (`find-tag-regexp') visits the tags that match a
 >specified regular expression.  It is just like `M-.' except that it
 >does regexp matching instead of substring matching.

>"It is just like `M-.'".  And the description of M-. says:

 >To find other tags that match the same substring, give `find-tag' a
 >numeric argument, as in `C-u M-.'; this does not read a tag name, but
 >continues searching the tags table's text for another tag containing
 >the same substring last used.

>Therefore, the first time you use C-M-., it finds only the first
>match.  To find each of the other matches, use "C-u C-M-." time and
>again, until you find the match you want.

>Does this resolve the problem?
Thanks for clarifying. But I was aware of this and I did use C-u C-M-. to
find next match  So
I think there is something wrong with the TAGS file.

>The line number where the tag is in its file and the character number
>of the first character of that line.
The first is line number. But the second number is very large, some are tens
of thousands, but the source file don't have such a long line. I still want
to find out what's going wrong in the TAGS file, so it would be helpful if I
know better about TAGS files. Also there are some unprintable characters in
TAGS.  I remember there is a mode which can show the Octal/Hex code for all
characters but I forget how to invoke this. Thanks.

[-- Attachment #2: Type: text/html, Size: 3267 bytes --]

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

* RE: regular expression in find-tag-regexp
  2011-10-01 16:03 regular expression in find-tag-regexp Shiyuan
@ 2011-10-01 16:19 ` Drew Adams
  2011-10-01 17:52 ` Eli Zaretskii
  1 sibling, 0 replies; 6+ messages in thread
From: Drew Adams @ 2011-10-01 16:19 UTC (permalink / raw)
  To: 'Shiyuan', 'Eli Zaretskii'; +Cc: help-gnu-emacs

> I remember there is a mode which can show the Octal/Hex code
> for all characters but I forget how to invoke this.

`C-h f hexl-mode'




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

* Re: regular expression in find-tag-regexp
  2011-10-01 16:03 regular expression in find-tag-regexp Shiyuan
  2011-10-01 16:19 ` Drew Adams
@ 2011-10-01 17:52 ` Eli Zaretskii
  1 sibling, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2011-10-01 17:52 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 1 Oct 2011 11:03:38 -0500
> From: Shiyuan <gshy2014@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> 
> >The line number where the tag is in its file and the character number
> >of the first character of that line.
> The first is line number. But the second number is very large, some are tens
> of thousands, but the source file don't have such a long line.

It's the ordinal number of the first character from the beginning of
the file, not from the beginning of the line.

> Also there are some unprintable characters in TAGS.

That's normal.

If you produced your TAGS file with the `etags' command, then chances
are the file is correct.



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

end of thread, other threads:[~2011-10-01 17:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-01 16:03 regular expression in find-tag-regexp Shiyuan
2011-10-01 16:19 ` Drew Adams
2011-10-01 17:52 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2011-09-29 22:54 Shiyuan
2011-09-30  6:53 ` Eli Zaretskii
2011-09-30 22:55 ` Shiyuan
2011-10-01  8:09   ` Eli Zaretskii

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