summaryrefslogtreecommitdiff
path: root/config.el
blob: 115eceb2bf48745f001e560a809a6be3dd85e37d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
;;; -*- lexical-binding: t; -*-

(setq ;; doom-font (font-spec :family "Hasklig" :size 15)
      doom-unicode-font (font-spec :family "Julia Mono"))
(load-theme 'doom-palenight t)

(when (version<= "26.0.50" emacs-version )
  (global-display-line-numbers-mode))

;; company-mode auto-completion, to turn off use :company-complete
(require 'company)
(setq company-idle-delay 0.2
      company-minimum-prefix-length 3)

;; hooks to turn on lsp when entering haskell mode
(add-hook 'haskell-mode-hook #'lsp)
(add-hook 'haskell-literate-mode-hook #'lsp)

(setq org-agenda-files '("~/org" "~/org/roam"))
(setq org-roam-directory "~/org/roam")
(setq org-roam-v2-ack t)

(after! org
  (setq org-todo-keywords
        '((sequence "TODO" "IDEA" "IDLE" "DONE")
          (sequence "[ ](T)" "[X](D)"))
        org-todo-keyword-faces
        '(("[-]"  . +org-todo-active)
          ("[?]"  . +org-todo-onhold)
          ("KILL" . +org-todo-cancel))))

(add-to-list 'load-path "~/.nix-profile/share/emacs/site-lisp/mu4e/")

(after! mu4e
  (set-email-account! "hacc"
                      '( (user-mail-address . "stuebinm@hacc.space")
                         (user-full-name . "stuebinm")
                         (m4u-maildir . "~/Maildir/hacc")
                         (mu4e-sent-folder . "/hacc/Sent")
                         (mu4e-trash-folder . "/hacc/Trash") )
                      t))

(after! helm-dictionary
  (setq helm-dictionary-database
        '(("de-en" . "~/org/dict/de-en.txt")
          ("es-de" . "~/org/dict/es-de.txt")
          ("en-it" . "~/org/dict/en-it-enwiktionary.txt")
          ("it-en" . "~/org/dict/it-en-enwiktionary.txt"))))


;; hide all these annoying popups that clutter the view
(setq lsp-ui-doc-enable nil)
(setq lsp-ui-sideline-show-code-actions nil)
(setq lsp-signature-render-documentation nil)

(after! (lsp-ui helm-lsp)
  (lsp-signature-activate)
  ;; custom version which will not blindly apply a single code action
  ;; if only one is available without asking about it first.
  ;; Source taken from https://github.com/emacs-lsp/helm-lsp/blob/master/helm-lsp.el
  (lsp-make-interactive-code-action wingman-fill-hole "refactor.wingman.fillHole")
  (lsp-make-interactive-code-action wingman-case-split "refactor.wingman.caseSplit")
  (lsp-make-interactive-code-action wingman-refine "refactor.wingman.refine")
  (lsp-make-interactive-code-action wingman-split-func-args "refactor.wingman.spltFuncArgs")
  (lsp-make-interactive-code-action wingman-use-constructor "refactor.wingman.useConstructor")
  (map! :map haskell-mode-map
        "C-c s" #'lsp-wingman-split
        "C-c h" #'lsp-wingman-fillhole)
  (defun helm-lsp-code-actions-custom()
    "Show lsp code actions using helm."
    (interactive)
    (let ((actions (lsp-code-actions-at-point)))
      (cond
       ((seq-empty-p actions) (signal 'lsp-no-code-actions nil))
       (t (helm :sources
                (helm-build-sync-source
                    "Code Actions"
                  :candidates actions
                  :candidate-transformer
                  (lambda (candidates)
                    (-map
                     (-lambda ((candidate &as
                                          &CodeAction :title))
                       (list title :data candidate))
                     candidates))
                  :action '(("Execute code action" . (lambda(candidate)
                                                       (print "selected code action")
                                                       (print (plist-get candidate :data))
                                                       (lsp-execute-code-action (plist-get candidate :data)))))))))))

  (map! :map doom-leader-code-map
        "a" #'helm-lsp-code-actions-custom))


(use-package! isar-mode
  :mode "\\.thy\\'"
  :config
  ;; (add-hook 'isar-mode-hook 'turn-on-highlight-indentation-mode)
  ;; (add-hook 'isar-mode-hook 'flycheck-mode)
  (add-hook 'isar-mode-hook 'company-mode)
  (add-hook 'isar-mode-hook
            (lambda ()
              (set (make-local-variable 'company-backends)
                   '((company-dabbrev-code company-yasnippet)))))
  (add-hook 'isar-mode-hook
            (lambda ()
              (set (make-local-variable 'indent-tabs-mode) nil)))
  (add-hook 'isar-mode-hook
            (lambda ()
              (yas-minor-mode))))


;; icons in the tray
(setq display-time-24hr-format 1)
(display-time-mode)
(display-battery-mode)