all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
To: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: Add lgrep/rgrep commands to Edit > Search submenu
Date: Sun, 25 Jan 2009 20:22:19 +0100	[thread overview]
Message-ID: <87bptvp4wk.fsf@kfs-lx.rd.rdm> (raw)
In-Reply-To: <87skn7w85h.fsf@cyd.mit.edu> (Chong Yidong's message of "Sun, 25 Jan 2009 13:30:18 -0500")

Chong Yidong <cyd@stupidchicken.com> writes:

> storm@cua.dk (Kim F. Storm) writes:
>
>> IMO, lgrep and rgrep are much better suited as menu commands,
>> and they would logically fit very well on
>>  Edit > Search > Search Files... 
>>  Edit > Search > Search Files Recurse...
>>
>> We may remove the standard grep from Tools - or keep it as
>> a more advanced/low-level interface.
>
> Conceptually, the grep commands are not a good fit for the Edit menu.
> The Edit menu contains commands that act on the current buffer; the
> Tools menu contains commands that do fancier stuff like operating on
> multiple files.  So, even though Isearch and Grep are both "search
> commands", I don't think it's good to consolidate them on the menu bar.

Then, why is "search tagged files" on Edit > Search ?

I want to search for abc - starting in the current buffer, so I use
Edit > Search > ...  - and then realize that I would like to search
through other buffer or files - so I again use Edit > Search > ...
and find nothing useful.

I find lgrep / rgrep rather useful as an editing tool -- but parhaps
that is because I have the "replace grep match" add-on which I find is
one of the most efficient extensions to emacs (it was rejected last time
I proposed this - so I'm not going to propose it again).


;;; grep-x.el -- search and replace interface using grep output.

(defun grep-goto-error-no-select ()
  "Display currently grep match in other window."
  (interactive)
  (save-selected-window
    (compile-goto-error)))

(defvar grep-last-replace-string nil)

(defun grep-replace-match-internal ()
  (when compilation-highlight-overlay
    (let ((start (overlay-start compilation-highlight-overlay)))
      (goto-char start)
      (undo-boundary)
      (save-match-data
	(search-forward (buffer-substring-no-properties start (overlay-end compilation-highlight-overlay)))
	(replace-match grep-last-replace-string))
      (move-overlay compilation-highlight-overlay start (point)))))

(defun grep-replace-match (string)
  "Replace current grep match with string STRING."
  (interactive "sReplace with: ")
  (save-selected-window
    (setq grep-last-replace-string string)
    (let ((next-error-highlight
	   (if (numberp next-error-highlight) next-error-highlight 0.01))
	  (next-error-hook '(grep-replace-match-internal)))
      (compile-goto-error))))

(defun grep-repeat-replace-match ()
  "Replace current grep match with last match replace string."
  (interactive)
  (if (not grep-last-replace-string)
      (call-interactively 'grep-replace-match)
    (grep-replace-match grep-last-replace-string)))



(define-key grep-mode-map "o" 'grep-goto-error-no-select)
(define-key grep-mode-map "/" 'grep-replace-match)
(define-key grep-mode-map "." 'grep-repeat-replace-match)

(provide 'grep-x)

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk





  reply	other threads:[~2009-01-25 19:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-24 20:45 Add lgrep/rgrep commands to Edit > Search submenu Kim F. Storm
2009-01-24 21:09 ` Dan Nicolaescu
2009-01-25  0:57   ` Juri Linkov
2009-01-25  0:55 ` Juri Linkov
2009-01-25  1:04   ` Lennart Borgman
2009-01-25 18:14   ` Richard M Stallman
2009-01-25 21:30     ` Lennart Borgman
2009-01-25 21:33     ` Juri Linkov
2009-01-25 18:30 ` Chong Yidong
2009-01-25 19:22   ` Kim F. Storm [this message]
2009-01-25 21:37     ` Juri Linkov
2009-01-25 22:43       ` Kim F. Storm
2009-01-26  1:54     ` Stefan Monnier
2009-01-25 20:00   ` Drew Adams
2009-01-25 21:45     ` Juri Linkov
2009-01-26  4:09       ` Eli Zaretskii
2009-01-25 21:33   ` Lennart Borgman
2009-01-25 19:04 ` Gilaras Drakeson
2009-01-25 21:47   ` Juri Linkov
2009-01-25 22:49     ` Kim F. Storm
2009-01-26  0:42       ` Dan Nicolaescu
2009-01-26 23:52         ` Juri Linkov
2009-01-27  0:48           ` Drew Adams
2009-01-27 17:40           ` Kim F. Storm
2009-01-26 23:48       ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bptvp4wk.fsf@kfs-lx.rd.rdm \
    --to=storm@cua.dk \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.