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.
7 (add-to-list 'load-path "~/.emacs.d/lisp/")
9 ;; Use a dark theme now
10 ;(load-theme 'wheatgrass)
13 ;;(load-theme 'leuven t)
14 (require 'modus-themes)
15 (setq modus-themes-mixed-fonts t)
16 (load-theme 'modus-operandi t)
18 (define-key global-map (kbd "<f5>") #'modus-themes-toggle)
21 (setq completion-styles '(orderless basic)
22 completion-category-overrides '((file (styles basic partial-completion))))
24 ;; follow links to version-controlled files without confirming
27 ;; ESS - for working in R
28 (autoload 'R-mode "ess-site.el" "Major mode for editing R source." t)
29 (setq load-path (cons "/usr/share/emacs/site-lisp/ess" load-path))
30 (load "/usr/share/emacs/site-lisp/ess/lisp/ess-site")
31 (setq inferior-julia-program-name "/usr/bin/julia")
33 ;; enable autocomplete
34 (add-hook 'after-init-hook 'global-company-mode)
38 ;; Automatically flow lines based on window width and use
39 ;; variable width fonts in org-mode.
40 (add-hook 'org-mode-hook 'visual-line-mode)
41 (add-hook 'org-mode-hook 'variable-pitch-mode)
44 (load "auctex.el" nil t t)
45 (load "preview-latex.el" nil t t)
47 ;; org-mode support for R and LaTeX
48 (org-babel-do-load-languages
49 'org-babel-load-languages
52 ;; Security risk - This is somewhat ill-advised it appears
53 (setq org-confirm-babel-evaluate nil)
55 ;; Automatically switch to various modes
57 '(("\\.mdwn\\'" . markdown-mode)
58 ("\\.md\\'" . markdown-mode)
59 ("\\.yarn\\'" . markdown-mode)
60 ("\\.js\\'" . js-mode)
61 ("\\.json\\'" . js-mode)
62 ("Makefile" . makefile-mode)
63 ("README" . markdown-mode)
64 ("NEWS" . markdown-mode)
65 ("COMMIT_EDITMSG\\'" . text-mode)
66 ("\\.html\\'" . html-mode)
67 ("\\.css\\'" . css-mode)
68 ("\\.yaml\\'" . yaml-mode)
69 ("\\.yml\\'" . yaml-mode)
70 ("\\.ick\\'" . yaml-mode)
71 ("\\.py\\'" . python-mode)
73 ("\\.org\\'" . org-mode)
74 ("\\.sh\\'" . shell-script-mode)
75 ("\\.hs\\'" . haskell-mode)
76 ("\\.el\\'" . emacs-lisp-mode)))
78 ;; Enable the melpa archive for packages
80 (setq package-enable-at-startup nil)
81 (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
82 (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
83 (add-to-list 'package-archives
84 '("elpy" . "http://jorgenschaefer.github.io/packages/"))
87 ;; custom-set-variables was added by Custom.
88 ;; If you edit it by hand, you could mess it up, so be careful.
89 ;; Your init file should contain only one such instance.
90 ;; If there is more than one, they won't work right.
91 '(browse-url-browser-function 'browse-url-firefox)
93 '("0cf95236abcf59e05b1ea69b4edd53d293a5baec4fe4c3484543fee99bfd2204" "80b00f3bf7cdbdca6c80aadfbbb03145f3d0aacf6bf2a559301e61109954e30a" default))
94 '(denote-directory "/home/frederik/Nextcloud/notes/" t)
95 '(org-export-backends '(ascii html icalendar latex md odt))
96 '(package-selected-packages
97 '(emms mpdel-embark libmpdel pass password-store fontaine osm orderless embark-consult embark consult jinx dired-preview 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)))
99 ;; custom-set-faces was added by Custom.
100 ;; If you edit it by hand, you could mess it up, so be careful.
101 ;; Your init file should contain only one such instance.
102 ;; If there is more than one, they won't work right.
106 ;; Send mail using SMTP via mail.vanrenterghem.io.
107 (setq send-mail-function 'smtpmail-send-it)
108 (setq smtpmail-smtp-server "mail.vanrenterghem.io"
109 smtpmail-smtp-service 587
110 smtpmail-stream-type 'starttls)
111 (setq user-full-name "Frederik Vanrenterghem"
112 smtpmail-local-domain "vanrenterghem.io"
113 user-mail-address (concat "frederik@" smtpmail-local-domain))
114 ;; Ignored in mu4e as it sets user-agent
115 (setq mail-default-headers
116 (concat "X-Mailer: GNU Emacs " (symbol-value 'emacs-version)))
117 (setq w3m-pop-up-frames t)
119 (global-set-key [remap list-buffers] 'ibuffer)
121 ;;; use pass (~/.password-store)
122 ;;; (see The Unix password store)
123 (auth-source-pass-enable)
125 ;; Elfeed news reader from Nextcloud
127 (require 'elfeed-protocol)
129 (setq elfeed-use-curl nil)
130 (elfeed-set-timeout 36000)
131 (setq elfeed-protocol-feeds '(
132 ("owncloud+https://frederik@owncloud.vanrenterghem.biz" :use-authinfo t)
134 (elfeed-protocol-enable)
135 (define-key elfeed-search-mode-map (kbd "*") (lambda () (interactive) (apply 'elfeed-search-toggle-all '(star))))
136 (define-key elfeed-show-mode-map (kbd "*") (lambda () (interactive) (apply 'elfeed-show-tag '(star))))
137 (add-hook 'elfeed-show-mode 'variable-pitch-mode)
139 ;; Read and write email using mu4e
141 (setq mail-user-agent 'mu4e-user-agent)
142 ;; Also use mu4e when called from gnus-dired-attach
143 (setq gnus-dired-mail-mode 'mu4e-user-agent)
144 (setq mu4e-get-mail-command "mbsync io")
145 (setq mu4e-update-interval 600)
146 (setq mu4e-use-fancy-chars t)
147 (setq mu4e-view-show-images t)
148 (setq mu4e-sent-folder "/Sent"
149 mu4e-drafts-folder "/Drafts"
150 mu4e-trash-folder "/Trash")
151 (setq message-kill-buffer-on-exit t)
152 ;; attach files to mu4e messages by marking the file(s) in dired and pressing C-c RET C-a
153 (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
154 ;; Define all bookmarks starting with favourite query used in mailcount modeline
156 '(( :name "Last 24h's messages"
159 :query "date:24h..now AND NOT flag:trashed")
160 ( :name "Unread messages"
161 :query "flag:unread AND NOT flag:trashed"
163 ( :name "Today's messages"
164 :query "date:today..now AND NOT flag:trashed"
166 ( :name "Last 7 days"
167 :query "date:7d..now AND NOT flag:trashed"
170 ( :name "Messages with images"
171 :query "mime:image/* AND NOT flag:trashed"
174 ;; Create custom spam status header and show in message view
175 (add-to-list 'mu4e-header-info-custom
177 ( :name "Spam-Status" ;; long name, as seen in the message-view
178 :shortname "Spam" ;; short name, as seen in the headers view
179 :help "The Spam status" ;; tooltip
180 ;; uses mu4e-fetch-field which is rel. slow, so only appropriate
181 ;; for mu4e-view-fields, and _not_ mu4e-headers-fields
182 :function (lambda (msg)
183 (or (string-join (seq-take (split-string (or (mu4e-fetch-field msg "X-Spam-Status") "") " ") 2) " ") "")))))
184 (add-to-list 'mu4e-view-fields :spam-status)
186 ;; Resize image attachments when sending email
187 (defvar mu4e-resize-image-types '("jpg" "png" "svg" "jpeg")
188 "List of attached image types to resize.")
190 (defvar mu4e-inhibit-resize nil)
192 (defun mu4e-resize-image-attachments ()
193 (unless mu4e-inhibit-resize
196 (mapconcat #'identity mu4e-resize-image-types "\\|")))
198 (message-goto-body-1)
199 (while (re-search-forward
200 (format "<#part.+\\(filename=\"\\)\\(.+\\(\\.%s\\)\\)\""
203 (let* ((infile (match-string-no-properties 2))
204 (outfile (concat (temporary-file-directory)
205 (file-name-nondirectory infile))))
206 (push (format "magick convert %s -resize 1200x1200\\> %s"
207 (shell-quote-argument infile)
208 (shell-quote-argument outfile))
210 (replace-match outfile t t nil 2)))
211 (mapcar #'shell-command cmds)))))
213 (add-hook 'message-send-hook 'mu4e-resize-image-attachments)
215 (defun mu4e-inhibit-resize()
217 (set (make-local-variable 'mu4e-inhibit-resize) t))
219 ;; Load configuration for website
220 ;(load "mustache-html")
223 (setq denote-directory "/home/frederik/Nextcloud/notes/")
225 ;; Dired configuration
226 (with-eval-after-load 'dired
228 ;; Set dired-x global variables here. For example:
229 ;; (setq dired-x-hands-off-my-keys nil)
231 (add-hook 'dired-mode-hook
233 ;; Set dired-x buffer-local variables here.
235 (dired-hide-details-mode 1)
236 (nerd-icons-dired-mode 1)
238 (setq delete-by-moving-to-trash t)
239 (setq dired-guess-shell-alist-user
240 '(("\\.\\(png\\|jpe?g\\|tiff\\)" "feh" "xdg-open")
241 ("\\.\\(mp[34]\\|m4a\\|ogg\\|flac\\|webm\\|mkv\\)" "mpv" "xdg-open")
244 ;; Use `vertico' package to get a vertical view of the minibuffer.
245 (setq vertico-resize nil)
248 ;; Use `marginalia' package. This will display useful
249 ;; annotations next to entries in the minibuffer. For example, when
250 ;; using M-x it will show a brief description of the command as well
251 ;; as the keybinding associated with it (if any).
254 ;; Use 'winner' mode to undo and redo windows changes
255 ;; using C-c <left> and C-c <right>.
258 ;; Use a different spell checker, always
259 (add-hook 'emacs-startup-hook #'global-jinx-mode)
260 (keymap-global-set "M-$" #'jinx-correct)
263 (keymap-global-set "C-." #'embark-act)
264 (keymap-global-set "C-;" #'embark-dwim)
266 ;; Change default bindings to consult- ones
267 (keymap-set ctl-x-map "b" #'consult-buffer)
268 (global-set-key (kbd "M-y") 'consult-yank-pop)
270 ;; Configure `world-clock'
272 (with-eval-after-load 'time
273 (setq zoneinfo-style-world-list '(("Europe/Brussels" "Leuven")))
274 (add-to-list 'zoneinfo-style-world-list '("Australia/Perth" "Perth")))