]> git.vanrenterghem.biz Git - Dotty.git/blob - emacs/.emacs.d/init.el
Improve Org drawing and calendar configuration.
[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 (tool-bar-mode -1)
10 (scroll-bar-mode -1)
12 (setopt custom-file "~/.emacs.d/custom.el")
13 (load custom-file)
15 ;; Configure printing using CUPS network printer
16 (setq lpr-switches
17       (append '("-o raw"
18                 "-o media=A4")
19               lpr-switches))
21 ;; Enable the melpa archive for packages
22 (use-package package
23   :config
24   (setq package-enable-at-startup nil)
25   (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
26   (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
27   (add-to-list 'package-archives
28                '("elpy" . "http://jorgenschaefer.github.io/packages/")))
30 (use-package system-packages
31   :ensure t)
33 (use-package modus-themes
34   :ensure t
35   :demand t ;; Without this, the theme load is deferred due to the
36             ;; bind keyword below
37   :init
38   ;; Add all customisation prior to loading the themes
39   (setq modus-themes-mixed-fonts t)
40   :config
41   (modus-themes-select 'modus-vivendi-tinted)
42   (variable-pitch-mode)
43   :bind ("<f5>" . modus-themes-toggle))
45 (use-package orderless
46   :ensure t
47   :config
48   (setq completion-styles '(orderless basic)
49         completion-category-overrides '((file (styles basic partial-completion)))))
51 ;; follow links to version-controlled files without confirming
52 vc-follow-symlinks t
54 ;; ESS - for working in R
55 (autoload 'R-mode "ess-site.el" "Major mode for editing R source." t)
56 (setq load-path (cons "/usr/share/emacs/site-lisp/ess" load-path))
57 (load "/usr/share/emacs/site-lisp/ess/lisp/ess-site")
58 (setq inferior-julia-program-name "/usr/bin/julia")
60 (use-package ess-view-data
61   :ensure t)
63 ;; Configure Tempel
64 (use-package tempel
65   :ensure t
66   ;; Require trigger prefix before template name when completing.
67   ;; :custom
68   ;; (tempel-trigger-prefix "<")
70   :bind (("M-+" . tempel-complete) ;; Alternative tempel-expand
71          ("M-*" . tempel-insert))
73   :init
75   ;; Setup completion at point
76   (defun tempel-setup-capf ()
77     ;; Add the Tempel Capf to `completion-at-point-functions'.
78     ;; `tempel-expand' only triggers on exact matches. Alternatively use
79     ;; `tempel-complete' if you want to see all matches, but then you
80     ;; should also configure `tempel-trigger-prefix', such that Tempel
81     ;; does not trigger too often when you don't expect it. NOTE: We add
82     ;; `tempel-expand' *before* the main programming mode Capf, such
83     ;; that it will be tried first.
84     (setq-local completion-at-point-functions
85                 (cons #'tempel-expand
86                       completion-at-point-functions)))
88   (add-hook 'conf-mode-hook 'tempel-setup-capf)
89   (add-hook 'prog-mode-hook 'tempel-setup-capf)
90   (add-hook 'text-mode-hook 'tempel-setup-capf)
92   ;; Optionally make the Tempel templates available to Abbrev,
93   ;; either locally or globally. `expand-abbrev' is bound to C-x '.
94   ;; (add-hook 'prog-mode-hook #'tempel-abbrev-mode)
95   ;; (global-tempel-abbrev-mode)
96 )
98 ;; Optional: Add tempel-collection.
99 ;; The package is young and doesn't have comprehensive coverage.
100 (use-package tempel-collection
101   :ensure t
102   :after tempel)
104 ;; enable autocomplete
105 (use-package corfu
106   :ensure t
107   ;; Optional customizations
108   :custom
109   (corfu-cycle t)                ;; Enable cycling for `corfu-next/previous'
110   (corfu-auto t)                 ;; Enable auto completion
111   ;; (corfu-separator ?\s)          ;; Orderless field separator
112   ;; (corfu-quit-at-boundary nil)   ;; Never quit at completion boundary
113   ;; (corfu-quit-no-match nil)      ;; Never quit, even if there is no match
114   ;; (corfu-preview-current nil)    ;; Disable current candidate preview
115   ;; (corfu-preselect 'prompt)      ;; Preselect the prompt
116   ;; (corfu-on-exact-match nil)     ;; Configure handling of exact matches
117   ;; (corfu-scroll-margin 5)        ;; Use scroll margin
119   ;; Enable Corfu only for certain modes. See also `global-corfu-modes'.
120   ;; :hook ((prog-mode . corfu-mode)
121   ;;        (shell-mode . corfu-mode)
122   ;;        (eshell-mode . corfu-mode))
124   ;; Recommended: Enable Corfu globally.  This is recommended since Dabbrev can
125   ;; be used globally (M-/).  See also the customization variable
126   ;; `global-corfu-modes' to exclude certain modes.
127   :init
128   (global-corfu-mode)
129   (corfu-history-mode))
131 (use-package cape
132   :ensure t
133   ;; Bind prefix keymap providing all Cape commands under a mnemonic key.
134   ;; Press C-c p ? to for help.
135   :bind ("C-c p" . cape-prefix-map) ;; Alternative keys: M-p, M-+, ...
136   ;; Alternatively bind Cape commands individually.
137   ;; :bind (("C-c p d" . cape-dabbrev)
138   ;;        ("C-c p h" . cape-history)
139   ;;        ("C-c p f" . cape-file)
140   ;;        ...)
141   :init
142   ;; Add to the global default value of `completion-at-point-functions' which is
143   ;; used by `completion-at-point'.  The order of the functions matters, the
144   ;; first function returning a result wins.  Note that the list of buffer-local
145   ;; completion functions takes precedence over the global list.
146   (add-hook 'completion-at-point-functions #'cape-dict) ;; requires words package to be installed on Arch to provide /usr/share/dict/words
147   (add-hook 'completion-at-point-functions #'cape-dabbrev)
148   (add-hook 'completion-at-point-functions #'cape-file) 
149   (add-hook 'completion-at-point-functions #'cape-elisp-block)
150   ;; (add-hook 'completion-at-point-functions #'cape-history)
151   ;; ...
152   )
154 (use-package gnuplot
155   :ensure t)
157 (use-package org
158   :ensure t
159   :bind
160   (("C-c c" . org-capture)
161    ("C-c l" . org-store-link)
162    ("C-c a" . org-agenda))
163   :custom
164   (org-default-notes-file "~/Nextcloud/notes/inbox.org")
165   (org-agenda-files `(,org-default-notes-file "~/Nextcloud/notes/calendar-nextcloud.org"))
166   (org-capture-bookmark nil)
167   ;; Capture templates
168   (org-capture-templates
169    '(("f" "Fleeting note" entry
170       (file+headline org-default-notes-file "Notes")
171       "* %?\nEntered on %U\n  %i\n  %a")
172      ("b" "Tax receipt" item
173       (file "~/Documents/belastingen/FY24-25.org")
174       "* %t %a\n")
175      ("a" "Appointment" entry
176            (file+olp+datetree "~/Nextcloud/notes/calendar-nextcloud.org")
177            "* %?\n :PROPERTIES:\n :location: %^{Location}\n :END:\n%(fv/org-capture-appointment-timestamp)\n\n"
178            :jump-to-captured t
179            :empty-lines 1
180            :tree-type month
181            :time-prompt t)
182      ("p" "Permanent note" plain
183       (file denote-last-path)
184       #'denote-org-capture
185       :no-save t
186       :immediate-finish nil
187       :kill-buffer t
188       :jump-to-captured t)
189      ("t" "New task" entry
190       (file+headline org-default-notes-file "Tasks")
191       "* TODO %i%?")
192      ("e" "Email follow-up" entry (file+headline org-default-notes-file "Tasks")
193       "* TODO %:fromname: %a %?\nDEADLINE: %(org-insert-time-stamp (org-read-date nil t \"+2d\") t)")))
194   ;; Agenda views
195   (org-agenda-custom-commands
196    '(("P" "Expired calendar events" ((tags "TIMESTAMP<=\"<now>\"")))
197      ("n" "Agenda and all TODOs"  ((agenda "") (alltodo "")))))
198   :config
199   ;; Configure refile
200   (defun my/opened-buffer-files ()
201     "Return the list of org files currently opened in emacs"
202     (delq nil
203           (mapcar (lambda (x)
204                     (if (and (buffer-file-name x)
205                              (string-match "\\.org$"
206                                            (buffer-file-name x)))
207                         (buffer-file-name x)))
208                   (buffer-list))))
209   (setq org-refile-targets `((my/opened-buffer-files :maxlevel . 9)
210                              (,(file-expand-wildcards  "~/Nextcloud/notes/*.org") :maxlevel . 1)))
211   (setq org-agenda-skip-scheduled-if-done t)
212   (setq org-agenda-skip-deadline-if-done t)
213   (setq org-agenda-start-on-weekday nil)
214   (setq org-log-done 'time)
215   (require 'subr-x)
216   (defun fv/org-babel-after-execute-redisplay ()
217   "Redisplay inline images in subtree if cursor in source block with :result graphics."
219   (when-let ((info (org-babel-get-src-block-info t))
220              (params (org-babel-process-params (nth 2 info)))
221              (result-params (cdr (assq :result-params params)))
222              ((member "graphics" result-params)))
223     (org-display-inline-images nil t)))
224   (add-hook 'org-babel-after-execute-hook #'fv/org-babel-after-execute-redisplay)
225   ;; Automatically flow lines based on window width and use
226   ;; variable width fonts in org-mode.
227   (add-hook 'org-mode-hook 'visual-line-mode)
228   (add-hook 'org-mode-hook 'variable-pitch-mode)
229   ;; org-mode support for R and LaTeX
230   (org-babel-do-load-languages
231    'org-babel-load-languages
232    '((R . t)
233      (latex . t)
234      (gnuplot . t)
235      (dot . t))))
237 (defun fv/org-capture-appointment-timestamp (&optional duration)
238   "Get an Org timestamp for an appointment.
239 Prompt for a start time, calculate the end time by adding DURATION (default 30
240 minutes), and return a formatted Org timestamp with start and end times."
241   (let* ((duration (or duration 30))
242          (start-time (org-read-date t t nil "From:"))
243          (end-time (time-add start-time (seconds-to-time (* duration 60)))))
244     (concat (format-time-string (org-time-stamp-format t) start-time)
245             "--"
246             (format-time-string (org-time-stamp-format t) end-time))))
248 (use-package org-caldav
249   :ensure t
250   :config
251   (setq org-caldav-url "https://owncloud.vanrenterghem.biz/remote.php/dav/calendars/frederik")
252   (setq org-caldav-calendar-id "default%20calendar")
253   ;; Org filename where new entries from calendar stored
254   (setq org-caldav-inbox '(file+olp+datetree "~/Nextcloud/notes/calendar-nextcloud.org"))
255   ;; Additional Org files to check for calendar events
256   (setq org-caldav-files `(,org-default-notes-file))
257   (setq org-export-with-broken-links t)
258   ;; This makes sure to-do items as a category can show up on the calendar
259   (setq org-icalendar-include-todo t)
260   ;; This ensures all org "deadlines" show up, and show up as due dates
261   (setq org-icalendar-use-deadline '(event-if-todo event-if-not-todo todo-due))
262   ;; This ensures "scheduled" org items show up, and show up as start times
263   (setq org-icalendar-use-scheduled '(todo-start event-if-todo event-if-not-todo))
264   ;; Usually a good idea to set the timezone manually
265   (setq org-icalendar-timezone "Australia/Perth")
266   (setq org-caldav-delete-calendar-entries 'ask))
268 (use-package org-protocol)
270 (use-package edraw-org
271   :ensure nil ;; cloned in
272   :load-path "~/.emacs.d/lisp/el-easydraw/"
273   :after (org)
274   :config
275   (edraw-org-setup-default)
276   (edraw-org-setup-exporter))
277   
278 (use-package tex
279   :ensure auctex
280   :config
281   (setq TeX-auto-save t
282         TeX-parse-self t
283         TeX-view-program-selection
284    '(((output-dvi has-no-display-manager)
285       "dvi2tty")
286      ((output-dvi style-pstricks)
287       "dvips and gv")
288      (output-dvi "xdvi")
289      (output-pdf "PDF Tools")
290      (output-html "xdg-open"))))
291 ;; (load "preview-latex.el" nil t t)
294 ;; Automatically switch to various modes
295 (setq auto-mode-alist
296     '(("\\.mdwn\\'" . markdown-mode)
297       ("\\.md\\'" . markdown-mode)
298       ("\\.yarn\\'" . markdown-mode)
299       ("\\.cpp\\'" . c++-mode)
300       ("\\.js\\'" . js-mode)
301       ("\\.json\\'" . js-mode)
302       ("Makefile" . makefile-mode)
303       ("README" . markdown-mode)
304       ("NEWS" . markdown-mode)
305       ("COMMIT_EDITMSG\\'" . text-mode)
306       ("\\.html\\'" . html-mode)
307       ("\\.css\\'" . css-mode)
308       ("\\.yaml\\'" . yaml-mode)
309       ("\\.yml\\'" . yaml-mode)
310       ("\\.ick\\'" . yaml-mode)
311       ("\\.py\\'" . python-mode)
312       ("\\.R\\'" . R-mode)
313       ("\\.org\\'" . org-mode)
314       ("\\.tex\\'" . latex-mode)
315       ("\\.sh\\'" . shell-script-mode)
316       ("\\.hs\\'" . haskell-mode)
317       ("\\.el\\'" . emacs-lisp-mode)))
319 ;; Send mail using SMTP via mail.vanrenterghem.io.
320 (setq send-mail-function    'smtpmail-send-it)
321 (setq smtpmail-smtp-server "mail.vanrenterghem.io"
322       smtpmail-smtp-service 587
323       smtpmail-stream-type 'starttls)
324 (setq user-full-name "Frederik Vanrenterghem"
325       smtpmail-local-domain "vanrenterghem.io"
326       user-mail-address (concat "frederik@" smtpmail-local-domain))
327 ;; Ignored in mu4e as it sets user-agent
328 (setq mail-default-headers
329       (concat "X-Mailer: GNU Emacs " (symbol-value 'emacs-version))) 
330 (setq w3m-pop-up-frames t)
332 (setq gnus-select-method '(nntp "news.eternal-september.org"
333                                 (nntp-open-connection-function nntp-open-tls-stream)
334                                 (nntp-port-number 563)
335                                 (nntp-authinfo-user "frederikv")
336                                 (nntp-authinfo-force t)))
338 (global-set-key [remap list-buffers] 'ibuffer)
340 ;;; use pass (~/.password-store)
341 ;;; (see The Unix password store)
342 (use-package pass
343   :ensure t
344   :config
345   (auth-source-pass-enable)
346   (setq pass-username-field "Username"))
348 ;; Elfeed news reader from Nextcloud
349 (use-package elfeed
350   :ensure t
351   :config
352   (setq elfeed-use-curl nil)
353   (elfeed-set-timeout 36000)
354   (define-key elfeed-search-mode-map (kbd "*") (lambda () (interactive) (apply 'elfeed-search-toggle-all '(star))))
355   (define-key elfeed-show-mode-map (kbd "*") (lambda () (interactive) (apply 'elfeed-show-tag '(star))))
356   (add-hook 'elfeed-show-mode 'variable-pitch-mode))
358 (use-package elfeed-protocol
359   :ensure t
360   :after elfeed
361   :config
362   (setq elfeed-protocol-feeds '(
363                                 ("owncloud+https://frederik@owncloud.vanrenterghem.biz" :use-authinfo t)
364         ))
365   (elfeed-protocol-enable))
368 ;; Read and write email using mu4e
369 (use-package mu4e
370   :ensure nil
371   ;; :ensure-system-package mu ;; Install from aur
372   :config
373   (setq mail-user-agent 'mu4e-user-agent)
374   ;; Also use mu4e when called from gnus-dired-attach
375   (setq gnus-dired-mail-mode 'mu4e-user-agent
376         mu4e-get-mail-command "mbsync io"
377         mu4e-update-interval 600
378         mu4e-use-fancy-chars t
379         mu4e-view-show-images t
380         mu4e-sent-folder   "/Sent"
381         mu4e-drafts-folder "/Drafts"
382         mu4e-trash-folder  "/Trash"
383         message-kill-buffer-on-exit t
384         ;;Fixing duplicate UID errors when using mbsync and mu4e
385         mu4e-change-filenames-when-moving t)
386   ;; attach files to mu4e messages by marking the file(s) in dired and pressing C-c RET C-a
387   (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
388   ;; Define all bookmarks starting with favourite query used in mailcount modeline
389   (setq mu4e-bookmarks
390         '(( :name "Last 24h's messages"
391           :key ?l
392           :favorite y
393           :query "date:24h..now AND NOT flag:trashed")
394         ( :name "Unread messages"
395           :query "flag:unread AND NOT flag:trashed"
396           :key ?u)
397         ( :name "Today's messages"
398           :query "date:today..now AND NOT flag:trashed"
399           :key ?t)
400         ( :name "Last 7 days"
401           :query "date:7d..now AND NOT flag:trashed"
402           :hide-unread t
403           :key ?w)
404         ( :name "Messages with images"
405           :query "mime:image/* AND NOT flag:trashed"
406           :key ?p)))
407   ;; Create custom spam status header and show in message view
408   (add-to-list 'mu4e-header-info-custom
409                '(:spam-status .
410                               ( :name "Spam-Status"     ;; long name, as seen in the message-view
411                                 :shortname "Spam"      ;; short name, as seen in the headers view
412                                 :help "The Spam status" ;; tooltip
413                                 ;; uses mu4e-fetch-field which is rel. slow, so only appropriate
414                                 ;; for mu4e-view-fields, and _not_ mu4e-headers-fields
415                                 :function (lambda (msg)
416                                             (or (string-join (seq-take (split-string (or (mu4e-fetch-field msg "X-Spam-Status") "") " ") 2) " ") "")))))
417   (add-to-list 'mu4e-view-fields :spam-status)
418   ;; Resize image attachments when sending email
419   (defvar mu4e-resize-image-types '("jpg" "png" "svg" "jpeg")
420     "List of attached image types to resize.")
421   (defvar mu4e-inhibit-resize nil)
422   (defun mu4e-resize-image-attachments ()
423     (unless mu4e-inhibit-resize
424       (let (cmds
425             (image-types
426              (mapconcat #'identity mu4e-resize-image-types "\\|")))
427         (save-excursion
428           (message-goto-body-1)
429           (while (re-search-forward 
430                   (format "<#part.+\\(filename=\"\\)\\(.+\\(\\.%s\\)\\)\""
431                           image-types)
432                   nil t)
433             (let* ((infile (match-string-no-properties 2))
434                    (outfile (concat (temporary-file-directory)
435                                     (file-name-nondirectory infile))))
436               (push (format "magick convert %s -resize 1200x1200\\> %s"
437                             (shell-quote-argument infile)
438                             (shell-quote-argument outfile))
439                     cmds)
440               (replace-match outfile t t nil 2)))
441           (mapcar #'shell-command cmds)))))
442   (add-hook 'message-send-hook 'mu4e-resize-image-attachments)
443   (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode) ;; Attach files to messages using dired C-c RET C-a
444   (defun mu4e-inhibit-resize()
445     (interactive)
446     (set (make-local-variable 'mu4e-inhibit-resize) t)))
448 ;; Load configuration for website
449 ;(load "mustache-html")
451 ;; Denote config
452 (use-package denote
453   :ensure t
454   :hook (dired-mode . denote-dired-mode)
455   :bind
456   (("C-c n n" . denote)
457    ("C-c n r" . denote-rename-file)
458    ("C-c n l" . denote-link)
459    ("C-c n b" . denote-backlinks))
460   :config
461   (setq denote-directory "/home/frederik/Nextcloud/notes/")
462   (denote-rename-buffer-mode 1))
464 (use-package nerd-icons
465   ;; :custom
466   ;; The Nerd Font you want to use in GUI
467   ;; "Symbols Nerd Font Mono" is the default and is recommended
468   ;; but you can use any other Nerd Font if you want
469   ;; (nerd-icons-font-family "Symbols Nerd Font Mono")
470   )
472 ;; Dired configuration
473 (with-eval-after-load 'dired
474   (require 'dired-x)
475   ;; Set dired-x global variables here.  For example:
476   ;; (setq dired-x-hands-off-my-keys nil)
477   )
478 (add-hook 'dired-mode-hook
479           (lambda ()
480             ;; Set dired-x buffer-local variables here.
481             (dired-omit-mode 1)
482             (dired-hide-details-mode 1)
483             (nerd-icons-dired-mode 1)
484             ))
485 (setq delete-by-moving-to-trash t)
486 (setq dired-guess-shell-alist-user
487       '(("\\.\\(png\\|jpe?g\\|tiff\\)" "feh" "xdg-open")
488         ("\\.\\(mp[34]\\|m4a\\|ogg\\|flac\\|webm\\|mkv\\)" "mpv" "xdg-open")
489                 (".*" "xdg-open")))
491 ;; Use `vertico' package to get a vertical view of the minibuffer.
492 (use-package vertico
493   :ensure t
494   :config
495   (setq vertico-resize nil)
496   (vertico-mode 1))
498 ;; Persist history over Emacs restarts. Vertico sorts by history position.
499 (use-package savehist
500   :init
501   (savehist-mode))
503 ;; Use `marginalia' package.  This will display useful
504 ;; annotations next to entries in the minibuffer.  For example, when
505 ;; using M-x it will show a brief description of the command as well
506 ;; as the keybinding associated with it (if any).
507 (use-package marginalia
508   :ensure t
509   :config
510   (marginalia-mode 1))
512 ;; Use 'winner' mode to undo and redo windows changes
513 ;; using C-c <left> and C-c <right>.
514 (use-package winner
515   :ensure t
516   :config
517   (winner-mode 1))
519 ;; Use a different spell checker, always
520 (use-package jinx
521   :ensure t
522   :config
523   (keymap-global-set "M-$" #'jinx-correct)
524   :hook (emacs-startup . global-jinx-mode))
526 (use-package powerthesaurus
527   :ensure t
528   :init
529   (require 'transient)
530   (transient-define-prefix my/transient-spelling ()
531     "Spelling commands"
532     ["Spelling"
533       ["Lookups"
534         ("y" "Synonyms" powerthesaurus-lookup-synonyms-dwim)
535         ("a" "Antonyms" powerthesaurus-lookup-antonyms-dwim)]
536       ["Spelling Tools"
537         ("x" "Jinx" jinx-mode)
538         ("c" "Jinx correct" jinx-correct)]
539       ["Dictionary"
540         ("d" "Lookup" dictionary-lookup-definition)]
541       ["Miscellaneous"
542         ("q" "Quit" transient-quit-one)]])
543   :bind
544   ("C-c s" . my/transient-spelling))
546 ;; Bind embark
547 (use-package embark
548   :ensure t
549   :config
550   (keymap-global-set "C-." #'embark-act)
551   (keymap-global-set "C-;" #'embark-dwim))
553 (use-package consult
554   :ensure t
555   :config
556   ;; Change default bindings to consult- ones
557   :bind
558   (;; C-x bindings in `ctl-x-map'
559    ("C-x b" . consult-buffer)                ;; orig. switch-to-buffer
560    ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
561    ("C-x r b" . consult-bookmark)            ;; orig. bookmark-jump
562    ;; Other custom bindings
563    ("M-y" . consult-yank-pop)))              ;; orig. yank-pop
565 (use-package consult-mu
566   :ensure nil ;; cloned in
567   :load-path "~/.emacs.d/lisp/consult-mu"
568   :after (consult mu4e)
569   :custom
570   ;;maximum number of results shown in minibuffer
571   (consult-mu-maxnum 200)
572   ;;show preview when pressing any keys
573   (consult-mu-preview-key 'any)
574   ;;do not mark email as read when previewed
575   (consult-mu-mark-previewed-as-read nil)
576   ;;do not amrk email as read when selected. This is a good starting point to ensure you would not miss important emails marked as read by mistake especially when trying this package out. Later you can change this to t.
577   (consult-mu-mark-viewed-as-read nil)
578   ;; open the message in mu4e-view-buffer when selected.
579   (consult-mu-action #'consult-mu--view-action)
580   )
582 (use-package consult-denote
583   :ensure t)
585 ;; Configure `world-clock'
586 (use-package time
587   :ensure nil
588   :config
589   (setq zoneinfo-style-world-list '(("Europe/Brussels" "Leuven")))
590   (add-to-list 'zoneinfo-style-world-list '("Australia/Perth" "Perth")))
593 ;; View PDFs in Emacs
594 (pdf-loader-install) ; On demand loading, leads to faster startup time
595 (setq pdf-misc-print-programm "/usr/bin/lpr")
596   
597 (use-package magit
598   :ensure t)
600 (use-package eat
601   :ensure t
602   :config
603    ;; For `eat-eshell-mode'.
604   (add-hook 'eshell-load-hook #'eat-eshell-mode)
605   (setq eshell-visual-commands '()))
607 ;; Read ePub files
608 (use-package nov
609   :ensure t
610   :init
611   (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
612   :config
613   (add-hook 'nov-mode-hook #'variable-pitch-mode))
615 ;; Set some preset fonts
616 (use-package fontaine
617   :ensure t
618   :config
619   (setq fontaine-presets
620       '((regular-1
621          :default-family "Iosevka Nerd Font"
622          :default-height 120
623          :variable-pitch-family "Linux Biolinum O"
624          :variable-pitch-weight normal
625          :variable-pitch-height 1.1
626          :italic-family "Iosevka Etoile"
627          :line-spacing 1)
628         (large-1
629          :default-family "Iosevka Nerd Font"
630          :default-height 150
631          :variable-pitch-family "Literata"
632          :variable-pitch-weight normal
633          :variable-pitch-height 1.0
634          :line-spacing 1)
635         (regular-2
636          :default-family "Fira Mono Nerd Font"
637          :default-height 140
638          :variable-pitch-family "Fira Sans Book"
639          :variable-pitch-weight normal
640          :variable-pitch-height 1.0
641          :line-spacing 1)
642         (large-2
643          :default-family "Fira Mono Nerd Font"
644          :default-height 140
645          :variable-pitch-family "Fira Sans Book"
646          :variable-pitch-weight normal
647          :variable-pitch-height 1.0
648          :line-spacing 1)
649         (ereader-Baskerville
650          :variable-pitch-family "Libre Baskerville"
651          :variable-pitch-weight normal
652          :variable-pitch-height 1.0
653          :line-spacing 1)
654         (ereader-Noto-Serif
655          :variable-pitch-family "Noto Serif"
656          :variable-pitch-weight normal
657          :variable-pitch-height 1.0
658          :line-spacing 1)
659         (ereader-Bembo-Tufte
660          :variable-pitch-family "ETBembo"
661          :variable-pitch-weight normal
662          :variable-pitch-height 1.1
663          :line-spacing 1)
664         (ereader-Literata
665          :variable-pitch-family "Literata"
666          :variable-pitch-weight normal
667          :variable-pitch-height 1.0
668          :line-spacing 1))))
670 (use-package devdocs
671   :ensure t
672   :bind
673   ("C-h D" . devdocs-lookup))
675 (use-package emms
676   :ensure t
677   :config
678   (require 'emms-setup)
679   (require 'emms-player-mpd)
680   (emms-all) ; don't change this to values you see on stackoverflow questions if you expect emms to work
681   (setq emms-player-list '(emms-player-mpd))
682   (add-to-list 'emms-info-functions 'emms-info-mpd)
683   (add-to-list 'emms-player-list 'emms-player-mpd)
684   
685   ;; Socket is not supported
686   (setq emms-player-mpd-server-name "mea-hookani-pila")
687   (setq emms-player-mpd-server-port "6600")
688   (emms-player-mpd-connect))
690 ;; Custom functions
692 ;; Might want to run this automatically
693 ;; using variable after-focus-change-function
694 (defun my/adjust-font-size-based-on-display ()
695   "Change size of fonts based on monitor."
696   (interactive)
697   (let* ((display-name (cdr (assq 'name (frame-monitor-attributes))))
698          (font-height (cond ((string-equal display-name "eDP-1") 140) 
699                             (t 120) ;; default
700                             )))
701     (set-face-attribute 'default (selected-frame) :height font-height)))