]> code.delx.au - gnu-emacs/commitdiff
Prefer grep -E/-F to egrep/fgrep
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 8 May 2016 01:40:10 +0000 (18:40 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 8 May 2016 01:40:55 +0000 (18:40 -0700)
POSIX marked egrep and fgrep as legacy apps in SUSv2 (1997) and
withdrew them in SUSv3 (2001), and these days grep -E and grep -F
are probably more portable.
* lib-src/etags.c (main):
* lisp/eshell/em-unix.el (eshell-grep, eshell/egrep)
(eshell/fgrep):
* lisp/cedet/semantic/symref.el (semantic-symref-find-text):
* lisp/eshell/esh-var.el (eshell-apply-indices):
* lisp/progmodes/ada-xref.el (ada-xref-search-with-egrep)
(ada-find-in-src-path):
* lisp/textmodes/ispell.el (ispell-grep-command):
(ispell-lookup-words):
Use or document grep -E and grep -F instead of egrep and fgrep.
* lisp/textmodes/ispell.el (ispell-grep-options):
Use -Ei on all platforms, not just MS-Windows.

lib-src/etags.c
lisp/cedet/semantic/symref.el
lisp/eshell/em-unix.el
lisp/eshell/esh-var.el
lisp/progmodes/ada-xref.el
lisp/textmodes/ispell.el

index 01e230206ac8419e6b9e31e03f00955a88b39f06..e8b71e6b96a3119ebace66cec8c25488279024ab 100644 (file)
@@ -1343,7 +1343,7 @@ main (int argc, char **argv)
     {
       char *cmd =
        xmalloc (strlen (tagfile) + whatlen_max +
-                sizeof "mv..OTAGS;fgrep -v '\t\t' OTAGS >;rm OTAGS");
+                sizeof "mv..OTAGS;grep -Fv '\t\t' OTAGS >;rm OTAGS");
       for (i = 0; i < current_arg; ++i)
        {
          switch (argbuffer[i].arg_type)
@@ -1356,7 +1356,7 @@ main (int argc, char **argv)
            }
          char *z = stpcpy (cmd, "mv ");
          z = stpcpy (z, tagfile);
-         z = stpcpy (z, " OTAGS;fgrep -v '\t");
+         z = stpcpy (z, " OTAGS;grep -Fv '\t");
          z = stpcpy (z, argbuffer[i].what);
          z = stpcpy (z, "\t' OTAGS >");
          z = stpcpy (z, tagfile);
index 516a4f30414e87897ee5c6a22a1f5bc8f3e67d05..8b3196a3982dfb681c132a2ba46cccd4f7fead81 100644 (file)
@@ -271,7 +271,7 @@ Optional SCOPE specifies which file set to search.  Defaults to `project'.
 Refers to `semantic-symref-tool', to determine the reference tool to use
 for the current buffer.
 Returns an object of class `semantic-symref-result'."
-  (interactive "sEgrep style Regexp: ")
+  (interactive "sGrep -E style Regexp: ")
   (let* ((inst (semantic-symref-instantiate
                :searchfor text
                :searchtype 'regexp
index c27c18c52baa2bcdd5384980e11c7eebb3bd5aaa..e40dbded60b6e928aeee0119a83898c55e8ae923 100644 (file)
@@ -748,7 +748,12 @@ external command."
             (cmd (progn
                    (set-text-properties 0 (length args)
                                         '(invisible t) args)
-                   (format "%s -n %s" command args)))
+                   (format "%s -n %s"
+                           (pcase command
+                             ("egrep" "grep -E")
+                             ("fgrep" "grep -F")
+                             (x x))
+                           args)))
             compilation-scroll-output)
        (grep cmd)))))
 
@@ -757,11 +762,11 @@ external command."
   (eshell-grep "grep" args t))
 
 (defun eshell/egrep (&rest args)
-  "Use Emacs grep facility instead of calling external egrep."
+  "Use Emacs grep facility instead of calling external grep -E."
   (eshell-grep "egrep" args t))
 
 (defun eshell/fgrep (&rest args)
-  "Use Emacs grep facility instead of calling external fgrep."
+  "Use Emacs grep facility instead of calling external grep -F."
   (eshell-grep "fgrep" args t))
 
 (defun eshell/agrep (&rest args)
index 7213ad70e8463ddf238029da61338b1ad983548e..5915efbac1ef22303e778250d70aec0d265959d9 100644 (file)
@@ -530,7 +530,7 @@ Integers imply a direct index, and names, an associate lookup using
 For example, to retrieve the second element of a user's record in
 '/etc/passwd', the variable reference would look like:
 
-  ${egrep johnw /etc/passwd}[: 2]"
+  ${grep johnw /etc/passwd}[: 2]"
   (while indices
     (let ((refs (car indices)))
       (when (stringp value)
index 8518163a1b793ecc374f6b40c038806ca9170929..b3248d3f13ba4bfcb603810bfe70a47e415c6a45 100644 (file)
@@ -174,7 +174,7 @@ If GVD is not the debugger used, nothing happens."
   :type 'boolean :group 'ada)
 
 (defcustom ada-xref-search-with-egrep t
-  "If non-nil, use egrep to find the possible declarations for an entity.
+  "If non-nil, use grep -E to find the possible declarations for an entity.
 This alternate method is used when the exact location was not found in the
 information provided by GNAT.  However, it might be expensive if you have a lot
 of sources, since it will search in all the files in your project."
@@ -2013,7 +2013,7 @@ This function should be used when the standard algorithm that parses the
 exist.
 This function attempts to find the possible declarations for the identifier
 anywhere in the object path.
-This command requires the external `egrep' program to be available.
+This command requires the external `grep' program to be available.
 
 This works well when one is using an external library and wants to find
 the declaration and documentation of the subprograms one is using."
index 284fea4acd59f7b69e84b44b5f7951dba26d3a5a..0ed6c6894297b4827f7114bf7bd9f51f89bb8e4c 100644 (file)
@@ -396,19 +396,15 @@ Always stores Fcc copy of message when nil."
 
 
 (defcustom ispell-grep-command
-  ;; MS-Windows/MS-DOS have `egrep' as a Unix shell script, so they
-  ;; cannot invoke it.  Use "grep -E" instead (see ispell-grep-options
-  ;; below).
-  (if (memq system-type '(windows-nt ms-dos)) "grep" "egrep")
+  "grep"
   "Name of the grep command for search processes."
   :type 'string
   :group 'ispell)
 
 (defcustom ispell-grep-options
-  (if (memq system-type '(windows-nt ms-dos)) "-Ei" "-i")
+  "-Ei"
   "String of options to use when running the program in `ispell-grep-command'.
-Should probably be \"-i\" or \"-e\".
-Some machines (like the NeXT) don't support \"-i\"."
+Should probably be \"-Ei\"."
   :type 'string
   :group 'ispell)
 
@@ -2678,8 +2674,8 @@ SPC:   Accept word this time.
 (defun ispell-lookup-words (word &optional lookup-dict)
   "Look up WORD in optional word-list dictionary LOOKUP-DICT.
 A `*' serves as a wild card.  If no wild cards, `look' is used if it exists.
-Otherwise the variable `ispell-grep-command' contains the command used to
-search for the words (usually egrep).
+Otherwise the variable `ispell-grep-command' contains the command
+\(usually \"grep\") used to search for the words.
 
 Optional second argument contains the dictionary to use; the default is
 `ispell-alternate-dictionary', overridden by `ispell-complete-word-dict'