Function: srecode-field-mod-hook
srecode-field-mod-hook is a byte-compiled function defined in
fields.el.gz.
Signature
(srecode-field-mod-hook OL AFTER START END &optional PRE-LEN)
Documentation
Modification hook for the field overlay.
OL is the overlay. AFTER is non-nil if it is called after the change. START and END are the bounds of the change. PRE-LEN is used in the after mode for the length of the changed text.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/srecode/fields.el.gz
(defun srecode-field-mod-hook (ol after _start _end &optional _pre-len)
"Modification hook for the field overlay.
OL is the overlay.
AFTER is non-nil if it is called after the change.
START and END are the bounds of the change.
PRE-LEN is used in the after mode for the length of the changed text."
(when (and after (not undo-in-progress))
(let* ((field (overlay-get ol 'srecode))
(inhibit-modification-hooks t))
;; Sometimes a field is deleted, but we might still get a stray
;; event. Let's just ignore those events.
(when (slot-boundp field 'overlay)
;; First, fixup the two overlays, in case they got confused.
(let ((main (oref field overlay))
(tail (oref field tail)))
(move-overlay main
(overlay-start main)
(1- (overlay-end tail)))
(move-overlay tail
(1- (overlay-end tail))
(overlay-end tail)))
;; Now capture text from the main overlay, and propagate it.
(let* ((new-text (srecode-overlaid-text field))
(region (srecode-active-template-region))
(allfields (when region (oref region fields)))
(name (oref field name)))
(dolist (F allfields)
(when (and (not (eq F field))
(string= name (oref F name)))
(if (> (length new-text) srecode-field-replication-max-size)
(message "Field size too large for replication.")
;; If we find other fields with the same name, then keep
;; then all together. Disable change hooks to make sure
;; we don't get a recursive edit.
(srecode-overlaid-text F new-text)
))))
))))