From 12e3e07c6843664bb3c750bc644fa05cd70816d0 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Fri, 4 Dec 2015 01:28:37 -0500 Subject: bibtex-clean-entry-hook: Downcase AND in author list --- lisp/init-bib.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lisp') diff --git a/lisp/init-bib.el b/lisp/init-bib.el index c438b90..d81edee 100644 --- a/lisp/init-bib.el +++ b/lisp/init-bib.el @@ -21,6 +21,7 @@ (add-hook 'bibtex-clean-entry-hook 'km/bibtex-remove-entry-space) (add-hook 'bibtex-clean-entry-hook 'km/bibtex-downcase-entry) (add-hook 'bibtex-clean-entry-hook 'km/bibtex-downcase-keys) +(add-hook 'bibtex-clean-entry-hook 'km/bibtex-downcase-author-and) (defvar km/bibtex-unimportant-title-words '("a" "aboard" "about" "above" "absent" "across" "after" "against" @@ -147,6 +148,17 @@ to (replace-match (downcase (match-string 1)) 'fixedcase nil nil 1))))) +(defun km/bibtex-downcase-author-and () + (save-excursion + (bibtex-beginning-of-entry) + (let ((bounds (bibtex-search-forward-field "author" t))) + (when bounds + (goto-char (bibtex-start-of-text-in-field bounds)) + (let (case-fold-search) + (while (re-search-forward "\\bAND\\b" + (bibtex-end-of-text-in-field bounds) t) + (replace-match (downcase (match-string 0)) 'fixedcase))))))) + (defun km/browse-doi (doi) "Open DOI in browser. When called interactively, take the DOI from the text under -- cgit v1.2.3