Auto refresh emails and change theming options.
[Dotty.git] / emacs / .emacs.d / init.el
1 ;; Added by Package.el.  This must come before configurations of
2 ;; installed packages.  Don't delete this line.  If you don't want it,
3 ;; just comment it out by adding a semicolon to the start of the line.
4 ;; You may delete these explanatory comments.
5 (package-initialize)
7 (add-to-list 'load-path "~/.emacs.d/lisp/")
9 ;; Use a dark theme now
10 ;(load-theme 'wheatgrass)
12 ;; Use light theme
13 ;;(load-theme 'leuven t)
14 (require 'modus-themes)
15 (load-theme 'modus-operandi t)
16 (setq modus-themes-mixed-fonts t)
18 ;; ESS - for working in R
19 (autoload 'R-mode "ess-site.el" "Major mode for editing R source." t)
20 (setq load-path (cons "/usr/share/emacs/site-lisp/ess" load-path))
21 (load "/usr/share/emacs/site-lisp/ess/lisp/ess-site")
22 (setq inferior-julia-program-name "/usr/bin/julia")
24 ;; enable autocomplete
25 (add-hook 'after-init-hook 'global-company-mode)
27 (require 'org)
29 ;; Automatically flow lines based on window width and use
30 ;; variable width fonts in org-mode.
31 (add-hook 'org-mode-hook 'visual-line-mode)
32 (add-hook 'org-mode-hook 'variable-pitch-mode)
34 ;; Auctex
35 (load "auctex.el" nil t t)
36 (load "preview-latex.el" nil t t)
38 ;; org-mode support for R and LaTeX
39 (org-babel-do-load-languages
40  'org-babel-load-languages
41  '((R . t)
42    (latex . t)))
43 ;; Security risk - This is somewhat ill-advised it appears
44 (setq org-confirm-babel-evaluate nil)
46 ;; Automatically switch to various modes
47 (setq auto-mode-alist
48     '(("\\.mdwn\\'" . markdown-mode)
49       ("\\.md\\'" . markdown-mode)
50       ("\\.yarn\\'" . markdown-mode)
51       ("\\.js\\'" . js-mode)
52       ("\\.json\\'" . js-mode)
53       ("Makefile" . makefile-mode)
54       ("README" . markdown-mode)
55       ("NEWS" . markdown-mode)
56       ("COMMIT_EDITMSG\\'" . text-mode)
57       ("\\.html\\'" . html-mode)
58       ("\\.css\\'" . css-mode)
59       ("\\.yaml\\'" . yaml-mode)
60       ("\\.yml\\'" . yaml-mode)
61       ("\\.ick\\'" . yaml-mode)
62       ("\\.py\\'" . python-mode)
63       ("\\.R\\'" . R-mode)
64       ("\\.org\\'" . org-mode)
65       ("\\.sh\\'" . shell-script-mode)
66       ("\\.hs\\'" . haskell-mode)
67       ("\\.el\\'" . emacs-lisp-mode)))
69 ;; Enable the melpa archive for packages
70 (require 'package)
71 (setq package-enable-at-startup nil)
72 (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
73 (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
74 (add-to-list 'package-archives
75              '("elpy" . "http://jorgenschaefer.github.io/packages/"))
77 (custom-set-variables
78  ;; custom-set-variables was added by Custom.
79  ;; If you edit it by hand, you could mess it up, so be careful.
80  ;; Your init file should contain only one such instance.
81  ;; If there is more than one, they won't work right.
82  '(browse-url-browser-function 'browse-url-firefox)
83  '(custom-safe-themes
84    '("0cf95236abcf59e05b1ea69b4edd53d293a5baec4fe4c3484543fee99bfd2204" "80b00f3bf7cdbdca6c80aadfbbb03145f3d0aacf6bf2a559301e61109954e30a" default))
85  '(denote-directory "/home/frederik/Nextcloud/notes/" t)
86  '(org-export-backends '(ascii html icalendar latex md odt))
87  '(package-selected-packages
88    '(ftable flx nerd-icons-dired nerd-icons all-the-icons-dired marginalia vertico denote ox-rss org-ql org-contrib mustache org-static-blog haskell-mode julia-mode elfeed-protocol ack company magit auctex lsp-mode elpy ## org htmlize leuven-theme lua-mode ess-smart-underscore ess-R-data-view ess)))
89 (custom-set-faces
90  ;; custom-set-faces was added by Custom.
91  ;; If you edit it by hand, you could mess it up, so be careful.
92  ;; Your init file should contain only one such instance.
93  ;; If there is more than one, they won't work right.
94  '(default ((t (:family "Source Code Pro" :foundry "ADBO" :slant normal :weight normal :height 143 :width normal)))))
97 ;; Send mail using SMTP via mail.vanrenterghem.io.
98 (setq send-mail-function    'smtpmail-send-it)
99 (setq smtpmail-smtp-server "mail.vanrenterghem.io"
100       smtpmail-smtp-service 587
101       smtpmail-stream-type 'starttls)
102 (setq user-full-name "Frederik Vanrenterghem"
103       smtpmail-local-domain "vanrenterghem.io"
104       user-mail-address (concat "frederik@" smtpmail-local-domain))
105 (setq mail-default-headers
106       (concat "X-Mailer: GNU Emacs " (symbol-value 'emacs-version))) 
107 (setq w3m-pop-up-frames t)
109 (global-set-key [remap list-buffers] 'ibuffer)
111 ;;; use pass (~/.password-store)
112 ;;; (see The Unix password store)
113 (auth-source-pass-enable)
115 ;; Elfeed news reader from Nextcloud
116 (require 'elfeed)
117 (require 'elfeed-protocol)
119 (setq elfeed-use-curl nil)
120 (elfeed-set-timeout 36000)
121 (setq elfeed-protocol-feeds '(
122             ("owncloud+https://frederik@owncloud.vanrenterghem.biz" :use-authinfo t)
123         ))
124 (elfeed-protocol-enable)
125 (define-key elfeed-search-mode-map (kbd "*") (lambda () (interactive) (apply 'elfeed-search-toggle-all '(star))))
126 (define-key elfeed-show-mode-map (kbd "*") (lambda () (interactive) (apply 'elfeed-show-tag '(star))))
128 ;; Read email using mu4e
129 (require 'mu4e)
130 (setq mail-user-agent 'mu4e-user-agent)
131 (setq mu4e-get-mail-command "mbsync io")
132 (setq mu4e-update-interval 600)
133 (setq mu4e-use-fancy-chars t)
134 (setq mu4e-view-show-images t)
135 (setq mu4e-sent-folder   "/Sent"
136       mu4e-drafts-folder "/Drafts"
137       mu4e-trash-folder  "/Trash")
138                
139 ;; Load configuration for website
140 ;(load "mustache-html")
142 ;; Denote config
143 (setq denote-directory "/home/frederik/Nextcloud/notes/")
145 ;; Dired configuration
146 (with-eval-after-load 'dired
147   (require 'dired-x)
148   ;; Set dired-x global variables here.  For example:
149   ;; (setq dired-x-hands-off-my-keys nil)
150   )
151 (add-hook 'dired-mode-hook
152           (lambda ()
153             ;; Set dired-x buffer-local variables here.
154             (dired-omit-mode 1)
155             (dired-hide-details-mode 1)
156             (nerd-icons-dired-mode 1)
157             ))
158 (setq delete-by-moving-to-trash t)
159 (setq dired-guess-shell-alist-user
160       '(("\\.\\(png\\|jpe?g\\|tiff\\)" "feh" "xdg-open")
161         ("\\.\\(mp[34]\\|m4a\\|ogg\\|flac\\|webm\\|mkv\\)" "mpv" "xdg-open")
162                 (".*" "xdg-open")))
164 ;; Use `vertico' package to get a vertical view of the minibuffer.
165 (setq vertico-resize nil)
166 (vertico-mode 1)
168 ;; Use `marginalia' package.  This will display useful
169 ;; annotations next to entries in the minibuffer.  For example, when
170 ;; using M-x it will show a brief description of the command as well
171 ;; as the keybinding associated with it (if any).
172 (marginalia-mode 1)
174 ;; Use 'winner' mode to undo and redo windows changes
175 ;; using C-c <left> and C-c <right>.
176 (winner-mode 1)