emacs: add reftex
[~bandali/configs] / .emacs.d / init.el
index eb634df..6c17967 100644 (file)
@@ -626,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)
   :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 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-."                            . counsel-find-file)
-         ("s-r"                            . ivy-switch-buffer)
          :map minibuffer-local-map
          ("C-r" . counsel-minibuffer-history))
   :config
          :map minibuffer-local-map
          ("C-r" . counsel-minibuffer-history))
   :config
@@ -1564,6 +1564,23 @@ For disabling the behaviour for certain buffers and/or modes."
 
 (use-package biblio)
 
 
 (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)
 
 \f
 ;;; Email (with Gnus)
 
@@ -2062,7 +2079,7 @@ https://csclub.uwaterloo.ca/~abandali")
 ;;; IRC (with ERC and ZNC)
 
 (use-package erc
 ;;; 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
          :map erc-mode-map
          ("M-a" . erc-track-switch-buffer))
   :custom