From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Add lgrep/rgrep commands to Edit > Search submenu Date: Sun, 25 Jan 2009 20:22:19 +0100 Message-ID: <87bptvp4wk.fsf@kfs-lx.rd.rdm> References: <87y6x0ph4x.fsf@kfs-lx.rd.rdm> <87skn7w85h.fsf@cyd.mit.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1232911376 13598 80.91.229.12 (25 Jan 2009 19:22:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 25 Jan 2009 19:22:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 25 20:24:08 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LRAaO-0002Cy-W5 for ged-emacs-devel@m.gmane.org; Sun, 25 Jan 2009 20:24:01 +0100 Original-Received: from localhost ([127.0.0.1]:52840 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRAZ7-0000sd-1c for ged-emacs-devel@m.gmane.org; Sun, 25 Jan 2009 14:22:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LRAZ3-0000rX-JJ for emacs-devel@gnu.org; Sun, 25 Jan 2009 14:22:37 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LRAZ0-0000pe-LX for emacs-devel@gnu.org; Sun, 25 Jan 2009 14:22:37 -0500 Original-Received: from [199.232.76.173] (port=56804 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRAZ0-0000pb-F2 for emacs-devel@gnu.org; Sun, 25 Jan 2009 14:22:34 -0500 Original-Received: from mail1-hoer.fullrate.dk ([90.185.1.42]:49711 helo=smtp.fullrate.dk) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LRAZ0-00071I-3q for emacs-devel@gnu.org; Sun, 25 Jan 2009 14:22:34 -0500 Original-Received: from kfs-lx.rd.rdm.cua.dk (unknown [90.184.173.152]) by smtp.fullrate.dk (Postfix) with SMTP id B9E5C9CDF5; Sun, 25 Jan 2009 20:22:19 +0100 (CET) In-Reply-To: <87skn7w85h.fsf@cyd.mit.edu> (Chong Yidong's message of "Sun, 25 Jan 2009 13:30:18 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:108229 Archived-At: Chong Yidong 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 http://www.cua.dk