aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2007-07-18 21:02:29 +0000
committerMichael Albinus2007-07-18 21:02:29 +0000
commit6e3aa3f58ef253559ce6416d6aa02885cd944ff1 (patch)
tree99d1b24130d51057bc58a0ff60c6860bd1f4b684
parent2b330cb8aef141a2bd409b7a51f3c1a017d30a56 (diff)
downloademacs-6e3aa3f58ef253559ce6416d6aa02885cd944ff1.tar.gz
emacs-6e3aa3f58ef253559ce6416d6aa02885cd944ff1.zip
* progmodes/grep.el (grep-host-defaults-alist): New defvar.
(grep-compute-defaults): Use it.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/progmodes/grep.el47
2 files changed, 38 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a587585ce0e..f8a38266120 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12007-07-18 Michael Albinus <michael.albinus@gmx.de>
2
3 * progmodes/grep.el (grep-host-defaults-alist): New defvar.
4 (grep-compute-defaults): Use it.
5
12007-07-18 Stefan Monnier <monnier@iro.umontreal.ca> 62007-07-18 Stefan Monnier <monnier@iro.umontreal.ca>
2 7
3 * uniquify.el: Docstring fixes. 8 * uniquify.el: Docstring fixes.
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 24d5eababc6..669b469cded 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -343,6 +343,12 @@ This variable's value takes effect when `grep-compute-defaults' is called.")
343(defvar grep-regexp-history nil) 343(defvar grep-regexp-history nil)
344(defvar grep-files-history '("ch" "el")) 344(defvar grep-files-history '("ch" "el"))
345 345
346(defvar grep-host-defaults-alist nil
347 "Default values depending on target host.
348`grep-compute-defaults' returns default values for every local or
349remote host `grep' runs. These values can differ from host to
350host. Once computed, the default values are kept here in order
351to avoid computing them again.")
346 352
347;;;###autoload 353;;;###autoload
348(defun grep-process-setup () 354(defun grep-process-setup ()
@@ -383,31 +389,38 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
383 ;; computed for every host once, then they are kept in the 389 ;; computed for every host once, then they are kept in the
384 ;; variables' property host-id for reuse. 390 ;; variables' property host-id for reuse.
385 (setq grep-command 391 (setq grep-command
386 (or (get 'grep-command host-id) 392 (or (cadr (assq 'grep-command
393 (assq host-id grep-host-defaults-alist)))
387 (eval (car (get 'grep-command 'standard-value)))) 394 (eval (car (get 'grep-command 'standard-value))))
388 395
389 grep-template 396 grep-template
390 (or (get 'grep-template host-id) 397 (or (cadr (assq 'grep-template
398 (assq host-id grep-host-defaults-alist)))
391 (eval (car (get 'grep-template 'standard-value)))) 399 (eval (car (get 'grep-template 'standard-value))))
392 400
393 grep-use-null-device 401 grep-use-null-device
394 (or (get 'grep-use-null-device host-id) 402 (or (cadr (assq 'grep-use-null-device
403 (assq host-id grep-host-defaults-alist)))
395 (eval (car (get 'grep-use-null-device 'standard-value)))) 404 (eval (car (get 'grep-use-null-device 'standard-value))))
396 405
397 grep-find-command 406 grep-find-command
398 (or (get 'grep-find-command host-id) 407 (or (cadr (assq 'grep-find-command
408 (assq host-id grep-host-defaults-alist)))
399 (eval (car (get 'grep-find-command 'standard-value)))) 409 (eval (car (get 'grep-find-command 'standard-value))))
400 410
401 grep-find-template 411 grep-find-template
402 (or (get 'grep-find-template host-id) 412 (or (cadr (assq 'grep-find-template
413 (assq host-id grep-host-defaults-alist)))
403 (eval (car (get 'grep-find-template 'standard-value)))) 414 (eval (car (get 'grep-find-template 'standard-value))))
404 415
405 grep-find-use-xargs 416 grep-find-use-xargs
406 (or (get 'grep-find-use-xargs host-id) 417 (or (cadr (assq 'grep-find-use-xargs
418 (assq host-id grep-host-defaults-alist)))
407 (eval (car (get 'grep-find-use-xargs 'standard-value)))) 419 (eval (car (get 'grep-find-use-xargs 'standard-value))))
408 420
409 grep-highlight-matches 421 grep-highlight-matches
410 (or (get 'grep-highlight-matches host-id) 422 (or (cadr (assq 'grep-highlight-matches
423 (assq host-id grep-host-defaults-alist)))
411 (eval (car (get 'grep-highlight-matches 'standard-value))))) 424 (eval (car (get 'grep-highlight-matches 'standard-value)))))
412 425
413 (unless (or (not grep-use-null-device) (eq grep-use-null-device t)) 426 (unless (or (not grep-use-null-device) (eq grep-use-null-device t))
@@ -492,13 +505,19 @@ Set up `compilation-exit-message-function' and run `grep-setup-hook'."
492 t)))) 505 t))))
493 506
494 ;; Save defaults for this host. 507 ;; Save defaults for this host.
495 (put 'grep-command host-id grep-command) 508 (setq grep-host-defaults-alist
496 (put 'grep-template host-id grep-template) 509 (delete (assq host-id grep-host-defaults-alist)
497 (put 'grep-use-null-device host-id grep-use-null-device) 510 grep-host-defaults-alist))
498 (put 'grep-find-command host-id grep-find-command) 511 (add-to-list
499 (put 'grep-find-template host-id grep-find-template) 512 'grep-host-defaults-alist
500 (put 'grep-find-use-xargs host-id grep-find-use-xargs) 513 (cons host-id
501 (put 'grep-highlight-matches host-id grep-highlight-matches))) 514 `((grep-command ,grep-command)
515 (grep-template ,grep-template)
516 (grep-use-null-device ,grep-use-null-device)
517 (grep-find-command ,grep-find-command)
518 (grep-find-template ,grep-find-template)
519 (grep-find-use-xargs ,grep-find-use-xargs)
520 (grep-highlight-matches ,grep-highlight-matches))))))
502 521
503(defun grep-tag-default () 522(defun grep-tag-default ()
504 (or (and transient-mark-mode mark-active 523 (or (and transient-mark-mode mark-active