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: Michael Albinus
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/grep.el,v
Date: Tue, 17 Jul 2007 21:08:50 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       07/07/17 21:08:50

Index: grep.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/grep.el,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -b -r1.72 -r1.73
--- grep.el     7 Apr 2007 16:55:36 -0000       1.72
+++ grep.el     17 Jul 2007 21:08:49 -0000      1.73
@@ -371,12 +371,45 @@
 
 (defun grep-probe (command args &optional func result)
   (equal (condition-case nil
-            (apply (or func 'call-process) command args)
+            (apply (or func 'process-file) command args)
           (error nil))
         (or result 0)))
 
 ;;;###autoload
 (defun grep-compute-defaults ()
+  (let ((host-id
+        (intern (or (file-remote-p default-directory 'host) "localhost"))))
+    ;; There are different defaults on different hosts.  They must be
+    ;; computed for every host once, then they are kept in the
+    ;; variables' property host-id for reuse.
+    (setq grep-command
+         (or (get 'grep-command host-id)
+             (eval (car (get 'grep-command 'standard-value))))
+
+         grep-template
+          (or (get 'grep-template host-id)
+             (eval (car (get 'grep-template 'standard-value))))
+
+         grep-use-null-device
+         (or (get 'grep-use-null-device host-id)
+             (eval (car (get 'grep-use-null-device 'standard-value))))
+
+         grep-find-command
+         (or (get 'grep-find-command host-id)
+             (eval (car (get 'grep-find-command 'standard-value))))
+
+         grep-find-template
+         (or (get 'grep-find-template host-id)
+             (eval (car (get 'grep-find-template 'standard-value))))
+
+         grep-find-use-xargs
+         (or (get 'grep-find-use-xargs host-id)
+             (eval (car (get 'grep-find-use-xargs 'standard-value))))
+
+         grep-highlight-matches
+         (or (get 'grep-highlight-matches host-id)
+             (eval (car (get 'grep-highlight-matches 'standard-value)))))
+
   (unless (or (not grep-use-null-device) (eq grep-use-null-device t))
     (setq grep-use-null-device
          (with-temp-buffer
@@ -456,7 +489,16 @@
                 (progn
                   (goto-char (point-min))
                   (search-forward "--color" nil t))
-                t)))))
+                  t))))
+
+    ;; Save defaults for this host.
+    (put 'grep-command host-id grep-command)
+    (put 'grep-template host-id grep-template)
+    (put 'grep-use-null-device host-id grep-use-null-device)
+    (put 'grep-find-command host-id grep-find-command)
+    (put 'grep-find-template host-id grep-find-template)
+    (put 'grep-find-use-xargs host-id grep-find-use-xargs)
+    (put 'grep-highlight-matches host-id grep-highlight-matches)))
 
 (defun grep-tag-default ()
   (or (and transient-mark-mode mark-active




reply via email to

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