Function: grep-edit--prepare-buffer

grep-edit--prepare-buffer is a byte-compiled function defined in grep.el.gz.

Signature

(grep-edit--prepare-buffer)

Documentation

Mark relevant regions read-only, and add relevant occur text-properties.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/grep.el.gz
(defun grep-edit--prepare-buffer ()
  "Mark relevant regions read-only, and add relevant occur text-properties."
  (save-excursion
    (goto-char (point-min))
    (let ((inhibit-read-only t)
          (dummy (make-marker))
          match)
      (while (setq match (text-property-search-forward 'compilation-annotation))
        (add-text-properties (prop-match-beginning match) (prop-match-end match)
                             '(read-only t)))
      (goto-char (point-min))
      (while (setq match (text-property-search-forward 'compilation-message))
        (add-text-properties (prop-match-beginning match) (prop-match-end match)
                             '(read-only t occur-prefix t))
        (let ((loc (compilation--message->loc (prop-match-value match)))
              m)
          ;; Update the markers if necessary.
          (unless (and (compilation--loc->marker loc)
                       (marker-buffer (compilation--loc->marker loc)))
            (compilation--update-markers loc dummy compilation-error-screen-columns compilation-first-column))
          (setq m (compilation--loc->marker loc))
          (add-text-properties (prop-match-beginning match)
                               (or (next-single-property-change
                                    (prop-match-end match)
                                    'compilation-message)
                                   (1+ (pos-eol)))
                               `(occur-target ((,m . ,m)))))))))