Variable: grep-mode-hook

grep-mode-hook is a variable defined in grep.el.gz.

Value

nil

Documentation

Hook run after entering grep-mode.

No problems result if this variable is not bound. add-hook automatically binds it. (This is true for all hook variables.)

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/grep.el.gz
;;;###autoload
(define-compilation-mode grep-mode "Grep"
  "Sets `grep-last-buffer' and `compilation-window-height'."
  (setq grep-last-buffer (current-buffer))
  (setq-local tool-bar-map grep-mode-tool-bar-map)
  (setq-local compilation-error-face
              grep-hit-face)
  (setq-local compilation-error-regexp-alist
              grep-regexp-alist)
  (setq-local compilation-mode-line-errors
              grep-mode-line-matches)
  ;; compilation-directory-matcher can't be nil, so we set it to a regexp that
  ;; can never match.
  (setq-local compilation-directory-matcher
              (list regexp-unmatchable))
  (setq-local compilation-process-setup-function
              #'grep-process-setup)
  (setq-local compilation-disable-input t)
  (setq-local compilation-error-screen-columns
              grep-error-screen-columns)
  ;; We normally use a nul byte to separate the file name from the
  ;; contents, but display it as ":".  That's fine, but when yanking
  ;; to other buffers, it's annoying to have the nul byte there.
  (unless kill-transform-function
    (setq-local kill-transform-function #'identity))
  (add-function :filter-return (local 'kill-transform-function)
                (lambda (string)
                  (string-replace "\0" ":" string)))
  (when grep-use-headings
    (add-hook 'compilation-filter-hook #'grep--heading-filter 80 t)
    (setq-local outline-search-function #'outline-search-level
                outline-level (lambda () (get-text-property
                                          (point) 'outline-level))))
  (add-hook 'compilation-filter-hook #'grep-filter nil t))