Function: xref-edit--prepare-buffer

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

Signature

(xref-edit--prepare-buffer)

Documentation

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

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/xref.el.gz
(defun xref-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)
          match)
      (while (setq match (text-property-search-forward 'xref-group))
        (add-text-properties (prop-match-beginning match) (prop-match-end match)
                             '( read-only t
                                front-sticky t)))
      (goto-char (point-min))
      (while (setq match (text-property-search-forward 'xref-item))
        (let ((line-number-end (save-excursion
                                 (forward-line 0)
                                 (and (looking-at " *[0-9]+:")
                                      (match-end 0)))))
          (when line-number-end
            (add-text-properties (prop-match-beginning match) line-number-end
                                 '( read-only t
                                    occur-prefix t
                                    ;; Allow insertion of text right
                                    ;; after prefix, but not before.
                                    front-sticky t
                                    rear-nonsticky t))))))))