summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-03-29 00:37:40 -0400
committerKyle Meyer <kyle@kyleam.com>2015-03-30 01:43:22 -0400
commita8d93c635de59ecbb734e11d78859bed6c3762bb (patch)
tree120cb883e39d2c27245aa4bf934128d8b71c961b /lisp
parent70ab97c521ea940b2c72480a20b43cd96e2876c5 (diff)
downloademacs.d-a8d93c635de59ecbb734e11d78859bed6c3762bb.tar.gz
Add bibtex-single-space-author-list to clean hook
Diffstat (limited to 'lisp')
-rw-r--r--lisp/init-bib.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/lisp/init-bib.el b/lisp/init-bib.el
index 1a0cd20..bcef8d0 100644
--- a/lisp/init-bib.el
+++ b/lisp/init-bib.el
@@ -14,6 +14,7 @@
bibtex-entry-format)))
(add-hook 'bibtex-clean-entry-hook 'km/bibtex-use-title-case)
+(add-hook 'bibtex-clean-entry-hook 'km/bibtex-single-space-author-list)
(defvar km/bibtex-unimportant-title-words
'("a" "aboard" "about" "above" "absent" "across" "after" "against"
@@ -72,6 +73,20 @@ all other words unless they are protected by brackets."
(downcase-word 1)
(capitalize-word 1))))))))
+(defun km/bibtex-single-space-author-list ()
+ "Convert multiple spaces in author list to single space."
+ (interactive)
+ (save-excursion
+ (bibtex-beginning-of-entry)
+ (let* ((text-bounds (cdr (bibtex-search-forward-field "author" t)))
+ (beg (car text-bounds))
+ (end (cadr text-bounds)))
+ (goto-char beg)
+ (while (re-search-forward "\\(\\s-+\\) and" end t)
+ (replace-match "" nil nil nil 1))
+ (goto-char beg)
+ (fill-paragraph))))
+
(defun km/browse-doi (doi)
"Open DOI in browser.
When called interactively, take the DOI from the text under