summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/init-bib.el14
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