Function: r2b-put-field
r2b-put-field is a byte-compiled function defined in refbib.el.gz.
Signature
(r2b-put-field FIELD DATA &optional ABBREVS)
Documentation
Print bibtex FIELD = {DATA} if DATA not null; precede with comma and newline.
If ABBREVS list is given, then try to replace the {DATA} with an abbreviation.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/refbib.el.gz
(defun r2b-put-field (field data &optional abbrevs)
"Print bibtex FIELD = {DATA} if DATA not null; precede with comma and newline.
If ABBREVS list is given, then try to replace the {DATA} with an
abbreviation."
(if data
(let (match nodelim index) ;; multi-line
(cond
((and abbrevs (setq match (assoc data abbrevs)))
(if (null (cdr match))
(setq data (car match))
(setq data (car (cdr match))))
(setq nodelim t))
((and (not (equal data ""))
(not (string-match "[^0-9]" data)))
(setq nodelim t))
(t
(setq index 0)
(while (string-match "[\\~^]" data index)
(setq data (concat (substring data 0 (match-beginning 0))
"\\verb+"
(substring data (match-beginning 0) (match-end 0))
"+"
(substring data (match-end 0))))
(setq index (+ (match-end 0) 7)))
(setq index 0)
(while (string-match "[$&%#_{}]" data index)
(setq data (concat (substring data 0 (match-beginning 0))
"\\"
(substring data (match-beginning 0))))
(setq index (+ (match-end 0) 1)))
(setq index 0)
(if r2b-delimit-with-quote
(while (string-match "\"" data index)
(setq data (concat (substring data 0 (match-beginning 0))
"{\"}"
(substring data (match-end 0))))
(setq index (+ (match-end 0) 2))))
))
(princ ", \n ")
(princ field)
(princ " =\t")
(if (not nodelim)
(if r2b-delimit-with-quote
(princ "\"")
(princ "{")))
(string-match ".*" data)
(if (> (match-end 0) 59)
(princ "\n"))
(princ data)
(if (not nodelim)
(if r2b-delimit-with-quote
(princ "\"")
(princ "}")))
)
))