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/")
11 ;; Enable the melpa archive for packages
14 (setq package-enable-at-startup nil)
15 (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
16 (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
17 (add-to-list 'package-archives
18 '("elpy" . "http://jorgenschaefer.github.io/packages/")))
20 (use-package system-packages
23 (use-package modus-themes
25 :demand t ;; Without this, the theme load is deferred due to the
28 ;; Add all customisation prior to loading the themes
29 (setq modus-themes-mixed-fonts t)
31 (modus-themes-select 'modus-vivendi-tinted)
33 :bind ("<f5>" . modus-themes-toggle))
35 (use-package orderless
38 (setq completion-styles '(orderless basic)
39 completion-category-overrides '((file (styles basic partial-completion)))))
41 ;; follow links to version-controlled files without confirming
44 ;; ESS - for working in R
45 (autoload 'R-mode "ess-site.el" "Major mode for editing R source." t)
46 (setq load-path (cons "/usr/share/emacs/site-lisp/ess" load-path))
47 (load "/usr/share/emacs/site-lisp/ess/lisp/ess-site")
48 (setq inferior-julia-program-name "/usr/bin/julia")
50 ;; enable autocomplete
53 :bind(:map company-active-map
56 ("C-<return>" . company-complete-selection)
57 ([tab] . company-complete-common)
58 ("TAB" . company-complete-common))
60 (global-company-mode 1))
65 ;; Automatically flow lines based on window width and use
66 ;; variable width fonts in org-mode.
67 (add-hook 'org-mode-hook 'visual-line-mode)
68 (add-hook 'org-mode-hook 'variable-pitch-mode)
69 ;; org-mode support for R and LaTeX
70 (org-babel-do-load-languages
71 'org-babel-load-languages
74 ;; Security risk - This is somewhat ill-advised it appears
75 (setq org-confirm-babel-evaluate nil))
82 TeX-view-program-selection
83 '(((output-dvi has-no-display-manager)
85 ((output-dvi style-pstricks)
88 (output-pdf "PDF Tools")
89 (output-html "xdg-open"))))
90 ;; (load "preview-latex.el" nil t t)
93 ;; Automatically switch to various modes
95 '(("\\.mdwn\\'" . markdown-mode)
96 ("\\.md\\'" . markdown-mode)
97 ("\\.yarn\\'" . markdown-mode)
98 ("\\.js\\'" . js-mode)
99 ("\\.json\\'" . js-mode)
100 ("Makefile" . makefile-mode)
101 ("README" . markdown-mode)
102 ("NEWS" . markdown-mode)
103 ("COMMIT_EDITMSG\\'" . text-mode)
104 ("\\.html\\'" . html-mode)
105 ("\\.css\\'" . css-mode)
106 ("\\.yaml\\'" . yaml-mode)
107 ("\\.yml\\'" . yaml-mode)
108 ("\\.ick\\'" . yaml-mode)
109 ("\\.py\\'" . python-mode)
111 ("\\.org\\'" . org-mode)
112 ("\\.tex\\'" . latex-mode)
113 ("\\.sh\\'" . shell-script-mode)
114 ("\\.hs\\'" . haskell-mode)
115 ("\\.el\\'" . emacs-lisp-mode)))
118 (custom-set-variables
119 ;; custom-set-variables was added by Custom.
120 ;; If you edit it by hand, you could mess it up, so be careful.
121 ;; Your init file should contain only one such instance.
122 ;; If there is more than one, they won't work right.
123 '(browse-url-browser-function 'browse-url-firefox)
125 '("8d146df8bd640320d5ca94d2913392bc6f763d5bc2bb47bed8e14975017eea91" "9a977ddae55e0e91c09952e96d614ae0be69727ea78ca145beea1aae01ac78d2" "0cf95236abcf59e05b1ea69b4edd53d293a5baec4fe4c3484543fee99bfd2204" "80b00f3bf7cdbdca6c80aadfbbb03145f3d0aacf6bf2a559301e61109954e30a" default))
126 '(org-export-backends '(ascii html icalendar latex md odt))
127 '(package-selected-packages
128 '(eat ellama emms mpdel-embark libmpdel pass password-store fontaine osm embark-consult embark consult jinx dired-preview ftable flx nerd-icons-dired nerd-icons all-the-icons-dired ox-rss org-ql org-contrib mustache org-static-blog haskell-mode julia-mode elfeed-protocol ack auctex lsp-mode elpy ## org htmlize leuven-theme lua-mode ess-smart-underscore ess-R-data-view ess)))
130 ;; custom-set-faces was added by Custom.
131 ;; If you edit it by hand, you could mess it up, so be careful.
132 ;; Your init file should contain only one such instance.
133 ;; If there is more than one, they won't work right.
137 ;; Send mail using SMTP via mail.vanrenterghem.io.
138 (setq send-mail-function 'smtpmail-send-it)
139 (setq smtpmail-smtp-server "mail.vanrenterghem.io"
140 smtpmail-smtp-service 587
141 smtpmail-stream-type 'starttls)
142 (setq user-full-name "Frederik Vanrenterghem"
143 smtpmail-local-domain "vanrenterghem.io"
144 user-mail-address (concat "frederik@" smtpmail-local-domain))
145 ;; Ignored in mu4e as it sets user-agent
146 (setq mail-default-headers
147 (concat "X-Mailer: GNU Emacs " (symbol-value 'emacs-version)))
148 (setq w3m-pop-up-frames t)
150 (global-set-key [remap list-buffers] 'ibuffer)
152 ;;; use pass (~/.password-store)
153 ;;; (see The Unix password store)
157 (auth-source-pass-enable)
158 (setq pass-username-field "Username"))
160 ;; Elfeed news reader from Nextcloud
164 (setq elfeed-use-curl nil)
165 (elfeed-set-timeout 36000)
166 (define-key elfeed-search-mode-map (kbd "*") (lambda () (interactive) (apply 'elfeed-search-toggle-all '(star))))
167 (define-key elfeed-show-mode-map (kbd "*") (lambda () (interactive) (apply 'elfeed-show-tag '(star))))
168 (add-hook 'elfeed-show-mode 'variable-pitch-mode))
170 (use-package elfeed-protocol
174 (setq elfeed-protocol-feeds '(
175 ("owncloud+https://frederik@owncloud.vanrenterghem.biz" :use-authinfo t)
177 (elfeed-protocol-enable))
180 ;; Read and write email using mu4e
183 ;; :ensure-system-package mu ;; Install from aur
185 (setq mail-user-agent 'mu4e-user-agent)
186 ;; Also use mu4e when called from gnus-dired-attach
187 (setq gnus-dired-mail-mode 'mu4e-user-agent
188 mu4e-get-mail-command "mbsync io"
189 mu4e-update-interval 600
190 mu4e-use-fancy-chars t
191 mu4e-view-show-images t
192 mu4e-sent-folder "/Sent"
193 mu4e-drafts-folder "/Drafts"
194 mu4e-trash-folder "/Trash"
195 message-kill-buffer-on-exit t)
196 ;; attach files to mu4e messages by marking the file(s) in dired and pressing C-c RET C-a
197 (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
198 ;; Define all bookmarks starting with favourite query used in mailcount modeline
200 '(( :name "Last 24h's messages"
203 :query "date:24h..now AND NOT flag:trashed")
204 ( :name "Unread messages"
205 :query "flag:unread AND NOT flag:trashed"
207 ( :name "Today's messages"
208 :query "date:today..now AND NOT flag:trashed"
210 ( :name "Last 7 days"
211 :query "date:7d..now AND NOT flag:trashed"
214 ( :name "Messages with images"
215 :query "mime:image/* AND NOT flag:trashed"
217 ;; Create custom spam status header and show in message view
218 (add-to-list 'mu4e-header-info-custom
220 ( :name "Spam-Status" ;; long name, as seen in the message-view
221 :shortname "Spam" ;; short name, as seen in the headers view
222 :help "The Spam status" ;; tooltip
223 ;; uses mu4e-fetch-field which is rel. slow, so only appropriate
224 ;; for mu4e-view-fields, and _not_ mu4e-headers-fields
225 :function (lambda (msg)
226 (or (string-join (seq-take (split-string (or (mu4e-fetch-field msg "X-Spam-Status") "") " ") 2) " ") "")))))
227 (add-to-list 'mu4e-view-fields :spam-status)
228 ;; Resize image attachments when sending email
229 (defvar mu4e-resize-image-types '("jpg" "png" "svg" "jpeg")
230 "List of attached image types to resize.")
231 (defvar mu4e-inhibit-resize nil)
232 (defun mu4e-resize-image-attachments ()
233 (unless mu4e-inhibit-resize
236 (mapconcat #'identity mu4e-resize-image-types "\\|")))
238 (message-goto-body-1)
239 (while (re-search-forward
240 (format "<#part.+\\(filename=\"\\)\\(.+\\(\\.%s\\)\\)\""
243 (let* ((infile (match-string-no-properties 2))
244 (outfile (concat (temporary-file-directory)
245 (file-name-nondirectory infile))))
246 (push (format "magick convert %s -resize 1200x1200\\> %s"
247 (shell-quote-argument infile)
248 (shell-quote-argument outfile))
250 (replace-match outfile t t nil 2)))
251 (mapcar #'shell-command cmds)))))
252 (add-hook 'message-send-hook 'mu4e-resize-image-attachments)
253 (defun mu4e-inhibit-resize()
255 (set (make-local-variable 'mu4e-inhibit-resize) t)))
257 ;; Load configuration for website
258 ;(load "mustache-html")
264 (setq denote-directory "/home/frederik/Nextcloud/notes/"))
266 (use-package nerd-icons
268 ;; The Nerd Font you want to use in GUI
269 ;; "Symbols Nerd Font Mono" is the default and is recommended
270 ;; but you can use any other Nerd Font if you want
271 ;; (nerd-icons-font-family "Symbols Nerd Font Mono")
274 ;; Dired configuration
275 (with-eval-after-load 'dired
277 ;; Set dired-x global variables here. For example:
278 ;; (setq dired-x-hands-off-my-keys nil)
280 (add-hook 'dired-mode-hook
282 ;; Set dired-x buffer-local variables here.
284 (dired-hide-details-mode 1)
285 (nerd-icons-dired-mode 1)
287 (setq delete-by-moving-to-trash t)
288 (setq dired-guess-shell-alist-user
289 '(("\\.\\(png\\|jpe?g\\|tiff\\)" "feh" "xdg-open")
290 ("\\.\\(mp[34]\\|m4a\\|ogg\\|flac\\|webm\\|mkv\\)" "mpv" "xdg-open")
293 ;; Use `vertico' package to get a vertical view of the minibuffer.
297 (setq vertico-resize nil)
300 ;; Use `marginalia' package. This will display useful
301 ;; annotations next to entries in the minibuffer. For example, when
302 ;; using M-x it will show a brief description of the command as well
303 ;; as the keybinding associated with it (if any).
304 (use-package marginalia
309 ;; Use 'winner' mode to undo and redo windows changes
310 ;; using C-c <left> and C-c <right>.
316 ;; Use a different spell checker, always
320 (keymap-global-set "M-$" #'jinx-correct)
321 :hook (emacs-startup . global-jinx-mode))
328 (keymap-global-set "C-." #'embark-act)
329 (keymap-global-set "C-;" #'embark-dwim))
334 ;; Change default bindings to consult- ones
336 (;; C-x bindings in `ctl-x-map'
337 ("C-x b" . consult-buffer) ;; orig. switch-to-buffer
338 ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
339 ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
340 ;; Other custom bindings
341 ("M-y" . consult-yank-pop))) ;; orig. yank-pop
343 ;; Configure `world-clock'
347 (setq zoneinfo-style-world-list '(("Europe/Brussels" "Leuven")))
348 (add-to-list 'zoneinfo-style-world-list '("Australia/Perth" "Perth")))
351 ;; View PDFs in Emacs
352 (pdf-loader-install) ; On demand loading, leads to faster startup time
360 ;; For `eat-eshell-mode'.
361 (add-hook 'eshell-load-hook #'eat-eshell-mode)
362 (setq eshell-visual-commands '()))
366 ;; Might want to run this automatically
367 ;; using variable after-focus-change-function
368 (defun my/adjust-font-size-based-on-display ()
369 "Change size of fonts based on monitor."
371 (let* ((display-name (cdr (assq 'name (frame-monitor-attributes))))
372 (font-height (cond ((string-equal display-name "eDP-1") 140)
375 (set-face-attribute 'default (selected-frame) :height font-height)))