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: display-completion-list should not strip text properties Date: Fri, 06 Apr 2007 18:26:07 +0200 Message-ID: References: <878xd8dw3d.fsf@stupidchicken.com> <17941.35328.281122.300772@farnswood.snap.net.nz> <5y7isq2tho.fsf@fencepost.gnu.org> <87d52ifekm.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1175882073 24028 80.91.229.12 (6 Apr 2007 17:54:33 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 6 Apr 2007 17:54:33 +0000 (UTC) Cc: Glenn Morris , Nick Roberts , rms@gnu.org, emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 06 19:53:38 2007 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 1HZrGi-0007SP-NA for ged-emacs-devel@m.gmane.org; Fri, 06 Apr 2007 18:26:33 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HZrKD-0005Gy-9O for ged-emacs-devel@m.gmane.org; Fri, 06 Apr 2007 12:30:09 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HZrK9-0005EV-PT for emacs-devel@gnu.org; Fri, 06 Apr 2007 12:30:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HZrK8-0005EJ-9X for emacs-devel@gnu.org; Fri, 06 Apr 2007 12:30:04 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HZrK8-0005EG-3Z for emacs-devel@gnu.org; Fri, 06 Apr 2007 12:30:04 -0400 Original-Received: from pfepa.post.tele.dk ([195.41.46.235]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HZrGZ-0003xB-P4; Fri, 06 Apr 2007 12:26:24 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx19.adsl-dhcp.tele.dk [80.62.38.68]) by pfepa.post.tele.dk (Postfix) with SMTP id E4FD6FAC040; Fri, 6 Apr 2007 18:26:20 +0200 (CEST) In-Reply-To: <87d52ifekm.fsf@stupidchicken.com> (Chong Yidong's message of "Thu\, 05 Apr 2007 21\:59\:21 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux) X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) 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:69130 Archived-At: Chong Yidong writes: > The two changes that we have to reimplement are the following: > > 1997-03-24 Kevin Rodgers > > * compile.el (grep-program): New variable. > (grep-command): Use it, and test whether it supports the -e > option; fix doc string (last command is stored in history variable). > (grep-null-device): Declare before grep-program and grep-command. > (grep-find-use-xargs, grep-find-command, grep-find-history): > New variables. > (grep-find): New command. > (grep): Only concatenate grep-null-device to COMMAND when it's > not nil (to support grep-find). EXECUTIVE SUMMARY: ------------------ We don't have to do anything about this. ANALYSIS: --------- I (and others) have already modified the code introduced by those changes several times, so parts of it is no longer present -- or very different from the original code. However, there are still parts which are quite close to Kevin's original code. Let's go over those changes: Index: compile.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/progmodes/compile.el,v retrieving revision 1.158 retrieving revision 1.159 diff -c -r1.158 -r1.159 *** compile.el 21 Feb 1997 09:46:03 -0000 1.158 --- compile.el 24 Mar 1997 23:59:44 -0000 1.159 *************** *** 256,263 **** ! (defvar grep-command "grep -n " ! "Last grep command used in \\[grep]; default for next grep.") --- 256,307 ---- ! ;; Use zgrep if available, to work nicely with compressed files. ! ;; Otherwise, use ordinary grep. ! (defvar grep-program ! (if (equal (condition-case nil ; in case "zgrep" isn't in exec-path ! (call-process "zgrep" nil nil nil ! "foo" grep-null-device) ! (error nil)) ! 1) ! "zgrep" ! "grep") ! "The default grep program for `grep-command' and `grep-find-command'.") This change has been reverted - but Kevin's code is still included as a comment. We could just remove the comment. ! ;; Use -e if grep supports it, ! ;; because that avoids lossage if the pattern starts with `-'. ! (defvar grep-command ! (if (equal (condition-case nil ; in case "grep" isn't in exec-path ! (call-process grep-program nil nil nil ! "-e" "foo" grep-null-device) ! (error nil)) ! 1) ! (format "%s -n -e " grep-program) ! (format "%s -n " grep-program)) ! "The default grep command for \\[grep].") The variable still exists, but the code to initialize it has been reworked, and is no longer Kevin's work. ! (defvar grep-find-use-xargs ! (if (equal (call-process "find" nil nil nil ! grep-null-device "-print0") ! 0) ! 'gnu) ! "Whether \\[grep-find] uses the `xargs' utility by default. ! ! If nil, it uses `grep -exec'; if `gnu', it uses `find -print0' and `xargs -0'; ! if not nil and not `gnu', it uses `find -print' and `xargs'. ! ! This variable's value takes effect when `compile.el' is loaded ! by influencing the default value for the variable `grep-find-command'.") Ditto. The current doc string is 50% similar to Kevin's work. ! ! (defvar grep-find-command ! (cond ((eq grep-find-use-xargs 'gnu) ! (format "find . -type f -print0 | xargs -0 -e %s" grep-command)) ! (grep-find-use-xargs ! (format "find . -type f -print | xargs %s" grep-command)) ! (t (cons (format "find . -type f -exec %s {} /dev/null \\;" ! grep-command) ! (+ 22 (length grep-command))))) ! "The default find command for \\[grep-find].") The variable still exists, but otherwise, this part has been completely reworked. *************** *** 308,313 **** --- 352,358 ---- + (defvar grep-find-history nil) Still exists -- but that's a trivial change (how else would you define the var?) *************** *** 392,402 **** ;; Setting process-setup-function makes exit-message-function work ;; even when async processes aren't supported. (let* ((compilation-process-setup-function 'grep-process-setup) ! (buf (compile-internal (concat command-args " " grep-null-device) "No more grep hits" "grep" ;; Give it a simpler regexp to match. nil grep-regexp-alist))))) (defun compile-internal (command error-message &optional name-of-mode parser regexp-alist name-function) --- 437,464 ---- ;; Setting process-setup-function makes exit-message-function work ;; even when async processes aren't supported. (let* ((compilation-process-setup-function 'grep-process-setup) ! (buf (compile-internal (if grep-null-device ! (concat command-args " " grep-null-device) ! command-args) "No more grep hits" "grep" ;; Give it a simpler regexp to match. nil grep-regexp-alist))))) This part is also completely reworked. + + ;;;###autoload + (defun grep-find (command-args) + "Run grep via find, with user-specified args, and collect output in a buffer. + While find runs asynchronously, you can use the \\[next-error] command + to find the text that grep hits refer to. + + This command uses a special history list for its arguments, so you can + easily repeat a find command." + (interactive + (list (read-from-minibuffer "Run find (like this): " + grep-find-command nil nil 'grep-find-history))) + (let ((grep-null-device nil)) ; see grep + (grep command-args))) + The grep-find command is still present with the above code and doc string mostly intact (the code has been extended in various ways - but you can still find those 5 lines of code in the current version of the function. However, Kevin's code and doc string is clearly derived from the already existing grep defun: (defun grep (command-args) "Run grep, with user-specified args, and collect output in a buffer. While grep runs asynchronously, you can use the \\[next-error] command to find the text that grep hits refer to. This command uses a special history list for its arguments, so you can easily repeat a grep command." (interactive (list (read-from-minibuffer "Run grep (like this): " grep-command nil nil 'grep-history))) ;; Setting process-setup-function makes exit-message-function work ;; even when async processes aren't supported. (let* ((compilation-process-setup-function 'grep-process-setup) (buf (compile-internal (concat command-args " " grep-null-device) "No more grep hits" "grep" ;; Give it a simpler regexp to match. nil grep-regexp-alist))))) CONCLUSION: ----------- Except for the commentary about zgrep [which I have just removed], the relevant code has either been reworked already, or is trivially derived from existing code. To conclude, I don't think we need to do anything about the changes related to grep-find functionality. -- Kim F. Storm http://www.cua.dk