Function: bibtex-yank-pop
bibtex-yank-pop is an interactive and byte-compiled function defined
in bibtex.el.gz.
Signature
(bibtex-yank-pop N)
Documentation
Replace just-yanked killed BibTeX item with a different item.
This command is allowed only immediately after a bibtex-yank or a
bibtex-yank-pop. In this case, the region contains a reinserted
previously killed BibTeX item. bibtex-yank-pop deletes that item
and inserts in its place a different killed BibTeX item.
With no argument, the previous kill is inserted. With argument N, insert the Nth previous kill. If N is negative, this is a more recent kill.
The sequence of kills wraps around, so that after the oldest one comes the newest one.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-yank-pop (n)
"Replace just-yanked killed BibTeX item with a different item.
This command is allowed only immediately after a `bibtex-yank' or a
`bibtex-yank-pop'. In this case, the region contains a reinserted
previously killed BibTeX item. `bibtex-yank-pop' deletes that item
and inserts in its place a different killed BibTeX item.
With no argument, the previous kill is inserted.
With argument N, insert the Nth previous kill.
If N is negative, this is a more recent kill.
The sequence of kills wraps around, so that after the oldest one
comes the newest one."
(interactive "*p")
(unless (eq last-command 'bibtex-yank)
(user-error "Previous command was not a BibTeX yank"))
(setq this-command 'bibtex-yank)
(let ((inhibit-read-only t) key)
;; point is at end of yanked entry
(unless (functionp bibtex-reference-keys)
;; remove key of yanked entry from `bibtex-reference-keys'
(save-excursion
(goto-char (mark t))
(if (and (looking-at bibtex-any-entry-maybe-empty-head)
(setq key (bibtex-key-in-head)))
(setq bibtex-reference-keys
(delete (cons key t) bibtex-reference-keys)))))
(delete-region (point) (mark t))
(bibtex-insert-kill n t)))