aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2007-07-22 19:59:30 +0000
committerMichael Albinus2007-07-22 19:59:30 +0000
commit2e2eead345f7ab3e4ac81916f2d6b415fc54daf0 (patch)
treea3b32419477bea814eaceac1a93f86f7162c145a
parenta9686d00fd25a43b8f94bf73bff9442118ff4272 (diff)
downloademacs-2e2eead345f7ab3e4ac81916f2d6b415fc54daf0.tar.gz
emacs-2e2eead345f7ab3e4ac81916f2d6b415fc54daf0.zip
* progmodes/grep.el (grep-compute-defaults): Keep default values.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/progmodes/grep.el56
2 files changed, 35 insertions, 25 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 65274cc29e6..0135fd6accd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12007-07-22 Michael Albinus <michael.albinus@gmx.de>
2
3 * progmodes/grep.el (grep-compute-defaults): Keep default values.
4
12007-07-22 Ralf Angeli <angeli@caeruleus.net> 52007-07-22 Ralf Angeli <angeli@caeruleus.net>
2 6
3 * textmodes/reftex.el (reftex-access-parse-file): Create parse 7 * textmodes/reftex.el (reftex-access-parse-file): Create parse
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 669b469cded..fd93015ab2c 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -383,45 +383,51 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
383 383
384;;;###autoload 384;;;###autoload
385(defun grep-compute-defaults () 385(defun grep-compute-defaults ()
386 (let ((host-id 386 ;; Keep default values.
387 (intern (or (file-remote-p default-directory 'host) "localhost")))) 387 (unless grep-host-defaults-alist
388 (add-to-list
389 'grep-host-defaults-alist
390 (cons nil
391 `((grep-command ,grep-command)
392 (grep-template ,grep-template)
393 (grep-use-null-device ,grep-use-null-device)
394 (grep-find-command ,grep-find-command)
395 (grep-find-template ,grep-find-template)
396 (grep-find-use-xargs ,grep-find-use-xargs)
397 (grep-highlight-matches ,grep-highlight-matches)))))
398 (let* ((host-id
399 (intern (or (file-remote-p default-directory 'host) "localhost")))
400 (host-defaults (assq host-id grep-host-defaults-alist))
401 (defaults (assq nil grep-host-defaults-alist)))
388 ;; There are different defaults on different hosts. They must be 402 ;; There are different defaults on different hosts. They must be
389 ;; computed for every host once, then they are kept in the 403 ;; computed for every host once.
390 ;; variables' property host-id for reuse.
391 (setq grep-command 404 (setq grep-command
392 (or (cadr (assq 'grep-command 405 (or (cadr (assq 'grep-command host-defaults))
393 (assq host-id grep-host-defaults-alist))) 406 (cadr (assq 'grep-command defaults)))
394 (eval (car (get 'grep-command 'standard-value))))
395 407
396 grep-template 408 grep-template
397 (or (cadr (assq 'grep-template 409 (or (cadr (assq 'grep-template host-defaults))
398 (assq host-id grep-host-defaults-alist))) 410 (cadr (assq 'grep-template defaults)))
399 (eval (car (get 'grep-template 'standard-value))))
400 411
401 grep-use-null-device 412 grep-use-null-device
402 (or (cadr (assq 'grep-use-null-device 413 (or (cadr (assq 'grep-use-null-device host-defaults))
403 (assq host-id grep-host-defaults-alist))) 414 (cadr (assq 'grep-use-null-device defaults)))
404 (eval (car (get 'grep-use-null-device 'standard-value))))
405 415
406 grep-find-command 416 grep-find-command
407 (or (cadr (assq 'grep-find-command 417 (or (cadr (assq 'grep-find-command host-defaults))
408 (assq host-id grep-host-defaults-alist))) 418 (cadr (assq 'grep-find-command defaults)))
409 (eval (car (get 'grep-find-command 'standard-value))))
410 419
411 grep-find-template 420 grep-find-template
412 (or (cadr (assq 'grep-find-template 421 (or (cadr (assq 'grep-find-template host-defaults))
413 (assq host-id grep-host-defaults-alist))) 422 (cadr (assq 'grep-find-template defaults)))
414 (eval (car (get 'grep-find-template 'standard-value))))
415 423
416 grep-find-use-xargs 424 grep-find-use-xargs
417 (or (cadr (assq 'grep-find-use-xargs 425 (or (cadr (assq 'grep-find-use-xargs host-defaults))
418 (assq host-id grep-host-defaults-alist))) 426 (cadr (assq 'grep-find-use-xargs defaults)))
419 (eval (car (get 'grep-find-use-xargs 'standard-value))))
420 427
421 grep-highlight-matches 428 grep-highlight-matches
422 (or (cadr (assq 'grep-highlight-matches 429 (or (cadr (assq 'grep-highlight-matches host-defaults))
423 (assq host-id grep-host-defaults-alist))) 430 (cadr (assq 'grep-highlight-matches defaults))))
424 (eval (car (get 'grep-highlight-matches 'standard-value)))))
425 431
426 (unless (or (not grep-use-null-device) (eq grep-use-null-device t)) 432 (unless (or (not grep-use-null-device) (eq grep-use-null-device t))
427 (setq grep-use-null-device 433 (setq grep-use-null-device