displaying function name
Tony Balinski
ajbj at free.fr
Tue Aug 31 18:51:58 CEST 2004
Quoting Offer Kaye <offer.kaye at gmail.com>:
> I couldn't understand what your open_file_at_cursor function was
> trying to do, so I rewrote it from scratch rather than debug it,
> according to my understanding of what is meant by "open file at
> cursor".
The original, it seems to me, was looking for a "grep" output line,
of form
file-name: found-line-content
I have similar macros to open a file from a grep output-line and position
the cursor on the line that grep found.
> ...
>
> Fairly simple- the file name is assumed to be delimited by whitespace
> (either a space or a tab), where the "replace_in_string" line is used
> to remove any leading whitespace char. Once I have the limiting
> positions of the file name I get it open it (or open an error dialog
> if there was no text under the cursor).
>
> Bugs:
> 1. I tried using "\s" to match whitespace, but it didn't work for some
> reason. Anyone know why?
You want to double-up the backslash - when reading the string, the macro
language parser turns \s into s. (Note that \t, \n, \r, \a, \b, \e, \f, \v
are substituted with the tab, linefeed, carriage-return, bell, baskspace,
escape, formfeed, and vertical tab characters; \\ is substituted with a
single \.) So to get the regex to see "\s" you need to write your macro
string as "\\s".
> 2. If the filename DOES contain a whitespace, this function will of
> course fail. Since I hardly ever use filenames with whitespace in
> them, this isn't a major problem for me.
The grep output lists the file-name followed by a colon, so the colon
becomes the delimiter there.
>
> Comments?
> Regards,
> --
> Offer Kaye
> --
> NEdit Discuss mailing list - Discuss at nedit.org
> http://www.nedit.org/mailman/listinfo/discuss
>
More information about the Discuss
mailing list