]> git.donarmstrong.com Git - lib.git/commitdiff
call org-mode reftex setup after org mode loads
authorDon Armstrong <don@donarmstrong.com>
Thu, 6 Mar 2025 05:01:16 +0000 (21:01 -0800)
committerDon Armstrong <don@donarmstrong.com>
Thu, 6 Mar 2025 05:01:16 +0000 (21:01 -0800)
emacs_el/configuration/don-configuration.org

index 745ebbb9b2d61bd62d1d586f9d4ee5a119182e89..e5661fc39c3802ba2bf3470b3dfae23189aecefa 100644 (file)
@@ -1041,10 +1041,31 @@ _d_: subtree
 #+BEGIN_SRC emacs-lisp
 (use-package reftex
   :hook ((LaTeX-mode latex-mode) . reftex-mode)
+  :hook (org-mode . my-org-mode-setup)
+  :after org
   :config
   (setq-default reftex-default-bibliography
-                  '("~/projects/research/references.bib"))
+                '("~/projects/research/references.bib"))
   (setq-default reftex-plug-into-AUCTeX t)
+  (defun org-mode-reftex-search ()
+    (interactive)
+    (org-open-link-from-string (format "[[notes:%s]]" (first (reftex-citation t)))))
+  (defun my-org-mode-setup ()
+    (and (buffer-file-name)
+         (file-exists-p (buffer-file-name))
+         (progn
+           ;; (reftex-parse-all)
+           (reftex-set-cite-format
+            '((?b . "[[bib:%l][%l-bib]]")
+              (?n . "[[notes:%l][%l-notes]]")
+              (?c . "\\cite{%l}")
+              (?h . "*** %t\n:PROPERTIES:\n:Custom_ID: %l\n:END:\n[[papers:%l][%l xoj]] [[papers-pdf:%l][pdf]]")))
+           ))
+    (define-key org-mode-map (kbd "C-c )") 'reftex-citation)
+    (define-key org-mode-map (kbd "C-c [") 'reftex-citation)
+    (define-key org-mode-map (kbd "C-c (") 'org-mode-reftex-search)
+    (define-key org-mode-map (kbd "C-c 0") 'reftex-view-crossref)
+    )
   )
 #+END_SRC
 ** BibTex
@@ -2028,28 +2049,6 @@ Maildir, or by Message-ID."
 ;; add support for "mutt:ID" links
 (org-add-link-type "mutt" 'open-mail-in-mutt)
 
-(defun my-org-mode-setup ()
-  ; (load-library "reftex")
-  (and (buffer-file-name)
-       (file-exists-p (buffer-file-name))
-       (progn
-         ; (reftex-parse-all)
-         (reftex-set-cite-format
-          '((?b . "[[bib:%l][%l-bib]]")
-            (?n . "[[notes:%l][%l-notes]]")
-            (?c . "\\cite{%l}")
-            (?h . "*** %t\n:PROPERTIES:\n:Custom_ID: %l\n:END:\n[[papers:%l][%l xoj]] [[papers-pdf:%l][pdf]]")))
-         ))
-  (define-key org-mode-map (kbd "C-c )") 'reftex-citation)
-  (define-key org-mode-map (kbd "C-c [") 'reftex-citation)
-  (define-key org-mode-map (kbd "C-c (") 'org-mode-reftex-search)
-  (define-key org-mode-map (kbd "C-c 0") 'reftex-view-crossref)
-  )
-(add-hook 'org-mode-hook 'my-org-mode-setup)
-
-(defun org-mode-reftex-search ()
-  (interactive)
-  (org-open-link-from-string (format "[[notes:%s]]" (first (reftex-citation t)))))
 
 (defun open-research-paper (bibtexkey)
   "Open a paper by bibtex key"