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
16 ;; Enable the melpa archive for packages
19 (setq package-enable-at-startup nil)
20 (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
21 (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
22 (add-to-list 'package-archives
23 '("elpy" . "http://jorgenschaefer.github.io/packages/")))
25 (use-package system-packages
28 (use-package modus-themes
30 :demand t ;; Without this, the theme load is deferred due to the
33 ;; Add all customisation prior to loading the themes
34 (setq modus-themes-mixed-fonts t)
36 (modus-themes-select 'modus-vivendi-tinted)
38 :bind ("<f5>" . modus-themes-toggle))
40 (use-package orderless
43 (setq completion-styles '(orderless basic)
44 completion-category-overrides '((file (styles basic partial-completion)))))
46 ;; follow links to version-controlled files without confirming
49 ;; ESS - for working in R
50 (autoload 'R-mode "ess-site.el" "Major mode for editing R source." t)
51 (setq load-path (cons "/usr/share/emacs/site-lisp/ess" load-path))
52 (load "/usr/share/emacs/site-lisp/ess/lisp/ess-site")
53 (setq inferior-julia-program-name "/usr/bin/julia")
55 ;; enable autocomplete
58 :bind(:map company-active-map
61 ("C-<return>" . company-complete-selection)
62 ([tab] . company-complete-common)
63 ("TAB" . company-complete-common))
65 (global-company-mode 1))
72 (("C-c c" . org-capture)
73 ("C-c l" . org-store-link))
75 (org-default-notes-file "~/Nextcloud/notes/inbox.org")
76 (org-capture-bookmark nil)
78 (org-capture-templates
79 '(("f" "Fleeting note" item
80 (file+headline org-default-notes-file "Notes")
81 "- %?\nEntered on %U\n %i\n %a")
82 ("p" "Permanent note" plain
83 (file denote-last-path)
90 (file+headline org-default-notes-file "Tasks")
93 ;; Automatically flow lines based on window width and use
94 ;; variable width fonts in org-mode.
95 (add-hook 'org-mode-hook 'visual-line-mode)
96 (add-hook 'org-mode-hook 'variable-pitch-mode)
97 ;; org-mode support for R and LaTeX
98 (org-babel-do-load-languages
99 'org-babel-load-languages
102 ;; Security risk - This is somewhat ill-advised it appears
103 (setq org-confirm-babel-evaluate nil))
108 (setq TeX-auto-save t
110 TeX-view-program-selection
111 '(((output-dvi has-no-display-manager)
113 ((output-dvi style-pstricks)
116 (output-pdf "PDF Tools")
117 (output-html "xdg-open"))))
118 ;; (load "preview-latex.el" nil t t)
121 ;; Automatically switch to various modes
122 (setq auto-mode-alist
123 '(("\\.mdwn\\'" . markdown-mode)
124 ("\\.md\\'" . markdown-mode)
125 ("\\.yarn\\'" . markdown-mode)
126 ("\\.js\\'" . js-mode)
127 ("\\.json\\'" . js-mode)
128 ("Makefile" . makefile-mode)
129 ("README" . markdown-mode)
130 ("NEWS" . markdown-mode)
131 ("COMMIT_EDITMSG\\'" . text-mode)
132 ("\\.html\\'" . html-mode)
133 ("\\.css\\'" . css-mode)
134 ("\\.yaml\\'" . yaml-mode)
135 ("\\.yml\\'" . yaml-mode)
136 ("\\.ick\\'" . yaml-mode)
137 ("\\.py\\'" . python-mode)
139 ("\\.org\\'" . org-mode)
140 ("\\.tex\\'" . latex-mode)
141 ("\\.sh\\'" . shell-script-mode)
142 ("\\.hs\\'" . haskell-mode)
143 ("\\.el\\'" . emacs-lisp-mode)))
146 (custom-set-variables
147 ;; custom-set-variables was added by Custom.
148 ;; If you edit it by hand, you could mess it up, so be careful.
149 ;; Your init file should contain only one such instance.
150 ;; If there is more than one, they won't work right.
151 '(browse-url-browser-function 'browse-url-firefox)
153 '("8d146df8bd640320d5ca94d2913392bc6f763d5bc2bb47bed8e14975017eea91" "9a977ddae55e0e91c09952e96d614ae0be69727ea78ca145beea1aae01ac78d2" "0cf95236abcf59e05b1ea69b4edd53d293a5baec4fe4c3484543fee99bfd2204" "80b00f3bf7cdbdca6c80aadfbbb03145f3d0aacf6bf2a559301e61109954e30a" default))
154 '(org-export-backends '(ascii html icalendar latex md odt))
155 '(package-selected-packages
156 '(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)))
158 ;; custom-set-faces was added by Custom.
159 ;; If you edit it by hand, you could mess it up, so be careful.
160 ;; Your init file should contain only one such instance.
161 ;; If there is more than one, they won't work right.
165 ;; Send mail using SMTP via mail.vanrenterghem.io.
166 (setq send-mail-function 'smtpmail-send-it)
167 (setq smtpmail-smtp-server "mail.vanrenterghem.io"
168 smtpmail-smtp-service 587
169 smtpmail-stream-type 'starttls)
170 (setq user-full-name "Frederik Vanrenterghem"
171 smtpmail-local-domain "vanrenterghem.io"
172 user-mail-address (concat "frederik@" smtpmail-local-domain))
173 ;; Ignored in mu4e as it sets user-agent
174 (setq mail-default-headers
175 (concat "X-Mailer: GNU Emacs " (symbol-value 'emacs-version)))
176 (setq w3m-pop-up-frames t)
178 (global-set-key [remap list-buffers] 'ibuffer)
180 ;;; use pass (~/.password-store)
181 ;;; (see The Unix password store)
185 (auth-source-pass-enable)
186 (setq pass-username-field "Username"))
188 ;; Elfeed news reader from Nextcloud
192 (setq elfeed-use-curl nil)
193 (elfeed-set-timeout 36000)
194 (define-key elfeed-search-mode-map (kbd "*") (lambda () (interactive) (apply 'elfeed-search-toggle-all '(star))))
195 (define-key elfeed-show-mode-map (kbd "*") (lambda () (interactive) (apply 'elfeed-show-tag '(star))))
196 (add-hook 'elfeed-show-mode 'variable-pitch-mode))
198 (use-package elfeed-protocol
202 (setq elfeed-protocol-feeds '(
203 ("owncloud+https://frederik@owncloud.vanrenterghem.biz" :use-authinfo t)
205 (elfeed-protocol-enable))
208 ;; Read and write email using mu4e
211 ;; :ensure-system-package mu ;; Install from aur
213 (setq mail-user-agent 'mu4e-user-agent)
214 ;; Also use mu4e when called from gnus-dired-attach
215 (setq gnus-dired-mail-mode 'mu4e-user-agent
216 mu4e-get-mail-command "mbsync io"
217 mu4e-update-interval 600
218 mu4e-use-fancy-chars t
219 mu4e-view-show-images t
220 mu4e-sent-folder "/Sent"
221 mu4e-drafts-folder "/Drafts"
222 mu4e-trash-folder "/Trash"
223 message-kill-buffer-on-exit t)
224 ;; attach files to mu4e messages by marking the file(s) in dired and pressing C-c RET C-a
225 (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
226 ;; Define all bookmarks starting with favourite query used in mailcount modeline
228 '(( :name "Last 24h's messages"
231 :query "date:24h..now AND NOT flag:trashed")
232 ( :name "Unread messages"
233 :query "flag:unread AND NOT flag:trashed"
235 ( :name "Today's messages"
236 :query "date:today..now AND NOT flag:trashed"
238 ( :name "Last 7 days"
239 :query "date:7d..now AND NOT flag:trashed"
242 ( :name "Messages with images"
243 :query "mime:image/* AND NOT flag:trashed"
245 ;; Create custom spam status header and show in message view
246 (add-to-list 'mu4e-header-info-custom
248 ( :name "Spam-Status" ;; long name, as seen in the message-view
249 :shortname "Spam" ;; short name, as seen in the headers view
250 :help "The Spam status" ;; tooltip
251 ;; uses mu4e-fetch-field which is rel. slow, so only appropriate
252 ;; for mu4e-view-fields, and _not_ mu4e-headers-fields
253 :function (lambda (msg)
254 (or (string-join (seq-take (split-string (or (mu4e-fetch-field msg "X-Spam-Status") "") " ") 2) " ") "")))))
255 (add-to-list 'mu4e-view-fields :spam-status)
256 ;; Resize image attachments when sending email
257 (defvar mu4e-resize-image-types '("jpg" "png" "svg" "jpeg")
258 "List of attached image types to resize.")
259 (defvar mu4e-inhibit-resize nil)
260 (defun mu4e-resize-image-attachments ()
261 (unless mu4e-inhibit-resize
264 (mapconcat #'identity mu4e-resize-image-types "\\|")))
266 (message-goto-body-1)
267 (while (re-search-forward
268 (format "<#part.+\\(filename=\"\\)\\(.+\\(\\.%s\\)\\)\""
271 (let* ((infile (match-string-no-properties 2))
272 (outfile (concat (temporary-file-directory)
273 (file-name-nondirectory infile))))
274 (push (format "magick convert %s -resize 1200x1200\\> %s"
275 (shell-quote-argument infile)
276 (shell-quote-argument outfile))
278 (replace-match outfile t t nil 2)))
279 (mapcar #'shell-command cmds)))))
280 (add-hook 'message-send-hook 'mu4e-resize-image-attachments)
281 (defun mu4e-inhibit-resize()
283 (set (make-local-variable 'mu4e-inhibit-resize) t)))
285 ;; Load configuration for website
286 ;(load "mustache-html")
292 (setq denote-directory "/home/frederik/Nextcloud/notes/"))
294 (use-package nerd-icons
296 ;; The Nerd Font you want to use in GUI
297 ;; "Symbols Nerd Font Mono" is the default and is recommended
298 ;; but you can use any other Nerd Font if you want
299 ;; (nerd-icons-font-family "Symbols Nerd Font Mono")
302 ;; Dired configuration
303 (with-eval-after-load 'dired
305 ;; Set dired-x global variables here. For example:
306 ;; (setq dired-x-hands-off-my-keys nil)
308 (add-hook 'dired-mode-hook
310 ;; Set dired-x buffer-local variables here.
312 (dired-hide-details-mode 1)
313 (nerd-icons-dired-mode 1)
315 (setq delete-by-moving-to-trash t)
316 (setq dired-guess-shell-alist-user
317 '(("\\.\\(png\\|jpe?g\\|tiff\\)" "feh" "xdg-open")
318 ("\\.\\(mp[34]\\|m4a\\|ogg\\|flac\\|webm\\|mkv\\)" "mpv" "xdg-open")
321 ;; Use `vertico' package to get a vertical view of the minibuffer.
325 (setq vertico-resize nil)
328 ;; Use `marginalia' package. This will display useful
329 ;; annotations next to entries in the minibuffer. For example, when
330 ;; using M-x it will show a brief description of the command as well
331 ;; as the keybinding associated with it (if any).
332 (use-package marginalia
337 ;; Use 'winner' mode to undo and redo windows changes
338 ;; using C-c <left> and C-c <right>.
344 ;; Use a different spell checker, always
348 (keymap-global-set "M-$" #'jinx-correct)
349 :hook (emacs-startup . global-jinx-mode))
356 (keymap-global-set "C-." #'embark-act)
357 (keymap-global-set "C-;" #'embark-dwim))
362 ;; Change default bindings to consult- ones
364 (;; C-x bindings in `ctl-x-map'
365 ("C-x b" . consult-buffer) ;; orig. switch-to-buffer
366 ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
367 ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
368 ;; Other custom bindings
369 ("M-y" . consult-yank-pop))) ;; orig. yank-pop
371 ;; Configure `world-clock'
375 (setq zoneinfo-style-world-list '(("Europe/Brussels" "Leuven")))
376 (add-to-list 'zoneinfo-style-world-list '("Australia/Perth" "Perth")))
379 ;; View PDFs in Emacs
380 (pdf-loader-install) ; On demand loading, leads to faster startup time
388 ;; For `eat-eshell-mode'.
389 (add-hook 'eshell-load-hook #'eat-eshell-mode)
390 (setq eshell-visual-commands '()))
396 (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
398 (add-hook 'nov-mode-hook #'variable-pitch-mode))
400 ;; Set some preset fonts
401 (use-package fontaine
404 (setq fontaine-presets
406 :default-family "Iosevka Nerd Font"
408 :variable-pitch-family "Linux Biolinum O"
409 :variable-pitch-weight normal
410 :variable-pitch-height 1.1
411 :italic-family "Iosevka Etoile"
414 :default-family "Iosevka Nerd Font"
416 :variable-pitch-family "Linux Biolinum O"
417 :variable-pitch-weight normal
418 :variable-pitch-height 1.1
419 :italic-family "Iosevka Etoile"
422 :default-family "Fira Mono Nerd Font"
424 :variable-pitch-family "Fira Sans Book"
425 :variable-pitch-weight normal
426 :variable-pitch-height 1.0
429 :default-family "Fira Mono Nerd Font"
431 :variable-pitch-family "Fira Sans Book"
432 :variable-pitch-weight normal
433 :variable-pitch-height 1.0
436 :variable-pitch-family "Libre Baskerville"
437 :variable-pitch-weight normal
438 :variable-pitch-height 1.0
441 :variable-pitch-family "Noto Serif"
442 :variable-pitch-weight normal
443 :variable-pitch-height 1.0
446 :variable-pitch-family "ETBembo"
447 :variable-pitch-weight normal
448 :variable-pitch-height 1.1
451 :variable-pitch-family "Literata"
452 :variable-pitch-weight normal
453 :variable-pitch-height 1.0
458 ;; Might want to run this automatically
459 ;; using variable after-focus-change-function
460 (defun my/adjust-font-size-based-on-display ()
461 "Change size of fonts based on monitor."
463 (let* ((display-name (cdr (assq 'name (frame-monitor-attributes))))
464 (font-height (cond ((string-equal display-name "eDP-1") 140)
467 (set-face-attribute 'default (selected-frame) :height font-height)))