emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/grep.el,v


From: Kim F. Storm
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/grep.el,v
Date: Wed, 14 Feb 2007 11:54:13 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Kim F. Storm <kfstorm>  07/02/14 11:54:12

Index: grep.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/grep.el,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -b -r1.68 -r1.69
--- grep.el     12 Feb 2007 06:44:47 -0000      1.68
+++ grep.el     14 Feb 2007 11:54:12 -0000      1.69
@@ -150,6 +150,8 @@
        ("asm" . "*.[sS]")
        ("m" .  "[Mm]akefile*")
        ("l" . "[Cc]hange[Ll]og*")
+       ("tex" . "*.tex")
+       ("texi" . "*.texi")
        )
   "*Alist of aliases for the FILES argument to `lgrep' and `rgrep'."
   :type 'alist
@@ -532,7 +534,7 @@
 where grep found matches.
 
 For doing a recursive `grep', see the `rgrep' command.  For running
-`grep' in the current directory see `lgrep'.
+`grep' in a specific directory, see `lgrep'.
 
 This command uses a special history list for its COMMAND-ARGS, so you can
 easily repeat a grep command.
@@ -657,8 +659,8 @@
             files))))
 
 ;;;###autoload
-(defun lgrep (regexp &optional files)
-  "Run grep, searching for REGEXP in FILES in current directory.
+(defun lgrep (regexp &optional files dir)
+  "Run grep, searching for REGEXP in FILES in directory DIR.
 The search is limited to file names matching shell pattern FILES.
 FILES may use abbreviations defined in `grep-files-aliases', e.g.
 entering `ch' is equivalent to `*.[ch]'.
@@ -684,13 +686,16 @@
        (list nil
             (read-string "grep.el: No `grep-template' available. Press RET.")))
       (t (let* ((regexp (grep-read-regexp))
-               (files (grep-read-files regexp)))
-          (list regexp files))))))
+               (files (grep-read-files regexp))
+               (dir (read-directory-name "In directory: "
+                                         nil default-directory t)))
+          (list regexp files dir))))))
   (when (and (stringp regexp) (> (length regexp) 0))
     (let ((command regexp))
       (if (null files)
          (if (string= command grep-command)
              (setq command nil))
+       (setq dir (file-name-as-directory (expand-file-name dir)))
        (setq command (grep-expand-template
                       grep-template
                       regexp
@@ -702,11 +707,15 @@
                                          command nil nil 'grep-history))
            (add-to-history 'grep-history command))))
       (when command
+       (let ((default-directory dir))
        ;; Setting process-setup-function makes exit-message-function work
        ;; even when async processes aren't supported.
        (compilation-start (if (and grep-use-null-device null-device)
                               (concat command " " null-device)
-                            command) 'grep-mode)))))
+                              command) 'grep-mode))
+       (if (eq next-error-last-buffer (current-buffer))
+           (setq default-directory dir))))))
+
 
 
 ;;;###autoload




reply via email to

[Prev in Thread] Current Thread [Next in Thread]