emacs,guix: install and use pdf-tools for viewing PDFs in emacs
[~bandali/configs] / .emacs.d / init.el
index 6bf61e4..a19fcaa 100644 (file)
   "Expand filename FILE relative to `b/var-dir'."
   (expand-file-name (convert-standard-filename file) b/var-dir))
 
-(setq auto-save-list-file-prefix (b/var "auto-save/sessions/"))
+(setq
+ auto-save-list-file-prefix (b/var "auto-save/sessions/")
+ nsm-settings-file (b/var "nsm-settings.el"))
 
 ;; separate custom file (don't want it mixing with init.el)
 (use-package custom
@@ -435,11 +437,6 @@ For disabling the behaviour for certain buffers and/or modes."
  ("C-x k"   . kill-this-buffer)
  ("C-x K"   . kill-buffer)
 
- ("s-p"     . beginning-of-buffer)
- ("s-n"     . end-of-buffer)
-
- ("M-O"     . facemenu-keymap)
-
  :map emacs-lisp-mode-map
  ("<C-return>" . b/add-elisp-section))
 
@@ -482,9 +479,10 @@ For disabling the behaviour for certain buffers and/or modes."
          (org-mode . auto-fill-mode)
          (org-mode . flyspell-mode))
   :custom
+  (org-pretty-entities t)
   (org-agenda-files '("~/usr/org/todos/personal.org"
                       "~/usr/org/todos/habits.org"
-                      "~/usr/org/todos/masters.org"))
+                      "~/src/git/masters-thesis/todo.org"))
   (org-agenda-start-on-weekday 0)
   (org-agenda-time-leading-zero t)
   (org-habit-graph-column 44)
@@ -568,6 +566,9 @@ For disabling the behaviour for certain buffers and/or modes."
   (nconc magit-section-initial-visibility-alist
          '(([unpulled status] . show)
            ([unpushed status] . show)))
+  (setq transient-history-file (b/var "transient/history.el")
+        transient-levels-file  (b/etc "transient/levels.el")
+        transient-values-file  (b/etc "transient/values.el"))
   :custom (magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1)
   :custom-face (magit-diff-file-heading ((t (:weight normal)))))
 
@@ -581,7 +582,9 @@ For disabling the behaviour for certain buffers and/or modes."
   (recentf-save-file (b/var "recentf-save.el")))
 
 ;; smart M-x enhancement (needed by counsel for history)
