- From: Morten Bo Johansen <mojo@xxxxxxxx>
- Date: Wed, 29 Jan 2003 19:51:08 +0100
Hi,
I am using the function that follows below to open files
in a window where the filename is taken from lines like this:
#: auth/pam.c:154 auth/sql.c:410 auth/sql.c:412
and then jump to the line number that follows the filename.
so in this case it will open "pam.c" in a window and jump to
line 154. Its shortcoming is that it only opens the first
file referenced. I would like it to be able to cycle through
all the references in a line like the one above in turn, with
a message in between to the user like: "press enter for next
reference, 'q' to quit".
I have looked at foreach but I am quite stuck so I could use
some help, not neccesarily a ready-made solution but some
pointers on how to do it.
define view_source ()
{
variable str, file, n;
narrow_to_whole_block ();
recenter (1);
if (0 == bol_fsearch ("#:"))
{
widen_region ();
error ("No source reference");
}
skip_chars ("#: \t");
push_mark_eol ();
str = bufsubstr ();
n = strchop (str, ':', 0);
file = strcat (dir + "/" + n[0]);
if (0 == file_status (file))
{
widen_region ();
verror ("Source file '%s' not found (use 'S' to set the path)", file);
}
popup_buffer (file);
() = insert_file (file);
set_buffer_modified_flag (0);
most_mode ();
goto_line (integer (n[1]));
otherwindow ();
fit_window ();
otherwindow ();
flush ("'q' closes source view");
local_setkey ("close_buf", "q");
}
Morten
--
"To create man was a quaint and original idea, but to add the sheep
was tautology." (Mark Twain)
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
[2003 date index]
[2003 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]