Function: semantic-edits-change-function-handle-changes

semantic-edits-change-function-handle-changes is a byte-compiled function defined in edit.el.gz.

Signature

(semantic-edits-change-function-handle-changes START END LENGTH)

Documentation

Run whenever a buffer controlled by semantic-mode(var)/semantic-mode(fun) change.

Tracks when and how the buffer is re-parsed. Argument START, END, and LENGTH specify the bounds of the change.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/semantic/edit.el.gz
(defun semantic-edits-change-function-handle-changes  (start end _length)
  "Run whenever a buffer controlled by `semantic-mode' change.
Tracks when and how the buffer is re-parsed.
Argument START, END, and LENGTH specify the bounds of the change."
  ;; We move start/end by one so that we can merge changes that occur
  ;; just before, or just after.  This lets simple typing capture everything
  ;; into one overlay.
  (let ((changes-in-change (semantic-changes-in-region (1- start) (1+ end)))
	)
    (semantic-parse-tree-set-needs-update)
    (if (not changes-in-change)
	(let ((o (make-overlay start end)))
	  (overlay-put o 'semantic-change t)
	  ;; Run the hooks safely.  When hooks blow it, our dirty
	  ;; function will be removed from the list of active change
	  ;; functions.
	  (condition-case nil
	      (run-hook-with-args 'semantic-edits-new-change-functions o)
	    (error nil)))
      (let ((tmp changes-in-change))
	;; Find greatest bounds of all changes
	(while tmp
	  (when (< (overlay-start (car tmp)) start)
	    (setq start (overlay-start (car tmp))))
	  (when (> (overlay-end (car tmp)) end)
	    (setq end (overlay-end (car tmp))))
	  (setq tmp (cdr tmp)))
	;; Move the first found overlay, recycling that overlay.
	(move-overlay (car changes-in-change) start end)
	(condition-case nil
	    (run-hook-with-args 'semantic-edits-move-change-hooks
				(car changes-in-change))
	  (error nil))
	(setq changes-in-change (cdr changes-in-change))
	;; Delete other changes.  They are now all bound here.
	(while changes-in-change
	  (condition-case nil
	      (run-hook-with-args 'semantic-edits-delete-change-functions
				  (car changes-in-change))
	    (error nil))
	  (delete-overlay (car changes-in-change))
	  (setq changes-in-change (cdr changes-in-change))))
      )))