Function: bibtex-autokey-get-title
bibtex-autokey-get-title is a byte-compiled function defined in
bibtex.el.gz.
Signature
(bibtex-autokey-get-title)
Documentation
Get title field contents up to a terminator.
Return the result as a string.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-autokey-get-title ()
"Get title field contents up to a terminator.
Return the result as a string."
(let ((case-fold-search t)
(titlestring
(bibtex-autokey-get-field "title"
bibtex-autokey-titleword-change-strings)))
;; ignore everything past a terminator
(if (string-match bibtex-autokey-title-terminators titlestring)
(setq titlestring (substring titlestring 0 (match-beginning 0))))
;; gather words from titlestring into a list. Ignore
;; specific words and use only a specific amount of words.
(let ((counter 0)
(ignore-re (concat "\\`\\(?:"
(mapconcat #'identity
bibtex-autokey-titleword-ignore "\\|")
"\\)\\'"))
titlewords titlewords-extra word)
(while (and (or (not (numberp bibtex-autokey-titlewords))
(< counter (+ bibtex-autokey-titlewords
bibtex-autokey-titlewords-stretch)))
(string-match "\\b\\w+" titlestring))
(setq word (match-string 0 titlestring)
titlestring (substring titlestring (match-end 0)))
;; Ignore words matched by one of the elements of
;; `bibtex-autokey-titleword-ignore'. Case is significant.
(unless (let (case-fold-search)
(string-match ignore-re word))
(setq counter (1+ counter))
(if (or (not (numberp bibtex-autokey-titlewords))
(<= counter bibtex-autokey-titlewords))
(push word titlewords)
(push word titlewords-extra))))
;; Obey `bibtex-autokey-titlewords-stretch':
;; If by now we have processed all words in titlestring, we include
;; titlewords-extra in titlewords. Otherwise, we ignore titlewords-extra.
(unless (string-match "\\b\\w+" titlestring)
(setq titlewords (append titlewords-extra titlewords)))
(mapconcat #'bibtex-autokey-demangle-title (nreverse titlewords)
bibtex-autokey-titleword-separator))))