- Subject: [jed]grep.sl feature request
- From: <Lechee.Lai@xxxxxxxxxxxx>
- Date: Mon, 16 Apr 2007 10:42:30 +0800
Folks,
Grep.sl really good utility for programmer, I’ve success install grep_mode last week,
Here is some suggest in my opinion
1. Grep point at cursor
--- /share/work/jed099.18/lib/grep.sl 2007-04-15 15:45:32.000000000 +0800
+++ grep.sl 2007-04-16 10:23:28.000000000 +0800
@@ -300,6 +300,18 @@
run_mode_hooks("grep_mode_hook");
}
+private define get_word_at_point (word_chars)
+{
+ push_spot ();
+ skip_white ();
+ bskip_chars (word_chars);
+ push_mark ();
+ skip_chars (word_chars);
+ variable tag = bufsubstr ();
+ pop_spot ();
+ return tag;
+}
+
% TODO: What does gnu grep expect on DOS, What should this be on VMS and OS2 ?
%!%+
%\function{grep}
@@ -329,11 +341,13 @@
public define grep() % ([what], [path])
{
% optional arguments, ask if not given
+ variable word_chars = "\\w_"; % word chars (0-9A-Za-z)
variable what, path;
(what, path) = push_defaults( , , _NARGS);
if (what == NULL)
{
- what = read_mini("String to grep: ", LAST_GREP, "");
+% what = read_mini("String to grep: ", LAST_GREP, "");
+ what = read_mini("String to grep: ", LAST_GREP, get_word_at_point(word_chars)); % for easy grep I think :-)
LAST_GREP = what;
}
if (path == NULL)
2. Call back grep-output more easily even quit jed editor, which means save grep-output as option rebuild grep-output if restart jed
3. Grep-output pop2buf have choice in other window and switch back to grep-output via SPACE like bufed.sl style
Thanks the great jed modes
Lechee
[2007 date index]
[2007 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]