/[emacs]/emacs/lisp/progmodes/grep.el
ViewVC logotype

Diff of /emacs/lisp/progmodes/grep.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10.2.6 by miles, Sat Sep 4 09:14:25 2004 UTC revision 1.10.2.7 by miles, Thu Sep 9 09:36:33 2004 UTC
# Line 64  will be parsed and highlighted as soon a Line 64  will be parsed and highlighted as soon a
64    :version "21.4"    :version "21.4"
65    :group 'grep)    :group 'grep)
66    
67  (defcustom grep-highlight-matches t  (defcustom grep-highlight-matches 'auto-detect
68    "*Non-nil to use special markers to highlight grep matches.    "If t, use special markers to highlight grep matches.
69    
70  Some grep programs are able to surround matches with special  Some grep programs are able to surround matches with special
71  markers in grep output.  Such markers can be used to highlight  markers in grep output.  Such markers can be used to highlight
# Line 74  matches in grep mode. Line 74  matches in grep mode.
74  This option sets the environment variable GREP_COLOR to specify  This option sets the environment variable GREP_COLOR to specify
75  markers for highlighting and GREP_OPTIONS to add the --color  markers for highlighting and GREP_OPTIONS to add the --color
76  option in front of any explicit grep options before starting  option in front of any explicit grep options before starting
77  the grep."  the grep.
78    :type 'boolean  
79    The default value of this variable is set up by `grep-compute-defaults';
80    call that function before using this variable in your program."
81      :type '(choice (const :tag "Do not highlight matches with grep markers" nil)
82                     (const :tag "Highlight matches with grep markers" t)
83                     (other :tag "Not Set" auto-detect))
84    :version "21.4"    :version "21.4"
85    :group 'grep)    :group 'grep)
86    
# Line 110  necessary if the grep program used suppo Line 115  necessary if the grep program used suppo
115    
116  The default value of this variable is set up by `grep-compute-defaults';  The default value of this variable is set up by `grep-compute-defaults';
117  call that function before using this variable in your program."  call that function before using this variable in your program."
   :type 'boolean  
118    :type '(choice (const :tag "Do Not Append Null Device" nil)    :type '(choice (const :tag "Do Not Append Null Device" nil)
119                   (const :tag "Append Null Device" t)                   (const :tag "Append Null Device" t)
120                   (other :tag "Not Set" auto-detect))                   (other :tag "Not Set" auto-detect))
# Line 181  See `compilation-error-screen-columns'" Line 185  See `compilation-error-screen-columns'"
185    (let ((map (cons 'keymap compilation-minor-mode-map)))    (let ((map (cons 'keymap compilation-minor-mode-map)))
186      (define-key map " " 'scroll-up)      (define-key map " " 'scroll-up)
187      (define-key map "\^?" 'scroll-down)      (define-key map "\^?" 'scroll-down)
188        (define-key map "\C-c\C-f" 'next-error-follow-minor-mode)
189    
190      ;; This is intolerable -- rms      ;; This is intolerable -- rms
191  ;;;    (define-key map [remap next-line] 'compilation-next-error)  ;;;    (define-key map [remap next-line] 'compilation-next-error)
# Line 332  This variable's value takes effect when Line 337  This variable's value takes effect when
337  (defun grep-process-setup ()  (defun grep-process-setup ()
338    "Setup compilation variables and buffer for `grep'.    "Setup compilation variables and buffer for `grep'.
339  Set up `compilation-exit-message-function' and run `grep-setup-hook'."  Set up `compilation-exit-message-function' and run `grep-setup-hook'."
340    (when grep-highlight-matches    (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t))
341        (grep-compute-defaults))
342      (when (eq grep-highlight-matches t)
343      ;; Modify `process-environment' locally bound in `compilation-start'      ;; Modify `process-environment' locally bound in `compilation-start'
344      (setenv "GREP_OPTIONS" (concat (getenv "GREP_OPTIONS") " --color=always"))      (setenv "GREP_OPTIONS" (concat (getenv "GREP_OPTIONS") " --color=always"))
345      (setenv "GREP_COLOR" "01;41"))      (setenv "GREP_COLOR" "01;41"))
# Line 414  Set up `compilation-exit-message-functio Line 421  Set up `compilation-exit-message-functio
421                     (format "%s <D> <X> -type f <F> -print | xargs %s <R>"                     (format "%s <D> <X> -type f <F> -print | xargs %s <R>"
422                             find-program gcmd))                             find-program gcmd))
423                    (t (format "%s <D> <X> -type f <F> -exec %s <R> {} %s \\;"                    (t (format "%s <D> <X> -type f <F> -exec %s <R> {} %s \\;"
424                               find-program gcmd null-device)))))))                               find-program gcmd null-device))))))
425      (unless (or (not grep-highlight-matches) (eq grep-highlight-matches t))
426        (setq grep-highlight-matches
427              (with-temp-buffer
428                (and (equal (condition-case nil
429                                (call-process grep-program nil t nil "--help")
430                              (error nil))
431                            0)
432                     (progn
433                       (goto-char (point-min))
434                       (search-forward "--color" nil t))
435                     t)))))
436    
437  (defun grep-default-command ()  (defun grep-default-command ()
438    (let ((tag-default    (let ((tag-default
# Line 482  temporarily highlight in visited source Line 500  temporarily highlight in visited source
500                           command-args)                           command-args)
501                         'grep-mode nil highlight-regexp)))                         'grep-mode nil highlight-regexp)))
502    
503  ;;;###autoload (autoload 'grep-mode "grep" nil t)  ;;; This doesn't work:
504    ;;;      ###autoload (autoload 'grep-mode "grep" nil t)
505    ;;; The ostensibly correct result is nonetheless opaque to the accounting
506    ;;; done in `generate-file-autoloads'; in loaddefs.el, the generated elisp is
507    ;;; correct but the generated header comment for grep.el lacks `grep-mode'.
508    ;;; This approach also doesn't help other users of `define-compilation-mode'
509    ;;; who wish to autoload.
510    ;;;
511    ;;; Better to extend autoload.el to grok `define-compilation-mode'.
512    
513    ;;;###autoload
514  (define-compilation-mode grep-mode "Grep"  (define-compilation-mode grep-mode "Grep"
515    "Sets `grep-last-buffer' and `compilation-window-height'."    "Sets `grep-last-buffer' and `compilation-window-height'."
516    (setq grep-last-buffer (current-buffer))    (setq grep-last-buffer (current-buffer))

Legend:
Removed from v.1.10.2.6  
changed lines
  Added in v.1.10.2.7

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26