From a8d93c635de59ecbb734e11d78859bed6c3762bb Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 29 Mar 2015 00:37:40 -0400 Subject: Add bibtex-single-space-author-list to clean hook --- lisp/init-bib.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lisp/init-bib.el') 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 -- cgit v1.2.3