diff options
author | Kyle Meyer <kyle@kyleam.com> | 2015-03-29 00:37:49 -0400 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2015-03-30 01:43:22 -0400 |
commit | a142fe4f0084b4bda473993cc91cb7a8388ba428 (patch) | |
tree | 8dde961052f4b87aaa91022d9de0060e1cabb1ce | |
parent | a8d93c635de59ecbb734e11d78859bed6c3762bb (diff) | |
download | emacs.d-a142fe4f0084b4bda473993cc91cb7a8388ba428.tar.gz |
Add bibtex-pages-use-double-hyphen to clean hook
-rw-r--r-- | lisp/init-bib.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/init-bib.el b/lisp/init-bib.el index bcef8d0..d0ad40d 100644 --- a/lisp/init-bib.el +++ b/lisp/init-bib.el @@ -15,6 +15,7 @@ (add-hook 'bibtex-clean-entry-hook 'km/bibtex-use-title-case) (add-hook 'bibtex-clean-entry-hook 'km/bibtex-single-space-author-list) +(add-hook 'bibtex-clean-entry-hook 'km/bibtex-pages-use-double-hyphen) (defvar km/bibtex-unimportant-title-words '("a" "aboard" "about" "above" "absent" "across" "after" "against" @@ -87,6 +88,19 @@ all other words unless they are protected by brackets." (goto-char beg) (fill-paragraph)))) +(defun km/bibtex-pages-use-double-hyphen () + "Use double hyphen for page range." + (interactive) + (save-excursion + (bibtex-beginning-of-entry) + (let* ((text-bounds (cdr (bibtex-search-forward-field "pages" t))) + (beg (car text-bounds)) + (end (cadr text-bounds))) + (when text-bounds + (goto-char beg) + (and (re-search-forward "[^A-z0-9]*-[^A-z0-9]*" end t) + (replace-match "--")))))) + (defun km/browse-doi (doi) "Open DOI in browser. When called interactively, take the DOI from the text under |