summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-10-01 23:56:42 -0400
committerKyle Meyer <kyle@kyleam.com>2015-10-01 23:56:42 -0400
commita8e279b1484bc71b30e5e3d4d2e10e7b2724c352 (patch)
tree7143059669d50af21178b63e0b4f24abb2302fa6
parentbb7f8bd9b0f0932943d112bb91cc51e1f1a705cc (diff)
downloademacs.d-a8e279b1484bc71b30e5e3d4d2e10e7b2724c352.tar.gz
bibtex-clean-entry-hook: Downcase keys
-rw-r--r--lisp/init-bib.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/init-bib.el b/lisp/init-bib.el
index b3e82da..8068898 100644
--- a/lisp/init-bib.el
+++ b/lisp/init-bib.el
@@ -20,6 +20,7 @@
(add-hook 'bibtex-clean-entry-hook 'km/bibtex-set-coding-system)
(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)
(defvar km/bibtex-unimportant-title-words
'("a" "aboard" "about" "above" "absent" "across" "after" "against"
@@ -139,6 +140,15 @@ to
(and (re-search-forward "http://dx.doi.org/" end t)
(replace-match ""))))))
+(defun km/bibtex-downcase-keys ()
+ "Downcase keys that are all caps."
+ (save-excursion
+ (bibtex-beginning-of-entry)
+ (let (case-fold-search)
+ (while (re-search-forward "^\\s-*\\([A-Z]+\\)\\s-*=" nil t)
+ (replace-match (downcase (match-string 1)) 'fixedcase
+ nil nil 1)))))
+
(defun km/browse-doi (doi)
"Open DOI in browser.
When called interactively, take the DOI from the text under