emacs: add ivy-xref
[~bandali/configs] / .emacs.d / init.el
index 7c83bfb..a5bb25e 100644 (file)
@@ -93,7 +93,9 @@
 ;; Not necessary when using straight.el
 ;;   (C-h v straight-package-neutering-mode RET)
 
-(comment
+(when (and
+       (not (featurep 'straight))
+       (version< emacs-version "27"))
   (setq package-enable-at-startup nil)
   ;; (package-initialize)
   )
@@ -442,6 +444,14 @@ For disabling the behaviour for certain buffers and/or modes."
 ;; allow scrolling in Isearch
 (setq isearch-allow-scroll t)
 
+(use-feature vc
+  :bind ("C-x v C-=" . vc-ediff))
+
+(use-feature ediff
+  :config (add-hook 'ediff-after-quit-hook-internal 'winner-undo)
+  :custom ((ediff-window-setup-function 'ediff-setup-windows-plain)
+           (ediff-split-window-function 'split-window-horizontally)))
+
 \f
 ;;; General bindings
 
@@ -456,7 +466,7 @@ For disabling the behaviour for certain buffers and/or modes."
 
  ("C-c F m" . make-frame-command)
  ("C-c F d" . delete-frame)
- ("C-c F D" . delete-other-frames)
+ ("C-c F D" . server-edit)
 
  ("C-c o"   . other-window)
 
@@ -625,6 +635,7 @@ For disabling the behaviour for certain buffers and/or modes."
   (nconc magit-section-initial-visibility-alist
          '(([unpulled status] . show)
            ([unpushed status] . show)))
+  :custom (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1)
   :custom-face (magit-diff-file-heading ((t (:weight normal)))))
 
 ;; recently opened files
@@ -851,6 +862,17 @@ For disabling the behaviour for certain buffers and/or modes."
                         (setq ediff-after-quit-hook-internal nil)
                         (set-window-configuration wnd))))
         (error "no more than 2 files should be marked"))))
+
+  (require 'dired-x)
+  (setq dired-guess-shell-alist-user
+        '(("\\.pdf\\'"  "evince" "zathura" "okular")
+          ("\\.doc\\'"  "libreoffice")
+          ("\\.docx\\'" "libreoffice")
+          ("\\.ppt\\'"  "libreoffice")
+          ("\\.pptx\\'" "libreoffice")
+          ("\\.xls\\'"  "libreoffice")
+          ("\\.xlsx\\'" "libreoffice")
+          ("\\.flac\\'" "mpv")))
   :bind (:map dired-mode-map
               ("b"  . dired-up-directory)
               ("e"  . dired-ediff-files)
@@ -1374,9 +1396,7 @@ For disabling the behaviour for certain buffers and/or modes."
          ("C-c a s m p" . multi-term-prev)
          ("C-c a s m n" . multi-term-next)
          :map term-mode-map
-         ("C-c C-j" . term-char-mode)
-         :map term-raw-map
-         ("C-c C-j" . term-line-mode))
+         ("C-c C-j" . term-char-mode))
   :config
   (setq multi-term-program "screen"
         multi-term-program-switches (concat "-c"
@@ -1390,6 +1410,7 @@ For disabling the behaviour for certain buffers and/or modes."
         term-bind-key-alist
         '(("C-c C-c" . term-interrupt-subjob)
           ("C-c C-e" . term-send-esc)
+          ("C-c C-j" . term-line-mode)
           ("C-k" . kill-line)
           ;; ("C-y" . term-paste)
           ("C-y" . term-send-raw)
@@ -1518,6 +1539,10 @@ For disabling the behaviour for certain buffers and/or modes."
   :init
   (setq alert-default-style 'notifier))
 
+(use-package ivy-xref
+  :init
+  (setq xref-show-xrefs-function #'ivy-xref-show-xrefs))
+
 \f
 ;;; Email (with Gnus)
 
@@ -1629,7 +1654,9 @@ For disabling the behaviour for certain buffers and/or modes."
      ("gnu.*"
       (gcc-self . t))
      ("gnu\\."
-      (subscribed . t)))
+      (subscribed . t))
+     ("nnimap\\+uw:.*"
+      (gcc-self . t)))
    gnus-large-newsgroup  50
    gnus-home-directory   (no-littering-expand-var-file-name "gnus/")
    gnus-directory        (concat gnus-home-directory "news/")
@@ -1702,7 +1729,8 @@ For disabling the behaviour for certain buffers and/or modes."
            (body "Added  to 2019supporters.html.\n\nMoving to campaigns.\n\n-amin\n")
            (eval (setq a/message-cite-say-hi nil)))
           ("nnimap\\+uw:.*"
-           (address "abandali@uwaterloo.ca")
+           (address "abandali@uwaterloo.ca"))
+          ("nnimap\\+uw:INBOX"
            (gcc "\"nnimap+uw:Sent Items\""))
           ("nnimap\\+csc:.*"
            (address "abandali@csclub.uwaterloo.ca")
@@ -1721,9 +1749,11 @@ For disabling the behaviour for certain buffers and/or modes."
   :config
   (setq gnus-permanently-visible-groups "\\(:INBOX$\\|:gnu$\\)"))
 
-(use-feature gnus-win
-  :config
-  (setq gnus-use-full-window nil))
+(comment
+  ;; problematic with ebdb's popup, *EBDB-Gnus*
+  (use-feature gnus-win
+    :config
+    (setq gnus-use-full-window nil)))
 
 (use-feature gnus-dired
   :commands gnus-dired-mode