emacs: add reftex
[~bandali/configs] / .emacs.d / init.el
index 0d23dfe..6c17967 100644 (file)
@@ -471,6 +471,9 @@ For disabling the behaviour for certain buffers and/or modes."
         org-startup-folded 'content
         org-catch-invisible-edits 'show-and-error
         org-log-done 'time)
+  (when (version< org-version "9.3")
+    (setq org-email-link-description-format
+          org-link-email-description-format))
   (add-to-list 'org-structure-template-alist '("L" . "src emacs-lisp") t)
   (add-to-list 'org-modules 'org-habit)
   :bind
@@ -623,12 +626,12 @@ For disabling the behaviour for certain buffers and/or modes."
   :delight
   :bind (([remap execute-extended-command] . counsel-M-x)
          ([remap find-file]                . counsel-find-file)
-         ("C-c x"                          . counsel-M-x)
+         ("C-c b b"                        . ivy-switch-buffer)
          ("C-c f ."                        . counsel-find-file)
          ("C-c f l"                        . counsel-find-library)
          ("C-c f r"                        . counsel-recentf)
+         ("C-c x"                          . counsel-M-x)
          ("s-."                            . counsel-find-file)
-         ("s-r"                            . ivy-switch-buffer)
          :map minibuffer-local-map
          ("C-r" . counsel-minibuffer-history))
   :config
@@ -1561,6 +1564,23 @@ For disabling the behaviour for certain buffers and/or modes."
 
 (use-package biblio)
 
+(use-package reftex
+  :hook (latex-mode . reftex-mode))
+
+(use-package reftex-cite
+  :after reftex
+  :disabled                             ; enable to disable
+                                        ; reftex-cite's default choice
+                                        ; of previous word
+  :config
+  (defun reftex-get-bibkey-default ()
+    "If the cursor is in a citation macro, return the word before the macro."
+    (let* ((macro (reftex-what-macro 1)))
+      (save-excursion
+        (when (and macro (string-match "cite" (car macro)))
+          (goto-char (cdr macro)))
+        (reftex-this-word)))))
+
 \f
 ;;; Email (with Gnus)
 
@@ -1608,7 +1628,7 @@ For disabling the behaviour for certain buffers and/or modes."
                                  (list ".*atreus.freelists.org" "l.atreus")
                                  (list ".*deepspec.lists.cs.princeton.edu" "l.deepspec")
                                  ;; (list ".*haskell-art.we.lurk.org" "l.haskell.art") ;d
-                                 (list ".*haskell-cafe.haskell.org" "l.haskell.cafe")
+                                 (list ".*haskell-cafe.haskell.org" "l.haskell-cafe")
                                  ;; (list ".*notmuch.notmuchmail.org" "l.notmuch") ;u
                                  ;; (list ".*dev.lists.parabola.nu" "l.parabola-dev") ;u
                                  ;; ----------------------------------
@@ -1627,8 +1647,8 @@ For disabling the behaviour for certain buffers and/or modes."
              (nnimap-split-fancy (|
                                   ;; (: gnus-registry-split-fancy-with-parent)
                                   ;; se212-f19
-                                  ("subject" "SE\\s-?212" "course.se463-s19")
-                                  (from "SE\\s-?212" "course.se463-s19")
+                                  ("subject" "SE\\s-?212" "course.se212-f19")
+                                  (from "SE\\s-?212" "course.se212-f19")
                                   ;; catch-all
                                   "INBOX")))
      (nnimap "csc"
@@ -2059,7 +2079,7 @@ https://csclub.uwaterloo.ca/~abandali")
 ;;; IRC (with ERC and ZNC)
 
 (use-package erc
-  :bind (("C-c a e b" . erc-switch-to-buffer)
+  :bind (("C-c b e" . erc-switch-to-buffer)
          :map erc-mode-map
          ("M-a" . erc-track-switch-buffer))
   :custom