Function: bib-return-key
bib-return-key is an interactive and byte-compiled function defined in
bib-mode.el.gz.
Signature
(bib-return-key)
Documentation
Magic when user hits return, used by bib-mode.
Probably introduced at or before Emacs version 29.1.
Key Bindings
Aliases
return-key-bib (obsolete since 29.1)
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/bib-mode.el.gz
(defun bib-return-key ()
"Magic when user hits return, used by `bib-mode'."
(interactive)
(if (eolp)
(let (empty new-key beg-current end-current)
(beginning-of-line)
(setq empty (looking-at "%. $"))
(if (not empty)
(progn
(end-of-line)
(newline)
(forward-line -1)
))
(end-of-line)
(setq end-current (point))
(beginning-of-line)
(setq beg-current (point))
(setq new-key (bib-find-key bib-assoc))
(if (and (not empty) bib-auto-capitalize
(looking-at bib-capitalized-fields))
(save-excursion
(bib-capitalize-title-region (+ (point) 3) end-current)))
(goto-char beg-current)
(if empty
(kill-line nil)
(forward-line 1)
)
(insert new-key))
(newline)))