1 ;;; jmax-bibtex.el --- jmax-bibtex utilities
3 ;; Copyright(C) 2014 John Kitchin
5 ;; Author: John Kitchin <jkitchin@andrew.cmu.edu>
6 ;; URL: https://github.com/jkitchin/org-ref
8 ;; Keywords: org-mode, bibtex
9 ;; Package-Requires: ((org-ref) (s) (dash) (doi-utils) (key-chord))
11 ;; This file is not currently part of GNU Emacs.
13 ;; This program is free software; you can redistribute it and/or
14 ;; modify it under the terms of the GNU General Public License as
15 ;; published by the Free Software Foundation; either version 2, or (at
16 ;; your option) any later version.
18 ;; This program is distributed in the hope that it will be useful, but
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 ;; General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with this program ; see the file COPYING. If not, write to
25 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;; Boston, MA 02111-1307, USA.
30 ;; jmax-bibtex-generate-longtitles
31 ;; jmax-bibtex-generate-shorttitles
32 ;; jmax-stringify-journal-name :: replace a journal name with a string in
33 ;; `jmax-bibtex-journal-abbreviations'
34 ;; jmax-set-journal-string :: in a bibtex entry run this to replace the
35 ;; journal with a string
37 ;; jmax-title-case-article :: title case the title in an article
38 ;; jmax-sentence-case-article :: sentence case the title in an article.
40 ;; jmax-replace-nonascii :: replace nonascii characters in a bibtex
41 ;; entry. Replacements are in `jmax-nonascii-latex-replacements'.
43 ;; jmax-title-case-article
44 ;; jmax-sentence-case-article
46 ;; jmax-bibtex-next-entry :: bound to M-n
47 ;; jmax-bibtex-previous-entry :: bound to M-p
49 ;; Functions to act on a bibtex entry or file
50 ;; jmax-bibtex-hydra/body gives a hydra menu to a lot of useful functions.
51 ;; jmax-bibtex-new-entry/body gives a hydra menu to add new bibtex entries.
52 ;; jmax-bibtex-file/body gives a hydra menu of actions for the bibtex file
54 ;; jmax-bibtex :: a deprecated menu of actions
61 (defgroup jmax-bibtex nil
62 "Customization group for jmax-bibtex.")
65 (defcustom jmax-bibtex-hydra-key-chord
67 "key-chord to run `jmax-bibtex-hydra'.
73 (defcustom jmax-bibtex-hydra-key-binding
75 "key-binding to run `jmax-bibtex-hydra'.
80 ;; * Journal abbreviations
81 (defvar jmax-bibtex-journal-abbreviations
83 "List of (string journal-full-name journal-abbreviation). Find abbreviations at http://cassi.cas.org/search.jsp.")
85 (setq jmax-bibtex-journal-abbreviations
86 '(("ACR" "Accounts of Chemical Research" "Acc. Chem. Res.")
87 ("ACAT" "ACS Catalysis" "ACS Catal.")
88 ("AM" "Acta Materialia" "Acta Mater.")
89 ("AMM" "Acta Metallurgica et Materialia" "Acta Metall. Mater.")
90 ("AEM" "Advanced Energy Materials" "Adv. Energy Mater.")
91 ("AAMI" "ACS Applied Materials \\& Interfaces"
92 "ACS Appl. Mater. Interfaces")
93 ("AMiner" "American Mineralogist" "Am. Mineral.")
94 ("AngC" "Angewandte Chemie-International Edition"
95 "Angew. Chem. Int. Edit.")
96 ("APLM" "APL Materials" "APL Mat.")
97 ("ACBE" "Applied Catalysis B: Environmental" "Appl. Catal. B-Environ.")
98 ("APL" "Applied Physics Letters" "Appl. Phys. Lett.")
99 ("ASS" "Applied Surface Science" "Appl. Surf. Sci.")
100 ("CL" "Catalysis Letters" "Catal. Lett.")
101 ("CC" "Catalysis Communications" "Catal. Commun.")
102 ("CST" "Catalysis Science & Technology" "Catal. Sci. Technol.")
103 ("CT" "Catalysis Today" "Catal. Today")
104 ("ChC" "Chemical Communications" "Chem. Commun.")
105 ("CPL" "Chemical Physics Letters" "Chem. Phys. Lett")
106 ("CR" "Chemical Reviews" "Chem. Rev.")
107 ("CSR" "Chemical Society Reviews" "Chem. Soc. Rev.")
108 ("CSR" "Chemical Society Reviews" "Chem. Soc. Rev.")
109 ("CM" "Chemistry of Materials" "Chem. Mater.")
110 ("CSA" "Colloids and Surfaces, A: Physicochemical and Engineering Aspects"
112 ("CF" "Combustion and Flame" "Combust. Flame")
113 ("CPMS" "Computational Materials Science" "Comp. Mater. Sci.")
114 ("CPC" "Computer Physics Communications" "Comput. Phys. Commun.")
115 ("CSE" "Computing in Science \\& Engineering" "Comput. Sci. Eng.")
116 ("CGD" "Crystal Growth \\& Design" "Cryst. Growth Des.")
117 ("CEC" "CrystEngComm" "CrystEngComm")
118 ("EA" "Electrochimica Acta" "Electrochim. Acta")
119 ("ECST" "ECS Transactions" "ECS Trans.")
120 ("EES" "Energy \\& Environmental Science" "Energy Environ. Sci.")
121 ("HPR" "High Pressure Research" "High Pressure Res.")
122 ("IC" "Inorganic Chemistry" "Inorg. Chem.")
123 ("IECR" "Industrial \\& Engineering Chemistry Research"
124 "Ind. Eng. Chem. Res.")
125 ("JJAP" "Japanese Journal of Applied Physics" "Jpn. J. Appl. Phys.")
126 ("JMatR" "Journal of Materials Research" "J. Mater. Res.")
127 ("JALC" "Journal of Alloys and Compounds" "J. Alloy Compd.")
128 ("JAC" "Journal of Applied Crystallography" "J. Appl. Crystallogr.")
129 ("JAE" "Journal of Applied Electrochemistry" "J. Appl. Electrochem.")
130 ("JAP" "Journal of Applied Physics" "J. Appl. Phys.")
131 ("JC" "Journal of Catalysis" "J. Catal.")
132 ("JCP" "Journal of Chemical Physics" "J. Chem. Phys.")
133 ("JCC" "Journal of Computational Chemistry" "J. Comput. Chem.")
134 ("JCG" "Journal of Crystal Growth" "J. Crys. Growth")
135 ("JMC" "Journal of Materials Chemistry" "J. Mater. Chem.")
136 ("JMC" "Journal of Materials Chemistry" "J. Mater. Chem.")
137 ("JMSL" "Journal of Materials Science Letters" "J. Mater. Sci. Lett.")
138 ("JMS" "Journal of Membrane Science" "J. Memb. Sci.")
139 ("JPE" "Journal of Phase Equilibria" "J. Phase Equilib.")
140 ("JPCS" "Journal of Physics and Chemistry of Solids"
141 "J. Phys. Chem. Solids")
142 ("JPCM" "Journal of Physics: Condensed Matter"
143 "J. Phys.: Condens. Matter")
144 ("JPS" "Journal of Power Sources" "J. Power Sources")
145 ("JSSC" "Journal of Solid State Chemistry" "J. Solid State Chem.")
146 ("JACerS" "Journal of the American Ceramic Society" "J. Am. Ceram. Soc.")
147 ("JACS" "Journal of the American Chemical Society" "J. Am. Chem. Soc.")
148 ("JASIST" "Journal of the American Society for Information Science and Technology"
149 "J. Am. Soc. Inf. Sci. Technol.")
150 ("JES" "Journal of The Electrochemical Society" "J. Electrochem. Soc.")
151 ("JEaC" "Journal of Electroanalytical Chemistry" "J. Electroanal. Chem.")
152 ("JMS" "Journal of Membrane Science" "J. Memb. Sci.")
153 ("JRS" "Journal of Raman Spectroscopy" "J. Raman Spectrosc.")
154 ("JVST" "Journal of Vacuum Science \\& Technology A"
155 "J. Vac. Sci. Technol. A")
156 ("ML" "Materials Letters" "Mater. Lett.")
157 ("MSE-BS" "Materials Science and Engineering B" "Mat. Sci. Eng. B-Solid")
158 ("MOLSIM" "Molecular Simulation" "Mol. Sim.")
159 ("Nature" "Nature" "Nature")
160 ("NM" "Nature Materials" "Nat. Mater.")
161 ("NC" "Nature Chemistry" "Nat. Chem.")
162 ("PML" "Philosophical Magazine Letters" "Phil. Mag. Lett.")
163 ("PMA" "Philosophical Magazine A" "Phil. Mag. A")
164 ("PA" "Physica A: Statistical Mechanics and its Applications" "Physica A")
165 ("PB" "Physica B-Condensed Matter" "Physica B")
166 ("PCCP" "Physical Chemistry Chemical Physics" "Phys. Chem. Chem. Phys.")
167 ("PSSB" "physica status solidi (b)" "Phys. Status Solidi B")
168 ("PRA" "Physical Review A" "Phys. Rev. A")
169 ("PRB" "Physical Review B" "Phys. Rev. B")
170 ("PRL" "Physical Review Letters" "Phys. Rev. Lett.")
171 ("PCM" "Physics and Chemistry of Minerals" "Phys. Chem. Miner.")
172 ("PNAS" "Proceedings of the National Academy of Sciences of the United States of America"
173 "Proc. Natl. Acad. Sci. U. S. A.")
174 ("PSurfSci" "Progress in Surface Science" "Prog. Surf. Sci.")
175 ("Science" "Science" "Science")
176 ("SM" "Scripta Materialia" "Scr. Mater.")
177 ("SABC" "Sensors and Actuators B: Chemical" "Sensor. Actuat. B-Chem.")
178 ("SS" "Surface Science" "Surf. Sci.")
179 ("EPJB" "The European Physical Journal B" "Eur. Phys. J. B")
180 ("JPC" "The Journal of Physical Chemistry" "J. Phys. Chem.")
181 ("JPCB" "The Journal of Physical Chemistry B" "J. Phys. Chem. B")
182 ("JPCC" "The Journal of Physical Chemistry C" "J. Phys. Chem. C")
183 ("JPCL" "The Journal of Physical Chemistry Letters"
184 "J. Phys. Chem. Lett.")
185 ("JCP" "The Journal of Chemical Physics" "J. Chem. Phys.")
186 ("MSMSE" "Modelling and Simulation in Materials Science and Engineering"
187 "Modell. Simul. Mater. Sci. Eng.")
188 ("TSF" "Thin Solid Films" "Thin Solid Films")
189 ("TC" "Topics in Catalysis" "Top. Catal.")
190 ("WR" "Water Research" "Water Res.")))
193 (defun jmax-bibtex-generate-longtitles ()
194 "Generate longtitles.bib which are @string definitions.
195 The full journal names are in `jmax-bibtex-journal-abbreviations'."
197 (with-temp-file "longtitles.bib"
198 (dolist (row jmax-bibtex-journal-abbreviations)
199 (insert (format "@string{%s=\"%s\"}\n"
204 (defun jmax-bibtex-generate-shorttitles ()
205 "Generate shorttitles.bib which are @string definitions.
206 The abbreviated journal names in `jmax-bibtex-journal-abbreviations'."
208 (with-temp-file "shorttitles.bib"
209 (dolist (row jmax-bibtex-journal-abbreviations)
210 (insert (format "@string{%s=\"%s\"}\n"
215 (defun jmax-stringify-journal-name (&optional key start end)
216 "Replace journal name in a bibtex entry with a string.
217 The strings are defined in
218 `jmax-bibtex-journal-abbreviations'. The optional arguments KEY,
219 START and END allow you to use this with `bibtex-map-entries'"
221 (bibtex-beginning-of-entry)
225 (cdr (assoc "=type=" (bibtex-parse-entry)))))
226 (let* ((full-names (mapcar
228 (cons (nth 1 row) (nth 0 row)))
229 jmax-bibtex-journal-abbreviations))
230 (abbrev-names (mapcar
232 (cons (nth 2 row) (nth 0 row)))
233 jmax-bibtex-journal-abbreviations))
234 (journal (s-trim (bibtex-autokey-get-field "journal")))
236 (cdr (assoc journal full-names))
237 (cdr (assoc journal abbrev-names)))))
239 (bibtex-set-field "journal" bstring t)
240 (bibtex-fill-entry)))))
242 (defun jmax-helm-set-journal-string ()
243 "Helm interface to set a journal string."
247 (helm :sources `((name . "journal")
248 (candidates . ,(mapcar
250 (cons (format "%s | %s" (nth 1 x) (nth 2 x))
252 jmax-bibtex-journal-abbreviations))
253 (action . (lambda (x) (identity x))))
254 :input (s-trim (bibtex-autokey-get-field "journal")))
257 (bibtex-clean-entry))
260 (defun jmax-set-journal-string (full-journal-name)
261 "Set a bibtex journal name to the string that represents FULL-JOURNAL-NAME.
262 This is defined in `jmax-bibtex-journal-abbreviations'."
269 jmax-bibtex-journal-abbreviations))))
270 ;; construct data alist for the string lookup.
273 (cons (nth 1 x) (nth 0 x)))
274 jmax-bibtex-journal-abbreviations)))
275 (bibtex-set-field "journal" (cdr (assoc full-journal-name alist)) t)
277 (bibtex-clean-entry)))
279 ;; * Non-ascii character replacement
280 ;; see https://github.com/fxcoudert/tools/blob/master/doi2bib for more replacements
281 (defvar jmax-nonascii-latex-replacements
283 "Cons list of non-ascii characters and their LaTeX representations.")
285 (setq jmax-nonascii-latex-replacements
312 ("δ" . "$\\\\delta$")
317 ("θ" . "$\\\\theta$")
319 ("→" . "$\\\\rightarrow$")
320 ("⇌" . "$\\\\leftrightharpoons$")
321 ("×" . "$\\\\times$")
324 ("ı" . "i") ; I think this is a turkish i
325 ;; I think these are non-ascii spaces. there seems to be more than one.
339 (defun jmax-replace-nonascii ()
340 "Hook function to replace non-ascii characters in a bibtex entry."
344 (bibtex-narrow-to-entry)
345 (goto-char (point-min))
346 (dolist (char (mapcar (lambda (x) (car x)) jmax-nonascii-latex-replacements))
347 (while (re-search-forward char nil t)
348 (replace-match (cdr (assoc char jmax-nonascii-latex-replacements))))
349 (goto-char (point-min))))
352 (add-hook 'org-ref-clean-bibtex-entry-hook 'jmax-replace-nonascii)
354 ;; * Title case transformations
355 (defvar jmax-lower-case-words
356 '("a" "an" "on" "and" "for"
358 "List of words to keep lowercase when changing case in a title.")
361 (defun jmax-title-case-article (&optional key start end)
362 "Convert a bibtex entry article title to title-case.
363 The arguments KEY, START and END are optional, and are only there
364 so you can use this function with `bibtex-map-entries' to change
365 all the title entries in articles."
367 (bibtex-beginning-of-entry)
369 (let* ((title (bibtex-autokey-get-field "title"))
370 (words (split-string title))
373 (string= "article" (downcase (cdr (assoc "=type=" (bibtex-parse-entry)))))
377 ;; match words containing {} or \ which are probably
378 ;; LaTeX or protected words
379 (string-match "\\$\\|{\\|}\\|\\\\" word)
380 ;; these words should not be capitalized, unless they
381 ;; are the first word
382 (-contains? jmax-lower-case-words (s-downcase word)))
384 (s-capitalize word)))
387 ;; Check if first word should be capitalized
388 (when (-contains? jmax-lower-case-words (car words))
389 (setf (car words) (s-capitalize (car words))))
391 (setq title (mapconcat 'identity words " "))
393 ;; Capitalize letters after a dash
395 (string-match "[a-zA-Z]-\\([a-z]\\)" title start)
396 (let ((char (substring title (match-beginning 1) (match-end 1))))
397 (setf (substring title (match-beginning 1) (match-end 1))
398 (format "%s" (upcase char)))
399 (setq start (match-end 1))))
401 ;; this is defined in doi-utils
405 (bibtex-fill-entry))))
407 (add-hook 'org-ref-clean-bibtex-entry-hook 'jmax-title-case-article)
410 (defun jmax-sentence-case-article (&optional key start end)
411 "Convert a bibtex entry article title to sentence-case.
412 The arguments KEY, START and END are optional, and are only there
413 so you can use this function with `bibtex-map-entries' to change
414 all the title entries in articles."
416 (bibtex-beginning-of-entry)
418 (let* ((title (bibtex-autokey-get-field "title"))
419 (words (split-string title))
422 (string= "article" (downcase (cdr (assoc "=type=" (bibtex-parse-entry)))))
426 ;; match words containing {} or \ which are probably
427 ;; LaTeX or protected words
428 (string-match "\\$\\|{\\|}\\|\\\\" word)
433 ;; capitalize first word
434 (setf (car words) (s-capitalize (car words)))
437 (setq title (mapconcat 'identity words " "))
439 ;; capitalize a word after a :, eg. a subtitle, and protect it
441 (string-match "[a-z]:\\s-+\\([A-Z]\\)" title start)
442 (let ((char (substring title (match-beginning 1) (match-end 1))))
443 (setf (substring title (match-beginning 1) (match-end 1))
444 ;; (format "{%s}" (upcase char)))
445 (format "%s" (upcase char)))
446 (setq start (match-end 1))))
448 ;; this is defined in doi-utils
452 ;; clean and refill entry so it looks nice
454 (bibtex-fill-entry))))
456 ;; * Navigation in bibtex file
457 (defun jmax-bibtex-next-entry (&optional n)
458 "Jump to the beginning of the next bibtex entry.
459 N is a prefix argument. If it is numeric, jump that many entries
460 forward. Negative numbers do nothing."
462 ;; Note if we start at the beginning of an entry, nothing
463 ;; happens. We need to move forward a char, and call again.
464 (when (= (point) (save-excursion
465 (bibtex-beginning-of-entry)))
467 (jmax-bibtex-next-entry))
469 ;; search forward for an entry
471 (re-search-forward bibtex-entry-head nil t (and (numberp n) n))
472 ;; go to beginning of the entry
473 (bibtex-beginning-of-entry)))
476 (defun jmax-bibtex-previous-entry (&optional n)
477 "Jump to beginning of the previous bibtex entry.
478 N is a prefix argument. If it is numeric, jump that many entries back."
480 (bibtex-beginning-of-entry)
482 (re-search-backward bibtex-entry-head nil t (and (numberp n) n))
483 (bibtex-beginning-of-entry)))
486 (defun jmax-bibtex-mode-keys ()
487 "Modify keymaps used by `bibtex-mode'."
488 (local-set-key (kbd "M-n") 'jmax-bibtex-next-entry)
489 (local-set-key (kbd "M-p") 'jmax-bibtex-previous-entry))
491 ;; add to bibtex-mode-hook
492 (add-hook 'bibtex-mode-hook 'jmax-bibtex-mode-keys)
494 ;; * Functions to act on an entry with a doi
495 (defun jmax-bibtex-entry-doi ()
496 "Get doi from entry at point."
499 (bibtex-beginning-of-entry)
500 (reftex-get-bib-field "doi" (bibtex-parse-entry t))))
503 (defun jmax-bibtex-wos ()
504 "Open bibtex entry in Web Of Science if there is a DOI."
506 (doi-utils-wos (jmax-bibtex-entry-doi)))
509 (defun jmax-bibtex-wos-citing ()
510 "Open citing articles for bibtex entry in Web Of Science if there is a DOI."
512 (doi-utils-wos-citing (jmax-bibtex-entry-doi)))
515 (defun jmax-bibtex-wos-related ()
516 "Open related articles for bibtex entry in Web Of Science if there is a DOI."
518 (doi-utils-wos-related (jmax-bibtex-entry-doi)))
521 (defun jmax-bibtex-wos-citing ()
522 "Open citing articles for bibtex entry in Web Of Science if there is a DOI."
524 (doi-utils-wos-citing (jmax-bibtex-entry-doi)))
527 (defun jmax-bibtex-crossref ()
528 "Open the bibtex entry in Crossref by its doi."
530 (doi-utils-crossref (jmax-bibtex-entry-doi)))
533 (defun jmax-bibtex-google-scholar ()
534 "Open the bibtex entry at point in google-scholar by its doi."
536 (doi-utils-google-scholar (jmax-bibtex-entry-doi)))
539 (defun jmax-bibtex-pubmed ()
540 "Open the bibtex entry at point in Pubmed by its doi."
542 (doi-utils-pubmed (jmax-bibtex-entry-doi)))
545 (defun jmax-bibtex-pdf (doi)
546 "Open the pdf for the bibtex entry at point.
547 Thin wrapper to get `jmax-bibtex' to open pdf, because it calls
548 functions with a DOI argument."
550 (org-ref-open-bibtex-pdf))
554 ;; ** Hydra menu for bibtex entries
555 ;; hydra menu for actions on bibtex entries
556 (defhydra jmax-bibtex-hydra (:color blue)
558 _p_: Open pdf _y_: Copy key _n_: New entry _w_: WOS
559 _b_: Open url _f_: Copy formatted entry _o_: Copy entry _c_: WOS citing
560 _r_: Refile entry _k_: Add keywords _d_: delete entry _a_: WOS related
561 _e_: Email entry _K_: Edit keywords _L_: clean entry _P_: Pubmed
562 _U_: Update entry _N_: Open notes _R_: Crossref _g_: Google Scholar
563 _s_: Sort entry _a_: Remove nonascii _h_: helm-bibtex _q_: quit
564 _u_: Update field _F_: file funcs
568 ("p" org-ref-open-bibtex-pdf)
569 ("P" jmax-bibtex-pubmed)
570 ("w" jmax-bibtex-wos)
571 ("c" jmax-bibtex-wos-citing)
572 ("a" jmax-bibtex-wos-related)
573 ("R" jmax-bibtex-crossref)
574 ("g" jmax-bibtex-google-scholar)
575 ("n" jmax-bibtex-new-entry/body)
576 ("N" org-ref-open-bibtex-notes)
577 ("o" bibtex-copy-entry-as-kill)
578 ("d" bibtex-kill-entry)
579 ("L" org-ref-clean-bibtex-entry)
580 ("y" (kill-new (bibtex-autokey-get-field "=key=")))
581 ("f" bibtex-copy-summary-as-kill)
582 ("k" helm-tag-bibtex-entry)
585 (org-ref-set-bibtex-keywords
586 (read-string "Keywords: "
587 (bibtex-autokey-get-field "keywords"))
589 ("b" org-ref-open-in-browser)
590 ("r" (lambda () (interactive)
591 (bibtex-beginning-of-entry)
593 (find-file (ido-completing-read
595 (f-entries "." (lambda (f) (f-ext? f "bib")))))
596 (goto-char (point-max))
600 ("e" email-bibtex-entry)
601 ("U" (doi-utils-update-bibtex-entry-from-doi (jmax-bibtex-entry-doi)))
602 ("u" doi-utils-update-field)
603 ("F" jmax-bibtex-file/body)
605 ("a" jmax-replace-nonascii)
606 ("s" org-ref-sort-bibtex-entry)
607 ("T" jmax-title-case-article)
608 ("S" jmax-sentence-case-article)
611 ;; create key-chord and key binding for hydra
612 (when jmax-bibtex-hydra-key-chord
613 (key-chord-define-global
614 jmax-bibtex-hydra-key-chord
615 'jmax-bibtex-hydra/body))
618 (when jmax-bibtex-hydra-key-binding
619 (global-set-key jmax-bibtex-hydra-key-binding 'jmax-bibtex-hydra/body))
621 ;; ** Hydra menu for new bibtex entries
622 ;; A hydra for adding new bibtex entries.
623 (defhydra jmax-bibtex-new-entry (:color blue)
625 ("a" bibtex-Article "Article")
626 ("b" bibtex-Book "Book")
627 ("i" bibtex-InBook "In book")
628 ("l" bibtex-Booklet "Booklet")
629 ("P" bibtex-Proceedings "Proceedings")
630 ("p" bibtex-InProceedings "In proceedings")
631 ("m" bibtex-Misc "Misc.")
632 ("M" bibtex-Manual "Manual")
633 ("T" bibtex-PhdThesis "PhD Thesis")
634 ("t" bibtex-MastersThesis "MS Thesis")
635 ("R" bibtex-TechReport "Report")
636 ("u" bibtex-Unpublished "unpublished")
637 ("c" bibtex-InCollection "Article in collection")
641 ;; ** Hydra menu of functions to act on a bibtex file.
642 (defhydra jmax-bibtex-file (:color blue)
643 "Bibtex file functions: "
644 ("v" bibtex-validate "Validate entries")
645 ("s" bibtex-sort-buffer "Sort entries")
646 ("r" bibtex-reformat "Reformat entries")
647 ("c" bibtex-count-entries "Count entries")
648 ("p" org-ref-build-full-bibliography "PDF bibliography"))
651 ;; * DEPRECATED bibtex menu
652 (defvar jmax-bibtex-menu-funcs '()
653 "Functions to run in doi menu.
654 Each entry is a list of (key menu-name function). The function
655 must take one argument, the doi. This is somewhat deprecated, as
656 I prefer the hydra interfaces above.")
658 (setq jmax-bibtex-menu-funcs
659 '(("p" "df" jmax-bibtex-pdf)
660 ("C" "opy" (lambda (doi)
661 (kill-new (org-ref-bib-citation))
663 ("w" "os" doi-utils-wos)
664 ("c" "iting articles" doi-utils-wos-citing)
665 ("r" "elated articles" doi-utils-wos-related)
666 ("s" "Google Scholar" doi-utils-google-scholar)
667 ("P" "Pubmed" doi-utils-pubmed)
668 ("f" "CrossRef" doi-utils-crossref)))
670 (defun jmax-bibtex ()
671 "Menu command to run in a bibtex entry.
672 Functions from `jmax-bibtex-menu-funcs'. They all rely on the
676 ;; construct menu string as a message
681 (concat "[" (elt tup 0) "]"
683 jmax-bibtex-menu-funcs "") ": "))
684 (let* ((input (read-char-exclusive))
686 (char-to-string input) jmax-bibtex-menu-funcs)))
692 (jmax-bibtex-entry-doi)
695 (defalias 'jb 'jmax-bibtex)
698 (provide 'jmax-bibtex)
700 ;;; jmax-bibtex.el ends here