Function: bibtex-insert-kill
bibtex-insert-kill is a byte-compiled function defined in
bibtex.el.gz.
Signature
(bibtex-insert-kill N &optional COMMA)
Documentation
Reinsert the Nth stretch of killed BibTeX text (field or entry).
Optional arg COMMA is as in bibtex-enclosing-field.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-insert-kill (n &optional comma)
"Reinsert the Nth stretch of killed BibTeX text (field or entry).
Optional arg COMMA is as in `bibtex-enclosing-field'."
(unless bibtex-last-kill-command (user-error "BibTeX kill ring is empty"))
(let ((fun (lambda (kryp kr) ; adapted from `current-kill'
(car (set kryp (nthcdr (mod (- n (length (symbol-value kryp)))
(length kr))
kr))))))
;; We put the mark at the beginning of the inserted field or entry
;; and point at its end - a behavior similar to what `yank' does.
;; The mark is then used by `bibtex-yank-pop', which needs to know
;; what we have inserted.
(if (eq bibtex-last-kill-command 'field)
(progn
;; insert past the current field
(goto-char (bibtex-end-of-field (bibtex-enclosing-field comma)))
(push-mark)
(bibtex-make-field (funcall fun 'bibtex-field-kill-ring-yank-pointer
bibtex-field-kill-ring)
t nil t))
;; insert past the current entry
(bibtex-skip-to-valid-entry)
(push-mark)
(insert (funcall fun 'bibtex-entry-kill-ring-yank-pointer
bibtex-entry-kill-ring))
;; If we copied an entry from a buffer containing only this one entry,
;; it can be missing the second "\n".
(unless (looking-back "\n\n" (- (point) 2)) (insert "\n"))
(unless (functionp bibtex-reference-keys)
;; update `bibtex-reference-keys'
(save-excursion
(goto-char (mark t))
(looking-at bibtex-any-entry-maybe-empty-head)
(let ((key (bibtex-key-in-head)))
(if key (push (cons key t) bibtex-reference-keys))))))))