From 1f0ec8efee18504483a1a88bfcd395f7b5846949 Mon Sep 17 00:00:00 2001 From: Frederik Vanrenterghem Date: Tue, 23 Jul 2024 20:55:19 +0800 Subject: [PATCH] Various emacs config edits: - Change theme - Change font to variable width for certain modes - Define mu4e bookmarks - Use jinx spell checker - Define keybinding for embark and consult - Set up world clock --- emacs/.emacs.d/init.el | 67 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 12 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 9c8eca1..ae30d66 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -12,8 +12,17 @@ ;; Use light theme ;;(load-theme 'leuven t) (require 'modus-themes) -(load-theme 'modus-operandi t) (setq modus-themes-mixed-fonts t) +(load-theme 'modus-operandi t) +(variable-pitch-mode) +(define-key global-map (kbd "") #'modus-themes-toggle) + +(require 'orderless) +(setq completion-styles '(orderless basic) + completion-category-overrides '((file (styles basic partial-completion)))) + +;; follow links to version-controlled files without confirming +vc-follow-symlinks t ;; ESS - for working in R (autoload 'R-mode "ess-site.el" "Major mode for editing R source." t) @@ -82,16 +91,16 @@ '(browse-url-browser-function 'browse-url-firefox) '(custom-safe-themes '("0cf95236abcf59e05b1ea69b4edd53d293a5baec4fe4c3484543fee99bfd2204" "80b00f3bf7cdbdca6c80aadfbbb03145f3d0aacf6bf2a559301e61109954e30a" default)) - '(denote-directory "/home/frederik/Nextcloud/notes/") + '(denote-directory "/home/frederik/Nextcloud/notes/" t) '(org-export-backends '(ascii html icalendar latex md odt)) '(package-selected-packages - '(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))) + '(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))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(default ((t (:family "Source Code Pro" :foundry "ADBO" :slant normal :weight normal :height 143 :width normal))))) + ) ;; Send mail using SMTP via mail.vanrenterghem.io. @@ -125,6 +134,7 @@ (elfeed-protocol-enable) (define-key elfeed-search-mode-map (kbd "*") (lambda () (interactive) (apply 'elfeed-search-toggle-all '(star)))) (define-key elfeed-show-mode-map (kbd "*") (lambda () (interactive) (apply 'elfeed-show-tag '(star)))) +(add-hook 'elfeed-show-mode 'variable-pitch-mode) ;; Read and write email using mu4e (require 'mu4e) @@ -138,15 +148,28 @@ (setq mu4e-sent-folder "/Sent" mu4e-drafts-folder "/Drafts" mu4e-trash-folder "/Trash") +(setq message-kill-buffer-on-exit t) ;; attach files to mu4e messages by marking the file(s) in dired and pressing C-c RET C-a (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode) -;; Define favourite query used in mailcount modeline -(add-to-list 'mu4e-bookmarks - ;; add favourite. - '( :name "Last 24h's messages" - :key ?l - :favorite y - :query "date:24h..now AND NOT flag:trashed")) +;; Define all bookmarks starting with favourite query used in mailcount modeline +(setq mu4e-bookmarks + '(( :name "Last 24h's messages" + :key ?l + :favorite y + :query "date:24h..now AND NOT flag:trashed") + ( :name "Unread messages" + :query "flag:unread AND NOT flag:trashed" + :key ?u) + ( :name "Today's messages" + :query "date:today..now AND NOT flag:trashed" + :key ?t) + ( :name "Last 7 days" + :query "date:7d..now AND NOT flag:trashed" + :hide-unread t + :key ?w) + ( :name "Messages with images" + :query "mime:image/* AND NOT flag:trashed" + :key ?p))) ;; Create custom spam status header and show in message view (add-to-list 'mu4e-header-info-custom @@ -180,7 +203,7 @@ (let* ((infile (match-string-no-properties 2)) (outfile (concat (temporary-file-directory) (file-name-nondirectory infile)))) - (push (format "convert %s -resize 1200x1200\\> %s" + (push (format "magick convert %s -resize 1200x1200\\> %s" (shell-quote-argument infile) (shell-quote-argument outfile)) cmds) @@ -231,3 +254,23 @@ ;; Use 'winner' mode to undo and redo windows changes ;; using C-c and C-c . (winner-mode 1) + +;; Use a different spell checker, always +(add-hook 'emacs-startup-hook #'global-jinx-mode) +(keymap-global-set "M-$" #'jinx-correct) + +;; Bind embark +(keymap-global-set "C-." #'embark-act) +(keymap-global-set "C-;" #'embark-dwim) + +;; Change default bindings to consult- ones +(keymap-set ctl-x-map "b" #'consult-buffer) +(global-set-key (kbd "M-y") 'consult-yank-pop) + +;; Configure `world-clock' + +(with-eval-after-load 'time + (setq zoneinfo-style-world-list '(("Europe/Brussels" "Leuven"))) + (add-to-list 'zoneinfo-style-world-list '("Australia/Perth" "Perth"))) + + -- 2.39.5