Function: forms--iif-hook

forms--iif-hook is a byte-compiled function defined in forms.el.gz.

Signature

(forms--iif-hook BEGIN END)

Documentation

insert-in-front-hooks function for read-only segments.

Source Code

;; Defined in /usr/src/emacs/lisp/forms.el.gz
(defun forms--iif-hook (_begin _end)
  "`insert-in-front-hooks' function for read-only segments."

  ;; Note start location.  By making it a marker that points one
  ;; character beyond the actual location, it is guaranteed to move
  ;; correctly if text is inserted.
  (or forms--iif-start
      (setq forms--iif-start (copy-marker (1+ (point)))))

  ;; Check if there is special treatment required.
  (if (or (<= forms--iif-start 2)
	  (get-text-property (- forms--iif-start 2)
			     'read-only))
      (progn
	;; Fetch current properties.
	(setq forms--iif-properties
	      (text-properties-at (1- forms--iif-start)))

	;; Replace them.
	(let ((inhibit-read-only t))
	  (set-text-properties
	   (1- forms--iif-start) forms--iif-start
	   (list 'face forms--rw-face 'front-sticky '(face))))

	;; Enable `post-command-hook' to restore the properties.
	(add-hook 'post-command-hook #'forms--iif-post-command-hook))

    ;; No action needed.  Clear marker.
    (setq forms--iif-start nil)))