jed-users mailing list

[2007 Date Index] [2007 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [jed]grep.sl feature request


On 16.04.07, Lechee.Lai@xxxxxxxxxxxx wrote:
> 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


> +private define get_word_at_point (word_chars)
> +{
...

A similar function, `get_word', is already defined in txtutils and is
autoloaded in grep.sl. (Also, see its documentation on how to modify the
behaviour with optional variables.)

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

I would rather not hard-code the word_chars in the grep function, as 
the default takes account of "localized values" (mode specific or buffer
specific settings, see local_word_chars() in txtutils.sl).

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

This would use the word at point as init string and the last used value
as default. To access the default value or grep for some other word, one
would need to delete the init string.

My suggestion would be

> +        what = read_mini("String to grep: ", get_word(), "");

to put the word-at-point into the default:

* If no other grep-pattern is given, the default is used. To grep for a
  different pattern, one does not need to delete the default.
  
* Getting the last grep should be possible quite easily with the Up arrow
  (if the last call to "grep" was not too long ago). In my experience,
  a custom usage is to modify the last grep pattern, so it is of no use
  if given in the default.
  
I'd like some user feedback before implementing this.  


> 2. Call back grep-output more easily even quit jed editor, which means
> save grep-output as option rebuild grep-output if restart jed

* You can save the *grep* buffer with save_as() or cua_save_buffer(). It
  will ask you for a filename.
  
  I realized, that the grep-modes keymap (defined in filelist.sl)
  overwrites both CUA bindings for cua_save_buffer() (^S and F2) and
  changed it accordingly:
  
  % 2007-04-16  1.7   Changed the keybinding for (i)search from '^S' to 's'
  %                   to match the one in tokenlist and keep the original '^S'.


> 3. Grep-output pop2buf have choice in other window and switch back to
> grep-output via SPACE like bufed.sl style

Good idea. As this should be useful for other listings of files too, I
tried to implemented it in filelist.sl but have still to polish it a bit.

Guenter


--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2007 date index] [2007 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]