From unknown Fri Jun 20 20:12:08 2025 X-Loop: owner@emacsbugs.donarmstrong.com Subject: bug#4301: rgrep/lgrep defaults Reply-To: Juri Linkov , 4301@debbugs.gnu.org Resent-From: Juri Linkov Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Mon, 31 Aug 2009 20:15:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-Emacs-PR-Message: report 4301 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by submit@emacsbugs.donarmstrong.com id=B.125174937217393 (code B ref -1); Mon, 31 Aug 2009 20:15:03 +0000 Received: (at submit) by emacsbugs.donarmstrong.com; 31 Aug 2009 20:09:32 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-1.2 required=4.0 tests=AWL,FVGT_m_MULTI_ODD, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7VK9Vx1017390 for ; Mon, 31 Aug 2009 13:09:32 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MiDBy-0000xj-FL for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2009 16:09:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MiDBs-0000rv-Ul for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2009 16:09:29 -0400 Received: from [199.232.76.173] (port=53206 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiDBs-0000rs-OI for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2009 16:09:24 -0400 Received: from smtp-out1.starman.ee ([85.253.0.3]:54715 helo=mx1.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MiDBr-00008K-VD for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2009 16:09:24 -0400 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Received: from mail.starman.ee (82.131.53.175.cable.starman.ee [82.131.53.175]) by mx1.starman.ee (Postfix) with ESMTP id 22C463F4244 for ; Mon, 31 Aug 2009 23:09:16 +0300 (EEST) From: Juri Linkov To: bug-gnu-emacs@gnu.org Organization: JURTA Date: Mon, 31 Aug 2009 22:59:02 +0300 Message-ID: <87ljkzsqk9.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Currently rgep/lgrep proposes to search in C files by default. This default value assumes that majority of Emacs users prefer searching only in C files. This can't be true. So the current default value is useless. I think a better default value is to search _all_ files, where all includes hidden dot files as well. rgrep already searches in dot files, but lgrep doesn't. To remove this inconsistency we could bind "all" to "* .*" in `grep-files-aliases'. Placing it first makes it the default value which reads clear and understandable in the default prompt as: Search for "text" in files (default all): instead of the current: Search for "text" in files (default ch): "asm" could be moved to the bottom of the list of default values in `grep-files-aliases', so this less frequent alias comes last when retrieving via M-n. Also this requires removing ("ch" "el") from the pre-defined default of `grep-files-history' and moving ("ch" "el") higher in `grep-files-aliases'. Another inconsistency is that rgrep provides the default command that ignores vcs directories, but doesn't ignore vcs files like ".v", backup files "~" "\\`#" "\\`.#" and other ignorable files from `completion-ignored-extensions'. This can be improved by adding new customizable variable `grep-find-ignored-files' where the nil option disables it easily. The same nil option is also useful for `grep-find-ignored-directories' to disable it at once than deleting every value from the default list one by one. For rgrep, `grep-find-ignored-files' means mapping its list to something like \(-name .\#\* -o -name \*\~ -o -name \*.o -o ... \) -prune -o For lgrep, `grep-find-ignored-files' means mapping its list to something like grep --exclude=.\#\* --exclude=\*\~ --exclude=\*.o ... Below is a patch that implements this: Index: lisp/progmodes/grep.el =================================================================== RCS file: /sources/emacs/emacs/lisp/progmodes/grep.el,v retrieving revision 1.106 diff -c -w -b -r1.106 grep.el *** lisp/progmodes/grep.el 30 Aug 2009 23:46:09 -0000 1.106 --- lisp/progmodes/grep.el 31 Aug 2009 19:54:27 -0000 *************** *** 176,193 **** :group 'grep) (defcustom grep-files-aliases ! '(("asm" . "*.[sS]") ("c" . "*.c") ("cc" . "*.cc *.cxx *.cpp *.C *.CC *.c++") ("cchh" . "*.cc *.[ch]xx *.[ch]pp *.[CHh] *.CC *.HH *.[ch]++") ("hh" . "*.hxx *.hpp *.[Hh] *.HH *.h++") - ("ch" . "*.[ch]") - ("el" . "*.el") ("h" . "*.h") ("l" . "[Cc]hange[Ll]og*") ("m" . "[Mm]akefile*") ("tex" . "*.tex") ! ("texi" . "*.texi")) "*Alist of aliases for the FILES argument to `lgrep' and `rgrep'." :type 'alist :group 'grep) --- 176,194 ---- :group 'grep) (defcustom grep-files-aliases ! '(("all" . "* .*") ! ("el" . "*.el") ! ("ch" . "*.[ch]") ("c" . "*.c") ("cc" . "*.cc *.cxx *.cpp *.C *.CC *.c++") ("cchh" . "*.cc *.[ch]xx *.[ch]pp *.[CHh] *.CC *.HH *.[ch]++") ("hh" . "*.hxx *.hpp *.[Hh] *.HH *.h++") ("h" . "*.h") ("l" . "[Cc]hange[Ll]og*") ("m" . "[Mm]akefile*") ("tex" . "*.tex") ! ("texi" . "*.texi") ! ("asm" . "*.[sS]")) "*Alist of aliases for the FILES argument to `lgrep' and `rgrep'." :type 'alist :group 'grep) *************** *** 197,203 **** "*List of names of sub-directories which `rgrep' shall not recurse into. If an element is a cons cell, the car is called on the search directory to determine whether cdr should not be recursed into." ! :type '(repeat string) :group 'grep) (defcustom grep-error-screen-columns nil --- 198,217 ---- "*List of names of sub-directories which `rgrep' shall not recurse into. If an element is a cons cell, the car is called on the search directory to determine whether cdr should not be recursed into." ! :type '(choice (repeat :tag "Ignored directories" string) ! (const :tag "No ignored directories" nil)) ! :group 'grep) ! ! (defcustom grep-find-ignored-files ! (cons ".#*" (delq nil (mapcar (lambda (s) ! (unless (string-match-p "/\\'" s) ! (concat "*" s))) ! completion-ignored-extensions))) ! "*List of names of file names which `rgrep' and `lgrep' shall exclude. ! If an element is a cons cell, the car is called on the search directory ! to determine whether cdr should not be excluded." ! :type '(choice (repeat :tag "Ignored file" string) ! (const :tag "No ignored files" nil)) :group 'grep) (defcustom grep-error-screen-columns nil *************** *** 421,427 **** ;; History of lgrep and rgrep regexp and files args. (defvar grep-regexp-history nil) ! (defvar grep-files-history '("ch" "el")) ;;;###autoload (defun grep-process-setup () --- 435,441 ---- ;; History of lgrep and rgrep regexp and files args. (defvar grep-regexp-history nil) ! (defvar grep-files-history nil) ;;;###autoload (defun grep-process-setup () *************** *** 524,530 **** (format "%s %s " grep-program grep-options))) (unless grep-template (setq grep-template ! (format "%s %s " grep-program grep-options))) (unless grep-find-use-xargs (setq grep-find-use-xargs (cond --- 538,544 ---- (format "%s %s " grep-program grep-options))) (unless grep-template (setq grep-template ! (format "%s %s " grep-program grep-options))) (unless grep-find-use-xargs (setq grep-find-use-xargs (cond *************** *** 753,760 **** (fn (and bn (stringp bn) (file-name-nondirectory bn))) ! (default ! (or (and fn (let ((aliases grep-files-aliases) alias) (while aliases --- 767,774 ---- (fn (and bn (stringp bn) (file-name-nondirectory bn))) ! (default-alias ! (and fn (let ((aliases grep-files-aliases) alias) (while aliases *************** *** 763,772 **** (if (string-match (wildcard-to-regexp (cdr alias)) fn) (setq aliases nil) (setq alias nil))) ! (cdr alias))) (and fn (let ((ext (file-name-extension fn))) ! (and ext (concat "*." ext)))) (car grep-files-history) (car (car grep-files-aliases)))) (files (read-string --- 777,790 ---- (if (string-match (wildcard-to-regexp (cdr alias)) fn) (setq aliases nil) (setq alias nil))) ! (cdr alias)))) ! (default-extension (and fn (let ((ext (file-name-extension fn))) ! (and ext (concat "*." ext))))) ! (default ! (or default-alias ! default-extension (car grep-files-history) (car (car grep-files-aliases)))) (files (read-string *************** *** 774,780 **** "\" in files" (if default (concat " (default " default ")")) ": ") ! nil 'grep-files-history default))) (and files (or (cdr (assoc files grep-files-aliases)) files)))) --- 792,801 ---- "\" in files" (if default (concat " (default " default ")")) ": ") ! nil 'grep-files-history ! (delete-dups ! (delq nil (append (list default default-alias default-extension) ! (mapcar 'car grep-files-aliases))))))) (and files (or (cdr (assoc files grep-files-aliases)) files)))) *************** *** 822,828 **** (setq command (grep-expand-template grep-template regexp ! files)) (when command (if confirm (setq command --- 843,862 ---- (setq command (grep-expand-template grep-template regexp ! files ! nil ! (and grep-find-ignored-files ! (concat " --exclude=" ! (mapconcat ! #'(lambda (ignore) ! (cond ((stringp ignore) ! (shell-quote-argument ignore)) ! ((consp ignore) ! (and (funcall (car ignore) dir) ! (shell-quote-argument ! (cdr ignore)))))) ! grep-find-ignored-files ! " --exclude="))))) (when command (if confirm (setq command *************** *** 893,898 **** --- 927,933 ---- " " (shell-quote-argument ")")) dir + (concat (and grep-find-ignored-directories (concat (shell-quote-argument "(") ;; we should use shell-quote-argument here *************** *** 911,917 **** " -o -path ") " " (shell-quote-argument ")") ! " -prune -o "))))) (when command (if confirm (setq command --- 946,969 ---- " -o -path ") " " (shell-quote-argument ")") ! " -prune -o ")) ! (and grep-find-ignored-files ! (concat (shell-quote-argument "(") ! ;; we should use shell-quote-argument here ! " -name " ! (mapconcat ! #'(lambda (ignore) ! (cond ((stringp ignore) ! (shell-quote-argument ignore)) ! ((consp ignore) ! (and (funcall (car ignore) dir) ! (shell-quote-argument ! (cdr ignore)))))) ! grep-find-ignored-files ! " -o -name ") ! " " ! (shell-quote-argument ")") ! " -prune -o ")))))) (when command (if confirm (setq command -- Juri Linkov http://www.jurta.org/emacs/ From unknown Fri Jun 20 20:12:08 2025 X-Loop: owner@emacsbugs.donarmstrong.com Subject: bug#4301: rgrep/lgrep defaults Reply-To: Juri Linkov , 4301@debbugs.gnu.org Resent-From: Juri Linkov Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs 2Resent-Date: Thu, 10 Sep 2009 01:15:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-Emacs-PR-Message: followup 4301 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by 4301-submit@emacsbugs.donarmstrong.com id=B4301.125254495622423 (code B ref 4301); Thu, 10 Sep 2009 01:15:03 +0000 Received: (at 4301) by emacsbugs.donarmstrong.com; 10 Sep 2009 01:09:16 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.7 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mx2.starman.ee (smtp-out2.starman.ee [85.253.0.4]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n8A19EqV022420 for <4301@emacsbugs.donarmstrong.com>; Wed, 9 Sep 2009 18:09:15 -0700 X-Virus-Scanned: by Amavisd-New at mx2.starman.ee Received: from mail.starman.ee (82.131.30.70.cable.starman.ee [82.131.30.70]) by mx2.starman.ee (Postfix) with ESMTP id 4BD053F41BD for <4301@emacsbugs.donarmstrong.com>; Thu, 10 Sep 2009 04:09:09 +0300 (EEST) From: Juri Linkov To: 4301@debbugs.gnu.org Organization: JURTA References: <87ljkzsqk9.fsf@mail.jurta.org> Date: Thu, 10 Sep 2009 04:07:17 +0300 In-Reply-To: <87ljkzsqk9.fsf@mail.jurta.org> (Juri Linkov's message of "Mon, 31 Aug 2009 22:59:02 +0300") Message-ID: <87vdjrwqt6.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Currently reading a file name pattern in rgep/lgrep provides no completion. I think it would be better to provide file completion for the case when the user wants to limit the search to one particular file in the current directory, or to build a file name pattern based on the file in the current directory. Index: lisp/progmodes/grep.el =================================================================== RCS file: /sources/emacs/emacs/lisp/progmodes/grep.el,v retrieving revision 1.107 diff -c -r1.107 grep.el *** lisp/progmodes/grep.el 10 Sep 2009 00:57:44 -0000 1.107 --- lisp/progmodes/grep.el 10 Sep 2009 01:06:46 -0000 *************** *** 788,799 **** default-extension (car grep-files-history) (car (car grep-files-aliases)))) ! (files (read-string (concat "Search for \"" regexp "\" in files" (if default (concat " (default " default ")")) ": ") ! nil 'grep-files-history (delete-dups (delq nil (append (list default default-alias default-extension) (mapcar 'car grep-files-aliases))))))) --- 788,800 ---- default-extension (car grep-files-history) (car (car grep-files-aliases)))) ! (files (completing-read (concat "Search for \"" regexp "\" in files" (if default (concat " (default " default ")")) ": ") ! 'read-file-name-internal ! nil nil nil 'grep-files-history (delete-dups (delq nil (append (list default default-alias default-extension) (mapcar 'car grep-files-aliases))))))) -- Juri Linkov http://www.jurta.org/emacs/ From unknown Fri Jun 20 20:12:08 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: owner@emacsbugs.donarmstrong.com From: help-debbugs@gnu.org (Emacs bug Tracking System) To: Juri Linkov Subject: bug#4301 closed by Juri Linkov (Re: bug#4301: rgrep/lgrep defaults) Message-ID: References: <873a3m3cv5.fsf@mail.jurta.org> <87ljkzsqk9.fsf@mail.jurta.org> X-Emacs-PR-Message: they-closed 4301 X-Emacs-PR-Package: emacs Reply-To: 4301@debbugs.gnu.org Date: Mon, 07 Dec 2009 17:45:07 +0000 Content-Type: multipart/mixed; boundary="----------=_1260207907-23045-1" This is a multi-part message in MIME format... ------------=_1260207907-23045-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is an automatic notification regarding your bug report which was filed against the emacs package: #4301: rgrep/lgrep defaults It has been closed by Juri Linkov . Their explanation is attached below along with your original report. If this explanation is unsatisfactory and you have not received a better one in a separate message then please contact Juri Linkov by replying to this email. --=20 4301: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D4301 Emacs Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1260207907-23045-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 4301-done) by emacsbugs.donarmstrong.com; 7 Dec 2009 17:40:00 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-2.7 required=4.0 tests=AWL,HAS_BUG_NUMBER autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from mx2.starman.ee (smtp-out4.starman.ee [85.253.0.6]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id nB7Hdx5c022548 for <4301-done@emacsbugs.donarmstrong.com>; Mon, 7 Dec 2009 09:40:00 -0800 X-Virus-Scanned: by Amavisd-New at mx2.starman.ee Received: from mail.starman.ee (82.131.97.43.cable.starman.ee [82.131.97.43]) by mx2.starman.ee (Postfix) with ESMTP id 060063F40AA for <4301-done@emacsbugs.donarmstrong.com>; Mon, 7 Dec 2009 19:39:52 +0200 (EET) From: Juri Linkov To: 4301-done@debbugs.gnu.org Subject: Re: bug#4301: rgrep/lgrep defaults Organization: JURTA References: <87ljkzsqk9.fsf@mail.jurta.org> <87vdjrwqt6.fsf@mail.jurta.org> Date: Mon, 07 Dec 2009 19:36:30 +0200 In-Reply-To: <87vdjrwqt6.fsf@mail.jurta.org> (Juri Linkov's message of "Thu, 10 Sep 2009 04:07:17 +0300") Message-ID: <873a3m3cv5.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii > Currently reading a file name pattern in rgep/lgrep provides no completion. > I think it would be better to provide file completion for the case when > the user wants to limit the search to one particular file in the current > directory, or to build a file name pattern based on the file in the > current directory. Done. -- Juri Linkov http://www.jurta.org/emacs/ ------------=_1260207907-23045-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by emacsbugs.donarmstrong.com; 31 Aug 2009 20:09:32 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02 (2008-06-10) on rzlab.ucr.edu X-Spam-Level: X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. X-Spam-Status: No, score=-1.2 required=4.0 tests=AWL,FVGT_m_MULTI_ODD, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.5-bugs.debian.org_2005_01_02 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n7VK9Vx1017390 for ; Mon, 31 Aug 2009 13:09:32 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MiDBy-0000xj-FL for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2009 16:09:30 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MiDBs-0000rv-Ul for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2009 16:09:29 -0400 Received: from [199.232.76.173] (port=53206 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MiDBs-0000rs-OI for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2009 16:09:24 -0400 Received: from smtp-out1.starman.ee ([85.253.0.3]:54715 helo=mx1.starman.ee) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MiDBr-00008K-VD for bug-gnu-emacs@gnu.org; Mon, 31 Aug 2009 16:09:24 -0400 X-Virus-Scanned: by Amavisd-New at mx1.starman.ee Received: from mail.starman.ee (82.131.53.175.cable.starman.ee [82.131.53.175]) by mx1.starman.ee (Postfix) with ESMTP id 22C463F4244 for ; Mon, 31 Aug 2009 23:09:16 +0300 (EEST) From: Juri Linkov To: bug-gnu-emacs@gnu.org Subject: rgrep/lgrep defaults Organization: JURTA Date: Mon, 31 Aug 2009 22:59:02 +0300 Message-ID: <87ljkzsqk9.fsf@mail.jurta.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Currently rgep/lgrep proposes to search in C files by default. This default value assumes that majority of Emacs users prefer searching only in C files. This can't be true. So the current default value is useless. I think a better default value is to search _all_ files, where all includes hidden dot files as well. rgrep already searches in dot files, but lgrep doesn't. To remove this inconsistency we could bind "all" to "* .*" in `grep-files-aliases'. Placing it first makes it the default value which reads clear and understandable in the default prompt as: Search for "text" in files (default all): instead of the current: Search for "text" in files (default ch): "asm" could be moved to the bottom of the list of default values in `grep-files-aliases', so this less frequent alias comes last when retrieving via M-n. Also this requires removing ("ch" "el") from the pre-defined default of `grep-files-history' and moving ("ch" "el") higher in `grep-files-aliases'. Another inconsistency is that rgrep provides the default command that ignores vcs directories, but doesn't ignore vcs files like ".v", backup files "~" "\\`#" "\\`.#" and other ignorable files from `completion-ignored-extensions'. This can be improved by adding new customizable variable `grep-find-ignored-files' where the nil option disables it easily. The same nil option is also useful for `grep-find-ignored-directories' to disable it at once than deleting every value from the default list one by one. For rgrep, `grep-find-ignored-files' means mapping its list to something like \(-name .\#\* -o -name \*\~ -o -name \*.o -o ... \) -prune -o For lgrep, `grep-find-ignored-files' means mapping its list to something like grep --exclude=.\#\* --exclude=\*\~ --exclude=\*.o ... Below is a patch that implements this: Index: lisp/progmodes/grep.el =================================================================== RCS file: /sources/emacs/emacs/lisp/progmodes/grep.el,v retrieving revision 1.106 diff -c -w -b -r1.106 grep.el *** lisp/progmodes/grep.el 30 Aug 2009 23:46:09 -0000 1.106 --- lisp/progmodes/grep.el 31 Aug 2009 19:54:27 -0000 *************** *** 176,193 **** :group 'grep) (defcustom grep-files-aliases ! '(("asm" . "*.[sS]") ("c" . "*.c") ("cc" . "*.cc *.cxx *.cpp *.C *.CC *.c++") ("cchh" . "*.cc *.[ch]xx *.[ch]pp *.[CHh] *.CC *.HH *.[ch]++") ("hh" . "*.hxx *.hpp *.[Hh] *.HH *.h++") - ("ch" . "*.[ch]") - ("el" . "*.el") ("h" . "*.h") ("l" . "[Cc]hange[Ll]og*") ("m" . "[Mm]akefile*") ("tex" . "*.tex") ! ("texi" . "*.texi")) "*Alist of aliases for the FILES argument to `lgrep' and `rgrep'." :type 'alist :group 'grep) --- 176,194 ---- :group 'grep) (defcustom grep-files-aliases ! '(("all" . "* .*") ! ("el" . "*.el") ! ("ch" . "*.[ch]") ("c" . "*.c") ("cc" . "*.cc *.cxx *.cpp *.C *.CC *.c++") ("cchh" . "*.cc *.[ch]xx *.[ch]pp *.[CHh] *.CC *.HH *.[ch]++") ("hh" . "*.hxx *.hpp *.[Hh] *.HH *.h++") ("h" . "*.h") ("l" . "[Cc]hange[Ll]og*") ("m" . "[Mm]akefile*") ("tex" . "*.tex") ! ("texi" . "*.texi") ! ("asm" . "*.[sS]")) "*Alist of aliases for the FILES argument to `lgrep' and `rgrep'." :type 'alist :group 'grep) *************** *** 197,203 **** "*List of names of sub-directories which `rgrep' shall not recurse into. If an element is a cons cell, the car is called on the search directory to determine whether cdr should not be recursed into." ! :type '(repeat string) :group 'grep) (defcustom grep-error-screen-columns nil --- 198,217 ---- "*List of names of sub-directories which `rgrep' shall not recurse into. If an element is a cons cell, the car is called on the search directory to determine whether cdr should not be recursed into." ! :type '(choice (repeat :tag "Ignored directories" string) ! (const :tag "No ignored directories" nil)) ! :group 'grep) ! ! (defcustom grep-find-ignored-files ! (cons ".#*" (delq nil (mapcar (lambda (s) ! (unless (string-match-p "/\\'" s) ! (concat "*" s))) ! completion-ignored-extensions))) ! "*List of names of file names which `rgrep' and `lgrep' shall exclude. ! If an element is a cons cell, the car is called on the search directory ! to determine whether cdr should not be excluded." ! :type '(choice (repeat :tag "Ignored file" string) ! (const :tag "No ignored files" nil)) :group 'grep) (defcustom grep-error-screen-columns nil *************** *** 421,427 **** ;; History of lgrep and rgrep regexp and files args. (defvar grep-regexp-history nil) ! (defvar grep-files-history '("ch" "el")) ;;;###autoload (defun grep-process-setup () --- 435,441 ---- ;; History of lgrep and rgrep regexp and files args. (defvar grep-regexp-history nil) ! (defvar grep-files-history nil) ;;;###autoload (defun grep-process-setup () *************** *** 524,530 **** (format "%s %s " grep-program grep-options))) (unless grep-template (setq grep-template ! (format "%s %s " grep-program grep-options))) (unless grep-find-use-xargs (setq grep-find-use-xargs (cond --- 538,544 ---- (format "%s %s " grep-program grep-options))) (unless grep-template (setq grep-template ! (format "%s %s " grep-program grep-options))) (unless grep-find-use-xargs (setq grep-find-use-xargs (cond *************** *** 753,760 **** (fn (and bn (stringp bn) (file-name-nondirectory bn))) ! (default ! (or (and fn (let ((aliases grep-files-aliases) alias) (while aliases --- 767,774 ---- (fn (and bn (stringp bn) (file-name-nondirectory bn))) ! (default-alias ! (and fn (let ((aliases grep-files-aliases) alias) (while aliases *************** *** 763,772 **** (if (string-match (wildcard-to-regexp (cdr alias)) fn) (setq aliases nil) (setq alias nil))) ! (cdr alias))) (and fn (let ((ext (file-name-extension fn))) ! (and ext (concat "*." ext)))) (car grep-files-history) (car (car grep-files-aliases)))) (files (read-string --- 777,790 ---- (if (string-match (wildcard-to-regexp (cdr alias)) fn) (setq aliases nil) (setq alias nil))) ! (cdr alias)))) ! (default-extension (and fn (let ((ext (file-name-extension fn))) ! (and ext (concat "*." ext))))) ! (default ! (or default-alias ! default-extension (car grep-files-history) (car (car grep-files-aliases)))) (files (read-string *************** *** 774,780 **** "\" in files" (if default (concat " (default " default ")")) ": ") ! nil 'grep-files-history default))) (and files (or (cdr (assoc files grep-files-aliases)) files)))) --- 792,801 ---- "\" in files" (if default (concat " (default " default ")")) ": ") ! nil 'grep-files-history ! (delete-dups ! (delq nil (append (list default default-alias default-extension) ! (mapcar 'car grep-files-aliases))))))) (and files (or (cdr (assoc files grep-files-aliases)) files)))) *************** *** 822,828 **** (setq command (grep-expand-template grep-template regexp ! files)) (when command (if confirm (setq command --- 843,862 ---- (setq command (grep-expand-template grep-template regexp ! files ! nil ! (and grep-find-ignored-files ! (concat " --exclude=" ! (mapconcat ! #'(lambda (ignore) ! (cond ((stringp ignore) ! (shell-quote-argument ignore)) ! ((consp ignore) ! (and (funcall (car ignore) dir) ! (shell-quote-argument ! (cdr ignore)))))) ! grep-find-ignored-files ! " --exclude="))))) (when command (if confirm (setq command *************** *** 893,898 **** --- 927,933 ---- " " (shell-quote-argument ")")) dir + (concat (and grep-find-ignored-directories (concat (shell-quote-argument "(") ;; we should use shell-quote-argument here *************** *** 911,917 **** " -o -path ") " " (shell-quote-argument ")") ! " -prune -o "))))) (when command (if confirm (setq command --- 946,969 ---- " -o -path ") " " (shell-quote-argument ")") ! " -prune -o ")) ! (and grep-find-ignored-files ! (concat (shell-quote-argument "(") ! ;; we should use shell-quote-argument here ! " -name " ! (mapconcat ! #'(lambda (ignore) ! (cond ((stringp ignore) ! (shell-quote-argument ignore)) ! ((consp ignore) ! (and (funcall (car ignore) dir) ! (shell-quote-argument ! (cdr ignore)))))) ! grep-find-ignored-files ! " -o -name ") ! " " ! (shell-quote-argument ")") ! " -prune -o ")))))) (when command (if confirm (setq command -- Juri Linkov http://www.jurta.org/emacs/ ------------=_1260207907-23045-1--