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 ;; Configure printing using CUPS network printer
17 ;; Enable the melpa archive for packages
20 (setq package-enable-at-startup nil)
21 (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
22 (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
23 (add-to-list 'package-archives
24 '("elpy" . "http://jorgenschaefer.github.io/packages/")))
26 (use-package system-packages
29 (use-package modus-themes
31 :demand t ;; Without this, the theme load is deferred due to the
34 ;; Add all customisation prior to loading the themes
35 (setq modus-themes-mixed-fonts t)
37 (modus-themes-select 'modus-vivendi-tinted)
39 :bind ("<f5>" . modus-themes-toggle))
41 (use-package orderless
44 (setq completion-styles '(orderless basic)
45 completion-category-overrides '((file (styles basic partial-completion)))))
47 ;; follow links to version-controlled files without confirming
50 ;; ESS - for working in R
51 (autoload 'R-mode "ess-site.el" "Major mode for editing R source." t)
52 (setq load-path (cons "/usr/share/emacs/site-lisp/ess" load-path))
53 (load "/usr/share/emacs/site-lisp/ess/lisp/ess-site")
54 (setq inferior-julia-program-name "/usr/bin/julia")
56 ;; enable autocomplete
59 :bind(:map company-active-map
62 ("C-<return>" . company-complete-selection)
63 ([tab] . company-complete-common)
64 ("TAB" . company-complete-common))
66 (global-company-mode 1))
73 (("C-c c" . org-capture)
74 ("C-c l" . org-store-link))
76 (org-default-notes-file "~/Nextcloud/notes/inbox.org")
77 (org-agenda-files `(,org-default-notes-file))
78 (org-capture-bookmark nil)
80 (org-capture-templates
81 '(("f" "Fleeting note" item
82 (file+headline org-default-notes-file "Notes")
83 "- %?\nEntered on %U\n %i\n %a")
84 ("p" "Permanent note" plain
85 (file denote-last-path)
92 (file+headline org-default-notes-file "Tasks")
95 ;; Automatically flow lines based on window width and use
96 ;; variable width fonts in org-mode.
97 (add-hook 'org-mode-hook 'visual-line-mode)
98 (add-hook 'org-mode-hook 'variable-pitch-mode)
99 ;; org-mode support for R and LaTeX
100 (org-babel-do-load-languages
101 'org-babel-load-languages
104 ;; Security risk - This is somewhat ill-advised it appears
105 (setq org-confirm-babel-evaluate nil))
110 (setq TeX-auto-save t
112 TeX-view-program-selection
113 '(((output-dvi has-no-display-manager)
115 ((output-dvi style-pstricks)
118 (output-pdf "PDF Tools")
119 (output-html "xdg-open"))))
120 ;; (load "preview-latex.el" nil t t)
123 ;; Automatically switch to various modes
124 (setq auto-mode-alist
125 '(("\\.mdwn\\'" . markdown-mode)
126 ("\\.md\\'" . markdown-mode)
127 ("\\.yarn\\'" . markdown-mode)
128 ("\\.js\\'" . js-mode)
129 ("\\.json\\'" . js-mode)
130 ("Makefile" . makefile-mode)
131 ("README" . markdown-mode)
132 ("NEWS" . markdown-mode)
133 ("COMMIT_EDITMSG\\'" . text-mode)
134 ("\\.html\\'" . html-mode)
135 ("\\.css\\'" . css-mode)
136 ("\\.yaml\\'" . yaml-mode)
137 ("\\.yml\\'" . yaml-mode)
138 ("\\.ick\\'" . yaml-mode)
139 ("\\.py\\'" . python-mode)
141 ("\\.org\\'" . org-mode)
142 ("\\.tex\\'" . latex-mode)
143 ("\\.sh\\'" . shell-script-mode)
144 ("\\.hs\\'" . haskell-mode)
145 ("\\.el\\'" . emacs-lisp-mode)))
148 (custom-set-variables
149 ;; custom-set-variables was added by Custom.
150 ;; If you edit it by hand, you could mess it up, so be careful.
151 ;; Your init file should contain only one such instance.
152 ;; If there is more than one, they won't work right.
153 '(browse-url-browser-function 'browse-url-firefox)
155 '("8d146df8bd640320d5ca94d2913392bc6f763d5bc2bb47bed8e14975017eea91" "9a977ddae55e0e91c09952e96d614ae0be69727ea78ca145beea1aae01ac78d2" "0cf95236abcf59e05b1ea69b4edd53d293a5baec4fe4c3484543fee99bfd2204" "80b00f3bf7cdbdca6c80aadfbbb03145f3d0aacf6bf2a559301e61109954e30a" default))
156 '(org-export-backends '(ascii html icalendar latex md odt))
157 '(package-selected-packages
158 '(nov eat mu4e ellama 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)))
160 ;; custom-set-faces was added by Custom.
161 ;; If you edit it by hand, you could mess it up, so be careful.
162 ;; Your init file should contain only one such instance.
163 ;; If there is more than one, they won't work right.
167 ;; Send mail using SMTP via mail.vanrenterghem.io.
168 (setq send-mail-function 'smtpmail-send-it)
169 (setq smtpmail-smtp-server "mail.vanrenterghem.io"
170 smtpmail-smtp-service 587
171 smtpmail-stream-type 'starttls)
172 (setq user-full-name "Frederik Vanrenterghem"
173 smtpmail-local-domain "vanrenterghem.io"
174 user-mail-address (concat "frederik@" smtpmail-local-domain))
175 ;; Ignored in mu4e as it sets user-agent
176 (setq mail-default-headers
177 (concat "X-Mailer: GNU Emacs " (symbol-value 'emacs-version)))
178 (setq w3m-pop-up-frames t)
180 (global-set-key [remap list-buffers] 'ibuffer)
182 ;;; use pass (~/.password-store)
183 ;;; (see The Unix password store)
187 (auth-source-pass-enable)
188 (setq pass-username-field "Username"))
190 ;; Elfeed news reader from Nextcloud
194 (setq elfeed-use-curl nil)
195 (elfeed-set-timeout 36000)
196 (define-key elfeed-search-mode-map (kbd "*") (lambda () (interactive) (apply 'elfeed-search-toggle-all '(star))))
197 (define-key elfeed-show-mode-map (kbd "*") (lambda () (interactive) (apply 'elfeed-show-tag '(star))))
198 (add-hook 'elfeed-show-mode 'variable-pitch-mode))
200 (use-package elfeed-protocol
204 (setq elfeed-protocol-feeds '(
205 ("owncloud+https://frederik@owncloud.vanrenterghem.biz" :use-authinfo t)
207 (elfeed-protocol-enable))
210 ;; Read and write email using mu4e
213 ;; :ensure-system-package mu ;; Install from aur
215 (setq mail-user-agent 'mu4e-user-agent)
216 ;; Also use mu4e when called from gnus-dired-attach
217 (setq gnus-dired-mail-mode 'mu4e-user-agent
218 mu4e-get-mail-command "mbsync io"
219 mu4e-update-interval 600
220 mu4e-use-fancy-chars t
221 mu4e-view-show-images t
222 mu4e-sent-folder "/Sent"
223 mu4e-drafts-folder "/Drafts"
224 mu4e-trash-folder "/Trash"
225 message-kill-buffer-on-exit t)
226 ;; attach files to mu4e messages by marking the file(s) in dired and pressing C-c RET C-a
227 (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
228 ;; Define all bookmarks starting with favourite query used in mailcount modeline
230 '(( :name "Last 24h's messages"
233 :query "date:24h..now AND NOT flag:trashed")
234 ( :name "Unread messages"
235 :query "flag:unread AND NOT flag:trashed"
237 ( :name "Today's messages"
238 :query "date:today..now AND NOT flag:trashed"
240 ( :name "Last 7 days"
241 :query "date:7d..now AND NOT flag:trashed"
244 ( :name "Messages with images"
245 :query "mime:image/* AND NOT flag:trashed"
247 ;; Create custom spam status header and show in message view
248 (add-to-list 'mu4e-header-info-custom
250 ( :name "Spam-Status" ;; long name, as seen in the message-view
251 :shortname "Spam" ;; short name, as seen in the headers view
252 :help "The Spam status" ;; tooltip
253 ;; uses mu4e-fetch-field which is rel. slow, so only appropriate
254 ;; for mu4e-view-fields, and _not_ mu4e-headers-fields
255 :function (lambda (msg)
256 (or (string-join (seq-take (split-string (or (mu4e-fetch-field msg "X-Spam-Status") "") " ") 2) " ") "")))))
257 (add-to-list 'mu4e-view-fields :spam-status)
258 ;; Resize image attachments when sending email
259 (defvar mu4e-resize-image-types '("jpg" "png" "svg" "jpeg")
260 "List of attached image types to resize.")
261 (defvar mu4e-inhibit-resize nil)
262 (defun mu4e-resize-image-attachments ()
263 (unless mu4e-inhibit-resize
266 (mapconcat #'identity mu4e-resize-image-types "\\|")))
268 (message-goto-body-1)
269 (while (re-search-forward
270 (format "<#part.+\\(filename=\"\\)\\(.+\\(\\.%s\\)\\)\""
273 (let* ((infile (match-string-no-properties 2))
274 (outfile (concat (temporary-file-directory)
275 (file-name-nondirectory infile))))
276 (push (format "magick convert %s -resize 1200x1200\\> %s"
277 (shell-quote-argument infile)
278 (shell-quote-argument outfile))
280 (replace-match outfile t t nil 2)))
281 (mapcar #'shell-command cmds)))))
282 (add-hook 'message-send-hook 'mu4e-resize-image-attachments)
283 (defun mu4e-inhibit-resize()
285 (set (make-local-variable 'mu4e-inhibit-resize) t)))
287 ;; Load configuration for website
288 ;(load "mustache-html")
294 (setq denote-directory "/home/frederik/Nextcloud/notes/"))
296 (use-package nerd-icons
298 ;; The Nerd Font you want to use in GUI
299 ;; "Symbols Nerd Font Mono" is the default and is recommended
300 ;; but you can use any other Nerd Font if you want
301 ;; (nerd-icons-font-family "Symbols Nerd Font Mono")
304 ;; Dired configuration
305 (with-eval-after-load 'dired
307 ;; Set dired-x global variables here. For example:
308 ;; (setq dired-x-hands-off-my-keys nil)
310 (add-hook 'dired-mode-hook
312 ;; Set dired-x buffer-local variables here.
314 (dired-hide-details-mode 1)
315 (nerd-icons-dired-mode 1)
317 (setq delete-by-moving-to-trash t)
318 (setq dired-guess-shell-alist-user
319 '(("\\.\\(png\\|jpe?g\\|tiff\\)" "feh" "xdg-open")
320 ("\\.\\(mp[34]\\|m4a\\|ogg\\|flac\\|webm\\|mkv\\)" "mpv" "xdg-open")
323 ;; Use `vertico' package to get a vertical view of the minibuffer.
327 (setq vertico-resize nil)
330 ;; Use `marginalia' package. This will display useful
331 ;; annotations next to entries in the minibuffer. For example, when
332 ;; using M-x it will show a brief description of the command as well
333 ;; as the keybinding associated with it (if any).
334 (use-package marginalia
339 ;; Use 'winner' mode to undo and redo windows changes
340 ;; using C-c <left> and C-c <right>.
346 ;; Use a different spell checker, always
350 (keymap-global-set "M-$" #'jinx-correct)
351 :hook (emacs-startup . global-jinx-mode))
358 (keymap-global-set "C-." #'embark-act)
359 (keymap-global-set "C-;" #'embark-dwim))
364 ;; Change default bindings to consult- ones
366 (;; C-x bindings in `ctl-x-map'
367 ("C-x b" . consult-buffer) ;; orig. switch-to-buffer
368 ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
369 ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
370 ;; Other custom bindings
371 ("M-y" . consult-yank-pop))) ;; orig. yank-pop
373 ;; Configure `world-clock'
377 (setq zoneinfo-style-world-list '(("Europe/Brussels" "Leuven")))
378 (add-to-list 'zoneinfo-style-world-list '("Australia/Perth" "Perth")))
381 ;; View PDFs in Emacs
382 (pdf-loader-install) ; On demand loading, leads to faster startup time
383 (setq pdf-misc-print-programm "/usr/bin/lpr")
391 ;; For `eat-eshell-mode'.
392 (add-hook 'eshell-load-hook #'eat-eshell-mode)
393 (setq eshell-visual-commands '()))
399 (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
401 (add-hook 'nov-mode-hook #'variable-pitch-mode))
403 ;; Set some preset fonts
404 (use-package fontaine
407 (setq fontaine-presets
409 :default-family "Iosevka Nerd Font"
411 :variable-pitch-family "Linux Biolinum O"
412 :variable-pitch-weight normal
413 :variable-pitch-height 1.1
414 :italic-family "Iosevka Etoile"
417 :default-family "Iosevka Nerd Font"
419 :variable-pitch-family "Linux Biolinum O"
420 :variable-pitch-weight normal
421 :variable-pitch-height 1.1
422 :italic-family "Iosevka Etoile"
425 :default-family "Fira Mono Nerd Font"
427 :variable-pitch-family "Fira Sans Book"
428 :variable-pitch-weight normal
429 :variable-pitch-height 1.0
432 :default-family "Fira Mono Nerd Font"
434 :variable-pitch-family "Fira Sans Book"
435 :variable-pitch-weight normal
436 :variable-pitch-height 1.0
439 :variable-pitch-family "Libre Baskerville"
440 :variable-pitch-weight normal
441 :variable-pitch-height 1.0
444 :variable-pitch-family "Noto Serif"
445 :variable-pitch-weight normal
446 :variable-pitch-height 1.0
449 :variable-pitch-family "ETBembo"
450 :variable-pitch-weight normal
451 :variable-pitch-height 1.1
454 :variable-pitch-family "Literata"
455 :variable-pitch-weight normal
456 :variable-pitch-height 1.0
461 ;; Might want to run this automatically
462 ;; using variable after-focus-change-function
463 (defun my/adjust-font-size-based-on-display ()
464 "Change size of fonts based on monitor."
466 (let* ((display-name (cdr (assq 'name (frame-monitor-attributes))))
467 (font-height (cond ((string-equal display-name "eDP-1") 140)
470 (set-face-attribute 'default (selected-frame) :height font-height)))