Function: semantic-edits-splice-insert
semantic-edits-splice-insert is a byte-compiled function defined in
edit.el.gz.
Signature
(semantic-edits-splice-insert NEWTAGS PARENT CACHELIST)
Documentation
Insert NEWTAGS into PARENT using CACHELIST.
PARENT could be nil, in which case CACHELIST is the buffer cache which must be updated. CACHELIST must be searched to find where NEWTAGS are to be inserted. The positions of NEWTAGS must be synchronized with those in CACHELIST for this to work. Some routines pre-position CACHELIST at a convenient location, so use that.
Source Code
;; Defined in /usr/src/emacs/lisp/cedet/semantic/edit.el.gz
(defun semantic-edits-splice-insert (newtags parent cachelist)
"Insert NEWTAGS into PARENT using CACHELIST.
PARENT could be nil, in which case CACHELIST is the buffer cache
which must be updated.
CACHELIST must be searched to find where NEWTAGS are to be inserted.
The positions of NEWTAGS must be synchronized with those in
CACHELIST for this to work. Some routines pre-position CACHELIST at a
convenient location, so use that."
(let* ((start (semantic-tag-start (car newtags)))
(newtagendcell (nthcdr (1- (length newtags)) newtags))
(end (semantic-tag-end (car newtagendcell)))
)
(if (> (semantic-tag-start (car cachelist)) start)
;; We are at the beginning.
(let* ((pc (if parent
(semantic-tag-components parent)
semantic--buffer-cache))
(nc (cons (car pc) (cdr pc))) ; new cons cell.
)
;; Splice the new cache cons cell onto the end of our list.
(setcdr newtagendcell nc)
;; Set our list into parent.
(setcar pc (car newtags))
(setcdr pc (cdr newtags)))
;; We are at the end, or in the middle. Find our match first.
(while (and (cdr cachelist)
(> end (semantic-tag-start (car (cdr cachelist)))))
(setq cachelist (cdr cachelist)))
;; Now splice into the list!
(setcdr newtagendcell (cdr cachelist))
(setcdr cachelist newtags))))