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 ("CPL" "Chemical Physics Letters" "Chem. Phys. Lett")
105 ("CR" "Chemical Reviews" "Chem. Rev.")
106 ("CSR" "Chemical Society Reviews" "Chem. Soc. Rev.")
107 ("CSR" "Chemical Society Reviews" "Chem. Soc. Rev.")
108 ("CM" "Chemistry of Materials" "Chem. Mater.")
109 ("CSA" "Colloids and Surfaces, A: Physicochemical and Engineering Aspects" "Colloids Surf., A")
110 ("CPMS" "Computational Materials Science" "Comp. Mater. Sci.")
111 ("CPC" "Computer Physics Communications" "Comput. Phys. Commun.")
112 ("CSE" "Computing in Science \\& Engineering" "Comput. Sci. Eng.")
113 ("CGD" "Crystal Growth \\& Design" "Cryst. Growth Des.")
114 ("CEC" "CrystEngComm" "CrystEngComm")
115 ("EA" "Electrochimica Acta" "Electrochim. Acta")
116 ("ECST" "ECS Transactions" "ECS Trans.")
117 ("EES" "Energy \\& Environmental Science" "Energy Environ. Sci.")
118 ("HPR" "High Pressure Research" "High Pressure Res.")
119 ("IC" "Inorganic Chemistry" "Inorg. Chem.")
120 ("IECR" "Industrial \\& Engineering Chemistry Research" "Ind. Eng. Chem. Res.")
121 ("JJAP" "Japanese Journal of Applied Physics" "Jpn. J. Appl. Phys.")
122 ("JMatR" "Journal of Materials Research" "J. Mater. Res.")
123 ("JALC" "Journal of Alloys and Compounds" "J. Alloy Compd.")
124 ("JAC" "Journal of Applied Crystallography" "J. Appl. Crystallogr.")
125 ("JAE" "Journal of Applied Electrochemistry" "J. Appl. Electrochem.")
126 ("JAP" "Journal of Applied Physics" "J. Appl. Phys.")
127 ("JC" "Journal of Catalysis" "J. Catal.")
128 ("JCP" "Journal of Chemical Physics" "J. Chem. Phys.")
129 ("JCC" "Journal of Computational Chemistry" "J. Comput. Chem.")
130 ("JCG" "Journal of Crystal Growth" "J. Crys. Growth")
131 ("JMC" "Journal of Materials Chemistry" "J. Mater. Chem.")
132 ("JMC" "Journal of Materials Chemistry" "J. Mater. Chem.")
133 ("JMSL" "Journal of Materials Science Letters" "J. Mater. Sci. Lett.")
134 ("JMS" "Journal of Membrane Science" "J. Memb. Sci.")
135 ("JPE" "Journal of Phase Equilibria" "J. Phase Equilib.")
136 ("JPCS" "Journal of Physics and Chemistry of Solids" "J. Phys. Chem. Solids")
137 ("JPCM" "Journal of Physics: Condensed Matter" "J. Phys.: Condens. Matter")
138 ("JPS" "Journal of Power Sources" "J. Power Sources")
139 ("JSSC" "Journal of Solid State Chemistry" "J. Solid State Chem.")
140 ("JACerS" "Journal of the American Ceramic Society" "J. Am. Ceram. Soc.")
141 ("JACS" "Journal of the American Chemical Society" "J. Am. Chem. Soc.")
142 ("JASIST" "Journal of the American Society for Information Science and Technology" "J. Am. Soc. Inf. Sci. Technol.")
143 ("JES" "Journal of The Electrochemical Society" "J. Electrochem. Soc.")
144 ("JEaC" "Journal of Electroanalytical Chemistry" "J. Electroanal. Chem.")
145 ("JMS" "Journal of Membrane Science" "J. Memb. Sci.")
146 ("JRS" "Journal of Raman Spectroscopy" "J. Raman Spectrosc.")
147 ("JVST" "Journal of Vacuum Science \\& Technology A" "J. Vac. Sci. Technol. A")
148 ("ML" "Materials Letters" "Mater. Lett.")
149 ("MSE-BS" "Materials Science and Engineering B" "Mat. Sci. Eng. B-Solid")
150 ("MOLSIM" "Molecular Simulation" "Mol. Sim.")
151 ("Nature" "Nature" "Nature")
152 ("NM" "Nature Materials" "Nat. Mater.")
153 ("NC" "Nature Chemistry" "Nat. Chem.")
154 ("PML" "Philosophical Magazine Letters" "Phil. Mag. Lett.")
155 ("PMA" "Philosophical Magazine A" "Phil. Mag. A")
156 ("PA" "Physica A: Statistical Mechanics and its Applications" "Physica A")
157 ("PB" "Physica B-Condensed Matter" "Physica B")
158 ("PCCP" "Physical Chemistry Chemical Physics" "Phys. Chem. Chem. Phys.")
159 ("PSSB" "physica status solidi (b)" "Phys. Status Solidi B")
160 ("PRA" "Physical Review A" "Phys. Rev. A")
161 ("PRB" "Physical Review B" "Phys. Rev. B")
162 ("PRL" "Physical Review Letters" "Phys. Rev. Lett.")
163 ("PCM" "Physics and Chemistry of Minerals" "Phys. Chem. Miner.")
164 ("PNAS" "Proceedings of the National Academy of Sciences of the United States of America" "Proc. Natl. Acad. Sci. U. S. A.")
165 ("PSurfSci" "Progress in Surface Science" "Prog. Surf. Sci.")
166 ("Science" "Science" "Science")
167 ("SM" "Scripta Materialia" "Scr. Mater.")
168 ("SABC" "Sensors and Actuators B: Chemical" "Sensor. Actuat. B-Chem.")
169 ("SS" "Surface Science" "Surf. Sci.")
170 ("EPJB" "The European Physical Journal B" "Eur. Phys. J. B")
171 ("JPC" "The Journal of Physical Chemistry" "J. Phys. Chem.")
172 ("JPCB" "The Journal of Physical Chemistry B" "J. Phys. Chem. B")
173 ("JPCC" "The Journal of Physical Chemistry C" "J. Phys. Chem. C")
174 ("JPCL" "The Journal of Physical Chemistry Letters" "J. Phys. Chem. Lett.")
175 ("JCP" "The Journal of Chemical Physics" "J. Chem. Phys.")
176 ("MSMSE" "Modelling and Simulation in Materials Science and Engineering" "Modell. Simul. Mater. Sci. Eng.")
177 ("TSF" "Thin Solid Films" "Thin Solid Films")
178 ("TC" "Topics in Catalysis" "Top. Catal.")
179 ("WR" "Water Research" "Water Res.")))
182 (defun jmax-bibtex-generate-longtitles ()
183 "Generate longtitles.bib which are @string definitions.
184 The full journal names are in `jmax-bibtex-journal-abbreviations'."
186 (with-temp-file "longtitles.bib"
187 (dolist (row jmax-bibtex-journal-abbreviations)
188 (insert (format "@string{%s=\"%s\"}\n"
193 (defun jmax-bibtex-generate-shorttitles ()
194 "Generate shorttitles.bib which are @string definitions.
195 The abbreviated journal names in `jmax-bibtex-journal-abbreviations'."
197 (with-temp-file "shorttitles.bib"
198 (dolist (row jmax-bibtex-journal-abbreviations)
199 (insert (format "@string{%s=\"%s\"}\n"
204 (defun jmax-stringify-journal-name (&optional key start end)
205 "Replace journal name in a bibtex entry with a string.
206 The strings are defined in
207 `jmax-bibtex-journal-abbreviations'. The optional arguments KEY,
208 START and END allow you to use this with `bibtex-map-entries'"
210 (bibtex-beginning-of-entry)
214 (cdr (assoc "=type=" (bibtex-parse-entry)))))
215 (let* ((full-names (mapcar
217 (cons (nth 1 row) (nth 0 row)))
218 jmax-bibtex-journal-abbreviations))
219 (abbrev-names (mapcar
221 (cons (nth 2 row) (nth 0 row)))
222 jmax-bibtex-journal-abbreviations))
223 (journal (s-trim (bibtex-autokey-get-field "journal")))
225 (cdr (assoc journal full-names))
226 (cdr (assoc journal abbrev-names)))))
228 (bibtex-set-field "journal" bstring t)
229 (bibtex-fill-entry)))))
231 (defun jmax-helm-set-journal-string ()
232 "Helm interface to set a journal string."
236 (helm :sources `((name . "journal")
237 (candidates . ,(mapcar
241 jmax-bibtex-journal-abbreviations))
242 (action . (lambda (x) (identity x))))
243 :input (s-trim (bibtex-autokey-get-field "journal")))
246 (bibtex-clean-entry))
249 (defun jmax-set-journal-string (full-journal-name)
250 "Set a bibtex journal name to the string that represents FULL-JOURNAL-NAME.
251 This is defined in `jmax-bibtex-journal-abbreviations'."
258 jmax-bibtex-journal-abbreviations))))
259 ;; construct data alist for the string lookup.
262 (cons (nth 1 x) (nth 0 x)))
263 jmax-bibtex-journal-abbreviations)))
264 (bibtex-set-field "journal" (cdr (assoc full-journal-name alist)) t)
266 (bibtex-clean-entry)))
268 ;; * Non-ascii character replacement
269 ;; see https://github.com/fxcoudert/tools/blob/master/doi2bib for more replacements
270 (defvar jmax-nonascii-latex-replacements
272 "Cons list of non-ascii characters and their LaTeX representations.")
274 (setq jmax-nonascii-latex-replacements
301 ("δ" . "$\\\\delta$")
306 ("θ" . "$\\\\theta$")
308 ("→" . "$\\\\rightarrow$")
309 ("⇌" . "$\\\\leftrightharpoons$")
310 ("×" . "$\\\\times$")
313 ("ı" . "i") ; I think this is a turkish i
314 ;; I think these are non-ascii spaces. there seems to be more than one.
328 (defun jmax-replace-nonascii ()
329 "Hook function to replace non-ascii characters in a bibtex entry."
333 (bibtex-narrow-to-entry)
334 (goto-char (point-min))
335 (dolist (char (mapcar (lambda (x) (car x)) jmax-nonascii-latex-replacements))
336 (while (re-search-forward char nil t)
337 (replace-match (cdr (assoc char jmax-nonascii-latex-replacements))))
338 (goto-char (point-min))))
341 (add-hook 'org-ref-clean-bibtex-entry-hook 'jmax-replace-nonascii)
343 ;; * Title case transformations
344 (defvar jmax-lower-case-words
345 '("a" "an" "on" "and" "for"
347 "List of words to keep lowercase when changing case in a title.")
350 (defun jmax-title-case-article (&optional key start end)
351 "Convert a bibtex entry article title to title-case.
352 The arguments KEY, START and END are optional, and are only there
353 so you can use this function with `bibtex-map-entries' to change
354 all the title entries in articles."
356 (bibtex-beginning-of-entry)
358 (let* ((title (bibtex-autokey-get-field "title"))
359 (words (split-string title))
362 (string= "article" (downcase (cdr (assoc "=type=" (bibtex-parse-entry)))))
366 ;; match words containing {} or \ which are probably
367 ;; LaTeX or protected words
368 (string-match "\\$\\|{\\|}\\|\\\\" word)
369 ;; these words should not be capitalized, unless they
370 ;; are the first word
371 (-contains? jmax-lower-case-words (s-downcase word)))
373 (s-capitalize word)))
376 ;; Check if first word should be capitalized
377 (when (-contains? jmax-lower-case-words (car words))
378 (setf (car words) (s-capitalize (car words))))
380 (setq title (mapconcat 'identity words " "))
382 ;; Capitalize letters after a dash
384 (string-match "[a-zA-Z]-\\([a-z]\\)" title start)
385 (let ((char (substring title (match-beginning 1) (match-end 1))))
386 (setf (substring title (match-beginning 1) (match-end 1))
387 (format "%s" (upcase char)))
388 (setq start (match-end 1))))
390 ;; this is defined in doi-utils
394 (bibtex-fill-entry))))
396 (add-hook 'org-ref-clean-bibtex-entry-hook 'jmax-title-case-article)
399 (defun jmax-sentence-case-article (&optional key start end)
400 "Convert a bibtex entry article title to sentence-case.
401 The arguments KEY, START and END are optional, and are only there
402 so you can use this function with `bibtex-map-entries' to change
403 all the title entries in articles."
405 (bibtex-beginning-of-entry)
407 (let* ((title (bibtex-autokey-get-field "title"))
408 (words (split-string title))
411 (string= "article" (downcase (cdr (assoc "=type=" (bibtex-parse-entry)))))
415 ;; match words containing {} or \ which are probably
416 ;; LaTeX or protected words
417 (string-match "\\$\\|{\\|}\\|\\\\" word)
422 ;; capitalize first word
423 (setf (car words) (s-capitalize (car words)))
426 (setq title (mapconcat 'identity words " "))
428 ;; capitalize a word after a :, eg. a subtitle, and protect it
430 (string-match "[a-z]:\\s-+\\([A-Z]\\)" title start)
431 (let ((char (substring title (match-beginning 1) (match-end 1))))
432 (setf (substring title (match-beginning 1) (match-end 1))
433 ;; (format "{%s}" (upcase char)))
434 (format "%s" (upcase char)))
435 (setq start (match-end 1))))
437 ;; this is defined in doi-utils
441 ;; clean and refill entry so it looks nice
443 (bibtex-fill-entry))))
445 ;; * Navigation in bibtex file
446 (defun jmax-bibtex-next-entry (&optional n)
447 "Jump to the beginning of the next bibtex entry.
448 N is a prefix argument. If it is numeric, jump that many entries
449 forward. Negative numbers do nothing."
451 ;; Note if we start at the beginning of an entry, nothing
452 ;; happens. We need to move forward a char, and call again.
453 (when (= (point) (save-excursion
454 (bibtex-beginning-of-entry)))
456 (jmax-bibtex-next-entry))
458 ;; search forward for an entry
460 (re-search-forward bibtex-entry-head nil t (and (numberp n) n))
461 ;; go to beginning of the entry
462 (bibtex-beginning-of-entry)))
465 (defun jmax-bibtex-previous-entry (&optional n)
466 "Jump to beginning of the previous bibtex entry.
467 N is a prefix argument. If it is numeric, jump that many entries back."
469 (bibtex-beginning-of-entry)
471 (re-search-backward bibtex-entry-head nil t (and (numberp n) n))
472 (bibtex-beginning-of-entry)))
475 (defun jmax-bibtex-mode-keys ()
476 "Modify keymaps used by `bibtex-mode'."
477 (local-set-key (kbd "M-n") 'jmax-bibtex-next-entry)
478 (local-set-key (kbd "M-p") 'jmax-bibtex-previous-entry))
480 ;; add to bibtex-mode-hook
481 (add-hook 'bibtex-mode-hook 'jmax-bibtex-mode-keys)
483 ;; * Functions to act on an entry with a doi
484 (defun jmax-bibtex-entry-doi ()
485 "Get doi from entry at point."
488 (bibtex-beginning-of-entry)
489 (reftex-get-bib-field "doi" (bibtex-parse-entry t))))
492 (defun jmax-bibtex-wos ()
493 "Open bibtex entry in Web Of Science if there is a DOI."
495 (doi-utils-wos (jmax-bibtex-entry-doi)))
498 (defun jmax-bibtex-wos-citing ()
499 "Open citing articles for bibtex entry in Web Of Science if there is a DOI."
501 (doi-utils-wos-citing (jmax-bibtex-entry-doi)))
504 (defun jmax-bibtex-wos-related ()
505 "Open related articles for bibtex entry in Web Of Science if there is a DOI."
507 (doi-utils-wos-related (jmax-bibtex-entry-doi)))
510 (defun jmax-bibtex-wos-citing ()
511 "Open citing articles for bibtex entry in Web Of Science if there is a DOI."
513 (doi-utils-wos-citing (jmax-bibtex-entry-doi)))
516 (defun jmax-bibtex-crossref ()
517 "Open the bibtex entry in Crossref by its doi."
519 (doi-utils-crossref (jmax-bibtex-entry-doi)))
522 (defun jmax-bibtex-google-scholar ()
523 "Open the bibtex entry at point in google-scholar by its doi."
525 (doi-utils-google-scholar (jmax-bibtex-entry-doi)))
528 (defun jmax-bibtex-pubmed ()
529 "Open the bibtex entry at point in Pubmed by its doi."
531 (doi-utils-pubmed (jmax-bibtex-entry-doi)))
534 (defun jmax-bibtex-pdf (doi)
535 "Open the pdf for the bibtex entry at point.
536 Thin wrapper to get `jmax-bibtex' to open pdf, because it calls
537 functions with a DOI argument."
539 (org-ref-open-bibtex-pdf))
543 ;; ** Hydra menu for bibtex entries
544 ;; hydra menu for actions on bibtex entries
545 (defhydra jmax-bibtex-hydra (:color blue)
547 _p_: Open pdf _y_: Copy key _n_: New entry _w_: WOS
548 _b_: Open url _f_: Copy formatted entry _o_: Copy entry _c_: WOS citing
549 _r_: Refile entry _k_: Add keywords _d_: delete entry _a_: WOS related
550 _e_: Email entry _K_: Edit keywords _L_: clean entry _P_: Pubmed
551 _U_: Update entry _N_: Open notes _R_: Crossref _g_: Google Scholar
552 _s_: Sort entry _a_: Remove nonascii _h_: helm-bibtex _q_: quit
553 _u_: Update field _F_: file funcs
557 ("p" org-ref-open-bibtex-pdf)
558 ("P" jmax-bibtex-pubmed)
559 ("w" jmax-bibtex-wos)
560 ("c" jmax-bibtex-wos-citing)
561 ("a" jmax-bibtex-wos-related)
562 ("R" jmax-bibtex-crossref)
563 ("g" jmax-bibtex-google-scholar)
564 ("n" jmax-bibtex-new-entry/body)
565 ("N" org-ref-open-bibtex-notes)
566 ("o" bibtex-copy-entry-as-kill)
567 ("d" bibtex-kill-entry)
568 ("L" org-ref-clean-bibtex-entry)
569 ("y" (kill-new (bibtex-autokey-get-field "=key=")))
570 ("f" bibtex-copy-summary-as-kill)
571 ("k" helm-tag-bibtex-entry)
574 (org-ref-set-bibtex-keywords
575 (read-string "Keywords: "
576 (bibtex-autokey-get-field "keywords"))
578 ("b" org-ref-open-in-browser)
579 ("r" (lambda () (interactive)
580 (bibtex-beginning-of-entry)
582 (find-file (ido-completing-read
584 (f-entries "." (lambda (f) (f-ext? f "bib")))))
585 (goto-char (point-max))
589 ("e" email-bibtex-entry)
590 ("U" (doi-utils-update-bibtex-entry-from-doi (jmax-bibtex-entry-doi)))
591 ("u" doi-utils-update-field)
592 ("F" jmax-bibtex-file/body)
594 ("a" jmax-replace-nonascii)
595 ("s" org-ref-sort-bibtex-entry)
596 ("T" jmax-title-case-article)
597 ("S" jmax-sentence-case-article)
600 ;; create key-chord and key binding for hydra
601 (when jmax-bibtex-hydra-key-chord
602 (key-chord-define-global
603 jmax-bibtex-hydra-key-chord
604 'jmax-bibtex-hydra/body))
607 (when jmax-bibtex-hydra-key-binding
608 (global-set-key jmax-bibtex-hydra-key-binding 'jmax-bibtex-hydra/body))
610 ;; ** Hydra menu for new bibtex entries
611 ;; A hydra for adding new bibtex entries.
612 (defhydra jmax-bibtex-new-entry (:color blue)
614 ("a" bibtex-Article "Article")
615 ("b" bibtex-Book "Book")
616 ("i" bibtex-InBook "In book")
617 ("l" bibtex-Booklet "Booklet")
618 ("P" bibtex-Proceedings "Proceedings")
619 ("p" bibtex-InProceedings "In proceedings")
620 ("m" bibtex-Misc "Misc.")
621 ("M" bibtex-Manual "Manual")
622 ("T" bibtex-PhdThesis "PhD Thesis")
623 ("t" bibtex-MastersThesis "MS Thesis")
624 ("R" bibtex-TechReport "Report")
625 ("u" bibtex-Unpublished "unpublished")
626 ("c" bibtex-InCollection "Article in collection")
630 ;; ** Hydra menu of functions to act on a bibtex file.
631 (defhydra jmax-bibtex-file (:color blue)
632 "Bibtex file functions: "
633 ("v" bibtex-validate "Validate entries")
634 ("s" bibtex-sort-buffer "Sort entries")
635 ("r" bibtex-reformat "Reformat entries")
636 ("c" bibtex-count-entries "Count entries")
637 ("p" org-ref-build-full-bibliography "PDF bibliography"))
640 ;; * DEPRECATED bibtex menu
641 (defvar jmax-bibtex-menu-funcs '()
642 "Functions to run in doi menu.
643 Each entry is a list of (key menu-name function). The function
644 must take one argument, the doi. This is somewhat deprecated, as
645 I prefer the hydra interfaces above.")
647 (setq jmax-bibtex-menu-funcs
648 '(("p" "df" jmax-bibtex-pdf)
649 ("C" "opy" (lambda (doi)
650 (kill-new (org-ref-bib-citation))
652 ("w" "os" doi-utils-wos)
653 ("c" "iting articles" doi-utils-wos-citing)
654 ("r" "elated articles" doi-utils-wos-related)
655 ("s" "Google Scholar" doi-utils-google-scholar)
656 ("P" "Pubmed" doi-utils-pubmed)
657 ("f" "CrossRef" doi-utils-crossref)))
659 (defun jmax-bibtex ()
660 "Menu command to run in a bibtex entry.
661 Functions from `jmax-bibtex-menu-funcs'. They all rely on the
665 ;; construct menu string as a message
670 (concat "[" (elt tup 0) "]"
672 jmax-bibtex-menu-funcs "") ": "))
673 (let* ((input (read-char-exclusive))
675 (char-to-string input) jmax-bibtex-menu-funcs)))
681 (jmax-bibtex-entry-doi)
684 (defalias 'jb 'jmax-bibtex)
687 (provide 'jmax-bibtex)
689 ;;; jmax-bibtex.el ends here