emacs-devel
[Top][All Lists]
Advanced

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

grep-program and grep-command


From: Lennart Borgman (gmail)
Subject: grep-program and grep-command
Date: Thu, 25 Jan 2007 17:23:39 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666

The grep-command is a defcustom, but grep-program is a defvar. grep-command is computed by Emacs if its value is nil.

This seems a bit akward to me. It tells the user to customize grep-command if things does not work by default. Would it not be better if they instead set grep-program and let Emacs compute grep-command?

But since we want them to use customize we then should make grep-program into a defcustom. I suggest that grep-program is defined something like this (unfinished, and I I have renamed it to grep-program1 just for testing):


(defcustom grep-program1
  ;; Currently zgrep has trouble.  It runs egrep instead of grep,
  ;; and it doesn't pass along long options right.
  "grep"
  ;; (if (equal (condition-case nil     ; in case "zgrep" isn't in exec-path
  ;;             (call-process "zgrep" nil nil nil
  ;;                           "foo" null-device)
  ;;           (error nil))
  ;;         1)
  ;;     "zgrep"
  ;;   "grep")
  "The default grep program for `grep-command' and `grep-find-command'.
This variable's value takes effect when `grep-compute-defaults' is called."
  :type 'file
  :set (lambda(sym val)
         (unless (string= grep-command
                          (car (get 'grep-command 'customized-value)))
           (setq grep-command nil))
         ;; Add similar checks above for other computed values that
         ;; depends on this variable ...
         (set-default sym val))
  :group 'grep)




reply via email to

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