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"
111 ("CPMS" "Computational Materials Science" "Comp. Mater. Sci.")
112 ("CPC" "Computer Physics Communications" "Comput. Phys. Commun.")
113 ("CSE" "Computing in Science \\& Engineering" "Comput. Sci. Eng.")
114 ("CGD" "Crystal Growth \\& Design" "Cryst. Growth Des.")
115 ("CEC" "CrystEngComm" "CrystEngComm")
116 ("EA" "Electrochimica Acta" "Electrochim. Acta")
117 ("ECST" "ECS Transactions" "ECS Trans.")
118 ("EES" "Energy \\& Environmental Science" "Energy Environ. Sci.")
119 ("HPR" "High Pressure Research" "High Pressure Res.")
120 ("IC" "Inorganic Chemistry" "Inorg. Chem.")
121 ("IECR" "Industrial \\& Engineering Chemistry Research"
122 "Ind. Eng. Chem. Res.")
123 ("JJAP" "Japanese Journal of Applied Physics" "Jpn. J. Appl. Phys.")
124 ("JMatR" "Journal of Materials Research" "J. Mater. Res.")
125 ("JALC" "Journal of Alloys and Compounds" "J. Alloy Compd.")
126 ("JAC" "Journal of Applied Crystallography" "J. Appl. Crystallogr.")
127 ("JAE" "Journal of Applied Electrochemistry" "J. Appl. Electrochem.")
128 ("JAP" "Journal of Applied Physics" "J. Appl. Phys.")
129 ("JC" "Journal of Catalysis" "J. Catal.")
130 ("JCP" "Journal of Chemical Physics" "J. Chem. Phys.")
131 ("JCC" "Journal of Computational Chemistry" "J. Comput. Chem.")
132 ("JCG" "Journal of Crystal Growth" "J. Crys. Growth")
133 ("JMC" "Journal of Materials Chemistry" "J. Mater. Chem.")
134 ("JMC" "Journal of Materials Chemistry" "J. Mater. Chem.")
135 ("JMSL" "Journal of Materials Science Letters" "J. Mater. Sci. Lett.")
136 ("JMS" "Journal of Membrane Science" "J. Memb. Sci.")
137 ("JPE" "Journal of Phase Equilibria" "J. Phase Equilib.")
138 ("JPCS" "Journal of Physics and Chemistry of Solids"
139 "J. Phys. Chem. Solids")
140 ("JPCM" "Journal of Physics: Condensed Matter"
141 "J. Phys.: Condens. Matter")
142 ("JPS" "Journal of Power Sources" "J. Power Sources")
143 ("JSSC" "Journal of Solid State Chemistry" "J. Solid State Chem.")
144 ("JACerS" "Journal of the American Ceramic Society" "J. Am. Ceram. Soc.")
145 ("JACS" "Journal of the American Chemical Society" "J. Am. Chem. Soc.")
146 ("JASIST" "Journal of the American Society for Information Science and Technology"
147 "J. Am. Soc. Inf. Sci. Technol.")
148 ("JES" "Journal of The Electrochemical Society" "J. Electrochem. Soc.")
149 ("JEaC" "Journal of Electroanalytical Chemistry" "J. Electroanal. Chem.")
150 ("JMS" "Journal of Membrane Science" "J. Memb. Sci.")
151 ("JRS" "Journal of Raman Spectroscopy" "J. Raman Spectrosc.")
152 ("JVST" "Journal of Vacuum Science \\& Technology A"
153 "J. Vac. Sci. Technol. A")
154 ("ML" "Materials Letters" "Mater. Lett.")
155 ("MSE-BS" "Materials Science and Engineering B" "Mat. Sci. Eng. B-Solid")
156 ("MOLSIM" "Molecular Simulation" "Mol. Sim.")
157 ("Nature" "Nature" "Nature")
158 ("NM" "Nature Materials" "Nat. Mater.")
159 ("NC" "Nature Chemistry" "Nat. Chem.")
160 ("PML" "Philosophical Magazine Letters" "Phil. Mag. Lett.")
161 ("PMA" "Philosophical Magazine A" "Phil. Mag. A")
162 ("PA" "Physica A: Statistical Mechanics and its Applications" "Physica A")
163 ("PB" "Physica B-Condensed Matter" "Physica B")
164 ("PCCP" "Physical Chemistry Chemical Physics" "Phys. Chem. Chem. Phys.")
165 ("PSSB" "physica status solidi (b)" "Phys. Status Solidi B")
166 ("PRA" "Physical Review A" "Phys. Rev. A")
167 ("PRB" "Physical Review B" "Phys. Rev. B")
168 ("PRL" "Physical Review Letters" "Phys. Rev. Lett.")
169 ("PCM" "Physics and Chemistry of Minerals" "Phys. Chem. Miner.")
170 ("PNAS" "Proceedings of the National Academy of Sciences of the United States of America"
171 "Proc. Natl. Acad. Sci. U. S. A.")
172 ("PSurfSci" "Progress in Surface Science" "Prog. Surf. Sci.")
173 ("Science" "Science" "Science")
174 ("SM" "Scripta Materialia" "Scr. Mater.")
175 ("SABC" "Sensors and Actuators B: Chemical" "Sensor. Actuat. B-Chem.")
176 ("SS" "Surface Science" "Surf. Sci.")
177 ("EPJB" "The European Physical Journal B" "Eur. Phys. J. B")
178 ("JPC" "The Journal of Physical Chemistry" "J. Phys. Chem.")
179 ("JPCB" "The Journal of Physical Chemistry B" "J. Phys. Chem. B")
180 ("JPCC" "The Journal of Physical Chemistry C" "J. Phys. Chem. C")
181 ("JPCL" "The Journal of Physical Chemistry Letters"
182 "J. Phys. Chem. Lett.")
183 ("JCP" "The Journal of Chemical Physics" "J. Chem. Phys.")
184 ("MSMSE" "Modelling and Simulation in Materials Science and Engineering"
185 "Modell. Simul. Mater. Sci. Eng.")
186 ("TSF" "Thin Solid Films" "Thin Solid Films")
187 ("TC" "Topics in Catalysis" "Top. Catal.")
188 ("WR" "Water Research" "Water Res.")))
191 (defun jmax-bibtex-generate-longtitles ()
192 "Generate longtitles.bib which are @string definitions.
193 The full journal names are in `jmax-bibtex-journal-abbreviations'."
195 (with-temp-file "longtitles.bib"
196 (dolist (row jmax-bibtex-journal-abbreviations)
197 (insert (format "@string{%s=\"%s\"}\n"
202 (defun jmax-bibtex-generate-shorttitles ()
203 "Generate shorttitles.bib which are @string definitions.
204 The abbreviated journal names in `jmax-bibtex-journal-abbreviations'."
206 (with-temp-file "shorttitles.bib"
207 (dolist (row jmax-bibtex-journal-abbreviations)
208 (insert (format "@string{%s=\"%s\"}\n"
213 (defun jmax-stringify-journal-name (&optional key start end)
214 "Replace journal name in a bibtex entry with a string.
215 The strings are defined in
216 `jmax-bibtex-journal-abbreviations'. The optional arguments KEY,
217 START and END allow you to use this with `bibtex-map-entries'"
219 (bibtex-beginning-of-entry)
223 (cdr (assoc "=type=" (bibtex-parse-entry)))))
224 (let* ((full-names (mapcar
226 (cons (nth 1 row) (nth 0 row)))
227 jmax-bibtex-journal-abbreviations))
228 (abbrev-names (mapcar
230 (cons (nth 2 row) (nth 0 row)))
231 jmax-bibtex-journal-abbreviations))
232 (journal (s-trim (bibtex-autokey-get-field "journal")))
234 (cdr (assoc journal full-names))
235 (cdr (assoc journal abbrev-names)))))
237 (bibtex-set-field "journal" bstring t)
238 (bibtex-fill-entry)))))
240 (defun jmax-helm-set-journal-string ()
241 "Helm interface to set a journal string."
245 (helm :sources `((name . "journal")
246 (candidates . ,(mapcar
250 jmax-bibtex-journal-abbreviations))
251 (action . (lambda (x) (identity x))))
252 :input (s-trim (bibtex-autokey-get-field "journal")))
255 (bibtex-clean-entry))
258 (defun jmax-set-journal-string (full-journal-name)
259 "Set a bibtex journal name to the string that represents FULL-JOURNAL-NAME.
260 This is defined in `jmax-bibtex-journal-abbreviations'."
267 jmax-bibtex-journal-abbreviations))))
268 ;; construct data alist for the string lookup.
271 (cons (nth 1 x) (nth 0 x)))
272 jmax-bibtex-journal-abbreviations)))
273 (bibtex-set-field "journal" (cdr (assoc full-journal-name alist)) t)
275 (bibtex-clean-entry)))
277 ;; * Non-ascii character replacement
278 ;; see https://github.com/fxcoudert/tools/blob/master/doi2bib for more replacements
279 (defvar jmax-nonascii-latex-replacements
281 "Cons list of non-ascii characters and their LaTeX representations.")
283 (setq jmax-nonascii-latex-replacements
310 ("δ" . "$\\\\delta$")
315 ("θ" . "$\\\\theta$")
317 ("→" . "$\\\\rightarrow$")
318 ("⇌" . "$\\\\leftrightharpoons$")
319 ("×" . "$\\\\times$")
322 ("ı" . "i") ; I think this is a turkish i
323 ;; I think these are non-ascii spaces. there seems to be more than one.
337 (defun jmax-replace-nonascii ()
338 "Hook function to replace non-ascii characters in a bibtex entry."
342 (bibtex-narrow-to-entry)
343 (goto-char (point-min))
344 (dolist (char (mapcar (lambda (x) (car x)) jmax-nonascii-latex-replacements))
345 (while (re-search-forward char nil t)
346 (replace-match (cdr (assoc char jmax-nonascii-latex-replacements))))
347 (goto-char (point-min))))
350 (add-hook 'org-ref-clean-bibtex-entry-hook 'jmax-replace-nonascii)
352 ;; * Title case transformations
353 (defvar jmax-lower-case-words
354 '("a" "an" "on" "and" "for"
356 "List of words to keep lowercase when changing case in a title.")
359 (defun jmax-title-case-article (&optional key start end)
360 "Convert a bibtex entry article title to title-case.
361 The arguments KEY, START and END are optional, and are only there
362 so you can use this function with `bibtex-map-entries' to change
363 all the title entries in articles."
365 (bibtex-beginning-of-entry)
367 (let* ((title (bibtex-autokey-get-field "title"))
368 (words (split-string title))
371 (string= "article" (downcase (cdr (assoc "=type=" (bibtex-parse-entry)))))
375 ;; match words containing {} or \ which are probably
376 ;; LaTeX or protected words
377 (string-match "\\$\\|{\\|}\\|\\\\" word)
378 ;; these words should not be capitalized, unless they
379 ;; are the first word
380 (-contains? jmax-lower-case-words (s-downcase word)))
382 (s-capitalize word)))
385 ;; Check if first word should be capitalized
386 (when (-contains? jmax-lower-case-words (car words))
387 (setf (car words) (s-capitalize (car words))))
389 (setq title (mapconcat 'identity words " "))
391 ;; Capitalize letters after a dash
393 (string-match "[a-zA-Z]-\\([a-z]\\)" title start)
394 (let ((char (substring title (match-beginning 1) (match-end 1))))
395 (setf (substring title (match-beginning 1) (match-end 1))
396 (format "%s" (upcase char)))
397 (setq start (match-end 1))))
399 ;; this is defined in doi-utils
403 (bibtex-fill-entry))))
405 (add-hook 'org-ref-clean-bibtex-entry-hook 'jmax-title-case-article)
408 (defun jmax-sentence-case-article (&optional key start end)
409 "Convert a bibtex entry article title to sentence-case.
410 The arguments KEY, START and END are optional, and are only there
411 so you can use this function with `bibtex-map-entries' to change
412 all the title entries in articles."
414 (bibtex-beginning-of-entry)
416 (let* ((title (bibtex-autokey-get-field "title"))
417 (words (split-string title))
420 (string= "article" (downcase (cdr (assoc "=type=" (bibtex-parse-entry)))))
424 ;; match words containing {} or \ which are probably
425 ;; LaTeX or protected words
426 (string-match "\\$\\|{\\|}\\|\\\\" word)
431 ;; capitalize first word
432 (setf (car words) (s-capitalize (car words)))
435 (setq title (mapconcat 'identity words " "))
437 ;; capitalize a word after a :, eg. a subtitle, and protect it
439 (string-match "[a-z]:\\s-+\\([A-Z]\\)" title start)
440 (let ((char (substring title (match-beginning 1) (match-end 1))))
441 (setf (substring title (match-beginning 1) (match-end 1))
442 ;; (format "{%s}" (upcase char)))
443 (format "%s" (upcase char)))
444 (setq start (match-end 1))))
446 ;; this is defined in doi-utils
450 ;; clean and refill entry so it looks nice
452 (bibtex-fill-entry))))
454 ;; * Navigation in bibtex file
455 (defun jmax-bibtex-next-entry (&optional n)
456 "Jump to the beginning of the next bibtex entry.
457 N is a prefix argument. If it is numeric, jump that many entries
458 forward. Negative numbers do nothing."
460 ;; Note if we start at the beginning of an entry, nothing
461 ;; happens. We need to move forward a char, and call again.
462 (when (= (point) (save-excursion
463 (bibtex-beginning-of-entry)))
465 (jmax-bibtex-next-entry))
467 ;; search forward for an entry
469 (re-search-forward bibtex-entry-head nil t (and (numberp n) n))
470 ;; go to beginning of the entry
471 (bibtex-beginning-of-entry)))
474 (defun jmax-bibtex-previous-entry (&optional n)
475 "Jump to beginning of the previous bibtex entry.
476 N is a prefix argument. If it is numeric, jump that many entries back."
478 (bibtex-beginning-of-entry)
480 (re-search-backward bibtex-entry-head nil t (and (numberp n) n))
481 (bibtex-beginning-of-entry)))
484 (defun jmax-bibtex-mode-keys ()
485 "Modify keymaps used by `bibtex-mode'."
486 (local-set-key (kbd "M-n") 'jmax-bibtex-next-entry)
487 (local-set-key (kbd "M-p") 'jmax-bibtex-previous-entry))
489 ;; add to bibtex-mode-hook
490 (add-hook 'bibtex-mode-hook 'jmax-bibtex-mode-keys)
492 ;; * Functions to act on an entry with a doi
493 (defun jmax-bibtex-entry-doi ()
494 "Get doi from entry at point."
497 (bibtex-beginning-of-entry)
498 (reftex-get-bib-field "doi" (bibtex-parse-entry t))))
501 (defun jmax-bibtex-wos ()
502 "Open bibtex entry in Web Of Science if there is a DOI."
504 (doi-utils-wos (jmax-bibtex-entry-doi)))
507 (defun jmax-bibtex-wos-citing ()
508 "Open citing articles for bibtex entry in Web Of Science if there is a DOI."
510 (doi-utils-wos-citing (jmax-bibtex-entry-doi)))
513 (defun jmax-bibtex-wos-related ()
514 "Open related articles for bibtex entry in Web Of Science if there is a DOI."
516 (doi-utils-wos-related (jmax-bibtex-entry-doi)))
519 (defun jmax-bibtex-wos-citing ()
520 "Open citing articles for bibtex entry in Web Of Science if there is a DOI."
522 (doi-utils-wos-citing (jmax-bibtex-entry-doi)))
525 (defun jmax-bibtex-crossref ()
526 "Open the bibtex entry in Crossref by its doi."
528 (doi-utils-crossref (jmax-bibtex-entry-doi)))
531 (defun jmax-bibtex-google-scholar ()
532 "Open the bibtex entry at point in google-scholar by its doi."
534 (doi-utils-google-scholar (jmax-bibtex-entry-doi)))
537 (defun jmax-bibtex-pubmed ()
538 "Open the bibtex entry at point in Pubmed by its doi."
540 (doi-utils-pubmed (jmax-bibtex-entry-doi)))
543 (defun jmax-bibtex-pdf (doi)
544 "Open the pdf for the bibtex entry at point.
545 Thin wrapper to get `jmax-bibtex' to open pdf, because it calls
546 functions with a DOI argument."
548 (org-ref-open-bibtex-pdf))
552 ;; ** Hydra menu for bibtex entries
553 ;; hydra menu for actions on bibtex entries
554 (defhydra jmax-bibtex-hydra (:color blue)
556 _p_: Open pdf _y_: Copy key _n_: New entry _w_: WOS
557 _b_: Open url _f_: Copy formatted entry _o_: Copy entry _c_: WOS citing
558 _r_: Refile entry _k_: Add keywords _d_: delete entry _a_: WOS related
559 _e_: Email entry _K_: Edit keywords _L_: clean entry _P_: Pubmed
560 _U_: Update entry _N_: Open notes _R_: Crossref _g_: Google Scholar
561 _s_: Sort entry _a_: Remove nonascii _h_: helm-bibtex _q_: quit
562 _u_: Update field _F_: file funcs
566 ("p" org-ref-open-bibtex-pdf)
567 ("P" jmax-bibtex-pubmed)
568 ("w" jmax-bibtex-wos)
569 ("c" jmax-bibtex-wos-citing)
570 ("a" jmax-bibtex-wos-related)
571 ("R" jmax-bibtex-crossref)
572 ("g" jmax-bibtex-google-scholar)
573 ("n" jmax-bibtex-new-entry/body)
574 ("N" org-ref-open-bibtex-notes)
575 ("o" bibtex-copy-entry-as-kill)
576 ("d" bibtex-kill-entry)
577 ("L" org-ref-clean-bibtex-entry)
578 ("y" (kill-new (bibtex-autokey-get-field "=key=")))
579 ("f" bibtex-copy-summary-as-kill)
580 ("k" helm-tag-bibtex-entry)
583 (org-ref-set-bibtex-keywords
584 (read-string "Keywords: "
585 (bibtex-autokey-get-field "keywords"))
587 ("b" org-ref-open-in-browser)
588 ("r" (lambda () (interactive)
589 (bibtex-beginning-of-entry)
591 (find-file (ido-completing-read
593 (f-entries "." (lambda (f) (f-ext? f "bib")))))
594 (goto-char (point-max))
598 ("e" email-bibtex-entry)
599 ("U" (doi-utils-update-bibtex-entry-from-doi (jmax-bibtex-entry-doi)))
600 ("u" doi-utils-update-field)
601 ("F" jmax-bibtex-file/body)
603 ("a" jmax-replace-nonascii)
604 ("s" org-ref-sort-bibtex-entry)
605 ("T" jmax-title-case-article)
606 ("S" jmax-sentence-case-article)
609 ;; create key-chord and key binding for hydra
610 (when jmax-bibtex-hydra-key-chord
611 (key-chord-define-global
612 jmax-bibtex-hydra-key-chord
613 'jmax-bibtex-hydra/body))
616 (when jmax-bibtex-hydra-key-binding
617 (global-set-key jmax-bibtex-hydra-key-binding 'jmax-bibtex-hydra/body))
619 ;; ** Hydra menu for new bibtex entries
620 ;; A hydra for adding new bibtex entries.
621 (defhydra jmax-bibtex-new-entry (:color blue)
623 ("a" bibtex-Article "Article")
624 ("b" bibtex-Book "Book")
625 ("i" bibtex-InBook "In book")
626 ("l" bibtex-Booklet "Booklet")
627 ("P" bibtex-Proceedings "Proceedings")
628 ("p" bibtex-InProceedings "In proceedings")
629 ("m" bibtex-Misc "Misc.")
630 ("M" bibtex-Manual "Manual")
631 ("T" bibtex-PhdThesis "PhD Thesis")
632 ("t" bibtex-MastersThesis "MS Thesis")
633 ("R" bibtex-TechReport "Report")
634 ("u" bibtex-Unpublished "unpublished")
635 ("c" bibtex-InCollection "Article in collection")
639 ;; ** Hydra menu of functions to act on a bibtex file.
640 (defhydra jmax-bibtex-file (:color blue)
641 "Bibtex file functions: "
642 ("v" bibtex-validate "Validate entries")
643 ("s" bibtex-sort-buffer "Sort entries")
644 ("r" bibtex-reformat "Reformat entries")
645 ("c" bibtex-count-entries "Count entries")
646 ("p" org-ref-build-full-bibliography "PDF bibliography"))
649 ;; * DEPRECATED bibtex menu
650 (defvar jmax-bibtex-menu-funcs '()
651 "Functions to run in doi menu.
652 Each entry is a list of (key menu-name function). The function
653 must take one argument, the doi. This is somewhat deprecated, as
654 I prefer the hydra interfaces above.")
656 (setq jmax-bibtex-menu-funcs
657 '(("p" "df" jmax-bibtex-pdf)
658 ("C" "opy" (lambda (doi)
659 (kill-new (org-ref-bib-citation))
661 ("w" "os" doi-utils-wos)
662 ("c" "iting articles" doi-utils-wos-citing)
663 ("r" "elated articles" doi-utils-wos-related)
664 ("s" "Google Scholar" doi-utils-google-scholar)
665 ("P" "Pubmed" doi-utils-pubmed)
666 ("f" "CrossRef" doi-utils-crossref)))
668 (defun jmax-bibtex ()
669 "Menu command to run in a bibtex entry.
670 Functions from `jmax-bibtex-menu-funcs'. They all rely on the
674 ;; construct menu string as a message
679 (concat "[" (elt tup 0) "]"
681 jmax-bibtex-menu-funcs "") ": "))
682 (let* ((input (read-char-exclusive))
684 (char-to-string input) jmax-bibtex-menu-funcs)))
690 (jmax-bibtex-entry-doi)
693 (defalias 'jb 'jmax-bibtex)
696 (provide 'jmax-bibtex)
698 ;;; jmax-bibtex.el ends here