-(use-package smex)
+(use-package smex
+  :config
+  (setq smex-save-file (b/var "smex-save.el")))
 
 (use-package ivy
   :defer 0.3
@@ -681,7 +684,7 @@ For disabling the behaviour for certain buffers and/or modes."
 
 (use-package ibuffer
   :bind
-  (("C-x C-b" . ibuffer-other-window)
+  (("C-x C-b" . ibuffer)
    :map ibuffer-mode-map
    ("P"   . ibuffer-backward-filter-group)
    ("N"   . ibuffer-forward-filter-group)
@@ -1129,7 +1132,10 @@ For disabling the behaviour for certain buffers and/or modes."
     (eclim-executable "~/.p2/pool/plugins/org.eclim_2.8.0/bin/eclim")
     (eclim-eclipse-dirs '("~/usr/eclipse/dsl-2018-09/eclipse"))))
 
-(use-package geiser)
+(use-package geiser
+  :config
+  (make-directory (b/var "geiser/") t)
+  (setq geiser-repl-history-filename (b/var "geiser/repl-history")))
 
 (use-package geiser-guile
   :config
@@ -1270,18 +1276,17 @@ For disabling the behaviour for certain buffers and/or modes."
          ("C-c j"   . crux-top-join-line)
          ("C-S-j"   . crux-top-join-line)))
 
-(comment
-  ;; TODO
-  (use-package mwim
-    :bind (("C-a"    . mwim-beginning-of-code-or-line)
-           ("C-e"    . mwim-end-of-code-or-line)
-           ("<home>" . mwim-beginning-of-line-or-code)
-           ("<end>"  . mwim-end-of-line-or-code))))
+(use-package mwim
+  :bind (("C-a"    . mwim-beginning-of-code-or-line)
+         ("C-e"    . mwim-end-of-code-or-line)
+         ("<home>" . mwim-beginning-of-line-or-code)
+         ("<end>"  . mwim-end-of-line-or-code)))
 
 (use-package projectile
   :defer 0.5
   :bind-keymap ("C-c P" . projectile-command-map)
   :config
+  (make-directory (b/var "projectile/") t)
   (projectile-mode)
 
   (defun b/projectile-mode-line-fun ()
@@ -1306,7 +1311,9 @@ For disabling the behaviour for certain buffers and/or modes."
        (advice-add 'magit-branch-and-checkout
                    :after #'my-projectile-invalidate-cache)))
   :custom
+  (projectile-cache-file (b/var "projectile/cache.el"))
   (projectile-completion-system 'ivy)
+  (projectile-known-projects-file (b/var "projectile/known-projects.el"))
   (projectile-mode-line-prefix " proj"))
 
 (use-package helpful
@@ -1318,45 +1325,41 @@ For disabling the behaviour for certain buffers and/or modes."
    ("C-S-h k" . helpful-key)
    ("C-S-h p" . helpful-at-point)))
 
-(comment
-  ;; TODO
-  (use-package unkillable-scratch
-    :defer 0.6
-    :config
-    (unkillable-scratch 1)
-    :custom
-    (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$"))))
+(use-package unkillable-scratch
+  :defer 0.6
+  :config
+  (unkillable-scratch 1)
+  :custom
+  (unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")))
 
-(comment
-  ;; TODO
-  ;; ,----
-  ;; | make pretty boxed quotes like this
-  ;; `----
-  (use-package boxquote
-    :defer 0.6
-    :bind
-    (:prefix-map b/boxquote-prefix-map
-                 :prefix "C-c q"
-                 ("b"   . boxquote-buffer)
-                 ("B"   . boxquote-insert-buffer)
-                 ("d"   . boxquote-defun)
-                 ("F"   . boxquote-insert-file)
-                 ("hf"  . boxquote-describe-function)
-                 ("hk"  . boxquote-describe-key)
-                 ("hv"  . boxquote-describe-variable)
-                 ("hw"  . boxquote-where-is)
-                 ("k"   . boxquote-kill)
-                 ("p"   . boxquote-paragraph)
-                 ("q"   . boxquote-boxquote)
-                 ("r"   . boxquote-region)
-                 ("s"   . boxquote-shell-command)
-                 ("t"   . boxquote-text)
-                 ("T"   . boxquote-title)
-                 ("u"   . boxquote-unbox)
-                 ("U"   . boxquote-unbox-region)
-                 ("y"   . boxquote-yank)
-                 ("M-q" . boxquote-fill-paragraph)
-                 ("M-w" . boxquote-kill-ring-save))))
+;; ,----
+;; | make pretty boxed quotes like this
+;; `----
+(use-package boxquote
+  :defer 0.6
+  :bind
+  (:prefix-map b/boxquote-prefix-map
+               :prefix "C-c q"
+               ("b"   . boxquote-buffer)
+               ("B"   . boxquote-insert-buffer)
+               ("d"   . boxquote-defun)
+               ("F"   . boxquote-insert-file)
+               ("hf"  . boxquote-describe-function)
+               ("hk"  . boxquote-describe-key)
+               ("hv"  . boxquote-describe-variable)
+               ("hw"  . boxquote-where-is)
+               ("k"   . boxquote-kill)
+               ("p"   . boxquote-paragraph)
+               ("q"   . boxquote-boxquote)
+               ("r"   . boxquote-region)
+               ("s"   . boxquote-shell-command)
+               ("t"   . boxquote-text)
+               ("T"   . boxquote-title)
+               ("u"   . boxquote-unbox)
+               ("U"   . boxquote-unbox-region)
+               ("y"   . boxquote-yank)
+               ("M-q" . boxquote-fill-paragraph)
+               ("M-w" . boxquote-kill-ring-save)))
 
 (use-package orgalist
   ;; http://lists.gnu.org/archive/html/emacs-orgmode/2019-04/msg00007.html
@@ -1378,23 +1381,21 @@ For disabling the behaviour for certain buffers and/or modes."
   :config
   (global-hl-todo-mode))
 
-(comment
-  ;; TODO
-  (use-package shrink-path
-    :defer 0.5
-    :after eshell
-    :config
-    (defvar user-@-host (concat (user-login-name) "@" (system-name) " "))
-    (defun +eshell/prompt ()
-      (let ((base/dir (shrink-path-prompt default-directory)))
-        (concat (propertize user-@-host 'face 'default)
-                (propertize (car base/dir)
-                            'face 'font-lock-comment-face)
-                (propertize (cdr base/dir)
-                            'face 'font-lock-constant-face)
-                (propertize "> " 'face 'default))))
-    (setq eshell-prompt-regexp (concat user-@-host ".*> ")
-          eshell-prompt-function #'+eshell/prompt)))
+(use-package shrink-path
+  :defer 0.5
+  :after eshell
+  :config
+  (defvar user-@-host (concat (user-login-name) "@" (system-name) " "))
+  (defun +eshell/prompt ()
+    (let ((base/dir (shrink-path-prompt default-directory)))
+      (concat (propertize user-@-host 'face 'default)
+              (propertize (car base/dir)
+                          'face 'font-lock-comment-face)
+              (propertize (cdr base/dir)
+                          'face 'font-lock-constant-face)
+              (propertize "> " 'face 'default))))
+  (setq eshell-prompt-regexp (concat user-@-host ".*> ")
+        eshell-prompt-function #'+eshell/prompt))
 
 (use-package eshell-up
   :after eshell
@@ -1471,7 +1472,9 @@ For disabling the behaviour for certain buffers and/or modes."
                ("c" . mc/edit-lines)
                ("n" . mc/mark-next-like-this)
                ("p" . mc/mark-previous-like-this)
-               ("a" . mc/mark-all-like-this))))
+               ("a" . mc/mark-all-like-this)))
+  :config
+  (setq mc/list-file (b/var "mc-list.el")))
 
 (comment
   ;; TODO
@@ -1484,6 +1487,7 @@ For disabling the behaviour for certain buffers and/or modes."
   :config
   (defconst yas-verbosity-cur yas-verbosity)
   (setq yas-verbosity 2)
+  (setq yas-snippet-dirs (list (b/etc "yasnippet/snippets/")))
   (add-to-list 'yas-snippet-dirs "~/src/git/guix/etc/snippets" t)
   (yas-reload-all)
   (setq yas-verbosity yas-verbosity-cur)
@@ -1507,16 +1511,20 @@ For disabling the behaviour for certain buffers and/or modes."
 ;; (use-package fill-column-indicator)
 
 (use-package emojify
+  :config
+  (make-directory (b/var "emojify/") t)
+  (setq emojify-emojis-dir (b/var "emojify/"))
   :hook (erc-mode . emojify-mode))
 
 (use-package window
   :bind
   (("s-o"   . other-window)
-   ("M-o"   . other-window)
    ("s-/ ." . split-window-right)
    ("s-/ ," . split-window-below)
    ("s-/ 0" . delete-window)
-   ("s-q"   . delete-window)))
+   ("s-q"   . delete-window))
+  :custom
+  (split-width-threshold 150))
 
 (use-package windmove
   :defer 0.6
@@ -1535,6 +1543,12 @@ For disabling the behaviour for certain buffers and/or modes."
   :bind ("C-c a p" . pass)
   :hook (pass-mode . View-exit))
 
+(use-package pdf-tools
+  :defer 0.5
+  :bind (:map pdf-view-mode-map
+              ("M-RET" . image-previous-line))
+  :config (pdf-tools-install nil t))
+
 \f
 ;;; Email (with Gnus)
 
@@ -1766,11 +1780,9 @@ For disabling the behaviour for certain buffers and/or modes."
    gnus-interactive-exit nil
    gnus-gcc-mark-as-read t)
   :config
-  (comment
-    ;; TODO
-    (require 'ebdb)
-    (require 'ebdb-mua)
-    (require 'ebdb-gnus))
+  (require 'ebdb)
+  (require 'ebdb-mua)
+  (require 'ebdb-gnus)
 
   ;; (gnus-registry-initialize)
 
@@ -1930,9 +1942,7 @@ https://bandalis.org")
         '(gnus-find-subscribed-addresses)
         message-dont-reply-to-names
         "\\(\\(\\(amin\\|mab\\)@shemshak\\.org\\)\\|\\(amin@bndl\\.org\\)\\|\\(.*@aminb\\.org\\)\\|\\(\\(bandali\\|mab\\|aminb?\\)@gnu\\.org\\)\\|\\(a\\(min\\.\\)?bandali@uwaterloo\\.ca\\)\\|\\(abandali@csclub\\.uwaterloo\\.ca\\)\\)")
-  (comment
-    ;; TODO
-    (require 'company-ebdb))
+  (require 'company-ebdb)
   :hook (;; (message-setup . mml-secure-message-sign-pgpmime)
          (message-mode . flyspell-mode)
          (message-mode . (lambda ()
@@ -1972,56 +1982,49 @@ https://bandalis.org")
         ("r" . footnote-renumber-footnotes)
         ("s" . footnote-set-style)))
 
-(comment
-  ;; TODO
-  (use-package ebdb
-    :straight (:host github :repo "girzel/ebdb")
-    :after gnus
-    :bind (:map gnus-group-mode-map ("e" . ebdb))
-    :config
-    (setq ebdb-sources (b/var "ebdb"))
-    (with-eval-after-load 'swiper
-      (add-to-list 'swiper-font-lock-exclude 'ebdb-mode t)))
-
-  (use-package ebdb-com
-    :after ebdb)
+(use-package ebdb
+  :after gnus
+  :bind (:map gnus-group-mode-map ("e" . ebdb))
+  :config
+  (setq ebdb-sources (b/var "ebdb"))
+  (with-eval-after-load 'swiper
+    (add-to-list 'swiper-font-lock-exclude 'ebdb-mode t)))
 
-  ;; (use-package ebdb-complete
-  ;;   :after ebdb
-  ;;   :config
-  ;;   (ebdb-complete-enable))
+(use-package ebdb-com
+  :after ebdb)
 
-  (use-package company-ebdb
-    :config
-    (defun company-ebdb--post-complete (_) nil))
+;; (use-package ebdb-complete
+;;   :after ebdb
+;;   :config
+;;   (ebdb-complete-enable))
 
-  (use-package ebdb-gnus
-    :after ebdb
-    :custom
-    (ebdb-gnus-window-configuration
-     '(article
-       (vertical 1.0
-                 (summary 0.25 point)
-                 (horizontal 1.0
-                             (article 1.0)
-                             (ebdb-gnus 0.3))))))
-
-  (use-package ebdb-mua
-    :after ebdb
-    ;; :custom (ebdb-mua-pop-up nil)
-    )
+(use-package company-ebdb
+  :config
+  (defun company-ebdb--post-complete (_) nil))
 
-  ;; (use-package ebdb-message
-  ;;   :after ebdb)
+(use-package ebdb-gnus
+  :after ebdb
+  :custom
+  (ebdb-gnus-window-configuration
+   '(article
+     (vertical 1.0
+               (summary 0.25 point)
+               (horizontal 1.0
+                           (article 1.0)
+                           (ebdb-gnus 0.3))))))
+
+(use-package ebdb-mua
+  :after ebdb
+  ;; :custom (ebdb-mua-pop-up nil)
+  )
 
+;; (use-package ebdb-message
+;;   :after ebdb)
 
-  ;; (use-package ebdb-vcard
-  ;;   :after ebdb)
-  )
+;; (use-package ebdb-vcard
+;;   :after ebdb)
 
-(comment
-  ;; TODO
-  (use-package message-x))
+(use-package message-x)
 
 (comment
   (use-package message-x
@@ -2075,14 +2078,13 @@ https://bandalis.org")
   (add-to-list 'erc-modules 'keep-place)
   (add-to-list 'erc-modules 'notifications)
   (add-to-list 'erc-modules 'spelling)
-  (comment
-    ;; TODO
-    (add-to-list 'erc-modules 'scrolltoplace))
+  (add-to-list 'erc-modules 'scrolltoplace)
   (erc-update-modules))
 
 (use-package erc-fill
   :after erc
   :custom
+  (erc-fill-column 77)
   (erc-fill-function 'erc-fill-static)
   (erc-fill-static-center 18))
 
@@ -2103,10 +2105,8 @@ https://bandalis.org")
 (use-package erc-hl-nicks
   :after erc)
 
-(comment
-  ;; TODO
-  (use-package erc-scrolltoplace
-    :after erc))
+(use-package erc-scrolltoplace
+  :after erc)
 
 (use-package znc
   :load-path "lisp/znc.el/"