From 16babc3f15f8ec6fe6675174364997e44341ed9f Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Tue, 24 Oct 2023 08:06:35 +0100 Subject: [PATCH] Various additions / changes Switch email from mu/mu4e to notmuch, with associated service changes Add elfeed config, enable useful minor-modes Slight restructure of file layout --- home/accounts/email.nix | 19 +++-- home/emacs/config/elfeed.org | 46 ++++++++++++ home/emacs/{ => config}/init.el | 21 ++++-- .../config/modules/custom-email-config.el | 6 ++ .../config/modules/custom-feed-config.el | 9 +++ .../emacs/config/modules/custom-ide-config.el | 8 +++ .../modules/custom-ligatures-config.el | 4 +- .../config/modules/custom-project-config.el | 8 +++ home/emacs/default.nix | 44 +++++++----- home/emacs/modules/custom-email-config.el | 70 ------------------- 10 files changed, 138 insertions(+), 97 deletions(-) create mode 100644 home/emacs/config/elfeed.org rename home/emacs/{ => config}/init.el (86%) create mode 100644 home/emacs/config/modules/custom-email-config.el create mode 100644 home/emacs/config/modules/custom-feed-config.el create mode 100644 home/emacs/config/modules/custom-ide-config.el rename home/emacs/{ => config}/modules/custom-ligatures-config.el (97%) create mode 100644 home/emacs/config/modules/custom-project-config.el delete mode 100644 home/emacs/modules/custom-email-config.el diff --git a/home/accounts/email.nix b/home/accounts/email.nix index 808724b2..ff70b58f 100644 --- a/home/accounts/email.nix +++ b/home/accounts/email.nix @@ -3,6 +3,7 @@ { home.packages = with pkgs; [ davmail ]; programs = { + msmtp.enable = true; mbsync = { enable = true; groups.inboxes = { @@ -11,13 +12,18 @@ outlook = [ "INBOX" ]; }; }; - msmtp.enable = true; - mu.enable = true; + notmuch = { + enable = true; + maildir.synchronizeFlags = true; + hooks.postInsert = "${pkgs.libnotify}/bin/notify-send notmuch updated"; + }; + afew.enable = true; }; services = { mbsync = { enable = true; frequency = "*:0/30"; + postExec = "${pkgs.notmuch}/bin/notmuch new"; }; imapnotify.enable = true; }; @@ -50,6 +56,7 @@ enable = lib.mkDefault accountEnabled; boxes = [ "INBOX" ]; onNotify = "${pkgs.isync}/bin/mbsync proton"; + onNotifyPost = "${pkgs.notmuch}/bin/notmuch new"; extraConfig = { wait = 300; tls = false; @@ -72,7 +79,7 @@ auth = "login"; }; }; - mu.enable = lib.mkDefault accountEnabled; + notmuch.enable = lib.mkDefault accountEnabled; }; icloud = let accountEnabled = true; in rec { @@ -89,6 +96,7 @@ enable = lib.mkDefault accountEnabled; boxes = [ "INBOX" ]; onNotify = "${pkgs.isync}/bin/mbsync icloud"; + onNotifyPost = "${pkgs.notmuch}/bin/notmuch new"; extraConfig.wait = 300; }; mbsync = { @@ -100,7 +108,7 @@ subFolders = "Verbatim"; }; msmtp.enable = lib.mkDefault accountEnabled; - mu.enable = lib.mkDefault accountEnabled; + notmuch.enable = lib.mkDefault accountEnabled; }; outlook = let host = "127.0.0.1"; @@ -127,6 +135,7 @@ enable = lib.mkDefault accountEnabled; boxes = [ "INBOX" ]; onNotify = "${pkgs.isync}/bin/mbsync outlook"; + onNotifyPost = "${pkgs.notmuch}/bin/notmuch new"; extraConfig = { wait = 300; tls = false; @@ -150,7 +159,7 @@ auth = "login"; }; }; - mu.enable = lib.mkDefault accountEnabled; + notmuch.enable = lib.mkDefault accountEnabled; }; }; }; diff --git a/home/emacs/config/elfeed.org b/home/emacs/config/elfeed.org new file mode 100644 index 00000000..30b8038a --- /dev/null +++ b/home/emacs/config/elfeed.org @@ -0,0 +1,46 @@ +#+title: Elfeed +* root :elfeed: +** Blogs :blogs: +*** [[https://www.zotero.org/blog/feed/][Zotero]] +** News :news: +*** Linux :linux: +**** [[https://systemcrafters.net/rss/news.xml][Systemcrafters News]] +** Programming :programming: +*** Python :python: +*** Rust :rust: +**** [[https://this-week-in-rust.org/rss.xml][This Week in Rust]] +** YouTube :youtube:videos: +*** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCp6F1mQGuaXiDj5otWBmIjg][EckhartsLadder]] +*** Explainers :explainers: +**** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCBa659QWEk1AI4Tg--mrJ2A][Tom Scott]] +**** [[https://www.youtube.com/feeds/videos.xml?channel_id=UC2C_jShtL725hvbm1arSV9w][CGP Grey]] +**** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCEIwxahdLz7bap-VDs9h35A][Steve Mould]] +**** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCHnyfMqiRRG1u-2MsSQLbXA][Veritasium]] +*** Games :games: +**** Reviews :reviews: +***** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCWCw2Sd7RlYJ2yuNVHDWNOA][The Jimquisition]] +**** Minecraft :minecraft: +***** [[https://www.youtube.com/feeds/videos.xml?channel_id=UChFur_NwVSbUozOcF_F2kMg][Mumbo Jumbo]] :mumbojumbo: +****** [[https://www.youtube.com/feeds/videos.xml?playlist_id=PLFm1tTY1NA4ebglc7QWni3Vx6Zzdx0PQu][Hermitcraft Season 9]] :hermitcraft: +***** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCR9Gcq0CMm6YgTzsDxAxjOQ][Grian]] +***** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCodkNmk9oWRTIYZdr_HuSlg][GoodTimesWithScar]] +***** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCuQYHhF6on6EXXO-_i_ClHQ][FalseSymmetry]] +***** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCU9pX8hKcrx06XfOB-VQLdw][xisumavoid]] +**** Zelda :zelda: +***** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCVBEE2TpAUD4T2OP7fHKCXg][Gossip Geist]] +**** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCweDKPSF65wRw5VHFUJYiow][Curious Archive]] +**** Outside Xbox :outsidexbox: +***** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCKk076mm-7JjLxJcFSXIPJA][Outside Xbox]] +***** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCjf6YzmyaKi8880IXMJ5kGA][Outside Xtra]] +*** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCGwu0nbY2wSkW8N-cghnLpA][Jaiden Animations]] +*** Linux :linux: +**** [[https://www.youtube.com/feeds/videos.xml?channel_id=UC5UAwBUum7CPN5buc-_N1Fw][The Linux Experiment]] +**** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCAiiOTio8Yu69c3XnR7nQBQ][System Crafters]] +*** STEM :STEM: +**** Physics :physics: +***** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCeXksuVW8H1x9v4gh7DWoyQ][Physics for the Birds]] +***** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCUHW94eEFW7hkUMVaZz4eDg][minutephysics]] +**** Maths :maths: +***** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCSju5G2aFaWMqn-_0YBtq5A][Stand-up Maths]] +***** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCRfo-DAifrP3lzcxUHtGm_A][Tom Rocks Maths]] +**** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCsXVk37bltHxD1rDPwtNM8Q][Kurzgesagt - In a Nutshell]] diff --git a/home/emacs/init.el b/home/emacs/config/init.el similarity index 86% rename from home/emacs/init.el rename to home/emacs/config/init.el index 9f63d955..6febb65c 100644 --- a/home/emacs/init.el +++ b/home/emacs/config/init.el @@ -19,9 +19,6 @@ (add-to-list 'load-path (expand-file-name "modules" crafted-emacs-home)) ;;; Configuration phase - -(require 'custom-email-config) - (require 'crafted-completion-config) (require 'crafted-defaults-config) (require 'crafted-ide-config) @@ -32,21 +29,37 @@ (require 'crafted-workspaces-packages) (require 'crafted-writing-packages) +(require 'custom-email-config) +(require 'custom-feed-config) +(require 'custom-ide-config) +(require 'custom-ligatures-config) +(require 'custom-project-config) + ;;; Optional configuration (setq user-full-name "Evie Litherland-Smith" user-mail-address "evie@xenia.me.uk" + sendmail-program (executable-find "msmtp") + send-mail-function #'smtpmail-send-it + message-sendmail-f-is-evil t + message-sendmail-extra-arguments '("--read-envelope-from") + message-send-mail-function #'message-send-mail-with-sendmail display-line-numbers 'relative fill-column 80) -(global-display-fill-column-indicator-mode) ;; Theme settings +(tool-bar-mode -1) +(scroll-bar-mode -1) +(setq use-dialog-box nil) (load-theme 'doom-tokyo-night t) (add-to-list 'default-frame-alist '(font . "FiraCode Nerd Font-12")) (global-prettify-symbols-mode) (set-frame-parameter nil 'alpha-background 80) (add-to-list 'default-frame-alist '(alpha-background . 80)) +;; Extra minor-modes +(which-key-mode) + ;; Extra functions (defun crafted-startup-example/display-startup-time () diff --git a/home/emacs/config/modules/custom-email-config.el b/home/emacs/config/modules/custom-email-config.el new file mode 100644 index 00000000..bfb729f1 --- /dev/null +++ b/home/emacs/config/modules/custom-email-config.el @@ -0,0 +1,6 @@ +(notmuch-indicator-mode) +(setq notmuch-search-oldest-first nil + notmuch-show-logo nil + notmuch-indicator-args '((:terms "tag:unread and tag:inbox" :label "@"))) + +(provide 'custom-email-config) diff --git a/home/emacs/config/modules/custom-feed-config.el b/home/emacs/config/modules/custom-feed-config.el new file mode 100644 index 00000000..6967f494 --- /dev/null +++ b/home/emacs/config/modules/custom-feed-config.el @@ -0,0 +1,9 @@ +(setq elfeed-db-directory "~/.elfeed/db/" + elfeed-enclosure-default-dir "~/.elfeed/enclosures/" + elfeed-goodies/entry-pane-position 'bottom + elfeed-goodies/powerline-default-separator 'utf-8) +;; (add-hook 'elfeed-search-mode-hook #'elfeed-update) +(require 'elfeed) +(require 'elfeed-tube) +(elfeed-tube-setup) +(provide 'custom-feed-config) diff --git a/home/emacs/config/modules/custom-ide-config.el b/home/emacs/config/modules/custom-ide-config.el new file mode 100644 index 00000000..2a429f5d --- /dev/null +++ b/home/emacs/config/modules/custom-ide-config.el @@ -0,0 +1,8 @@ +(setq direnv-always-show-summary nil) + +(require 'treesit-auto) +(global-treesit-auto-mode +1) +(apheleia-global-mode +1) +(direnv-mode +1) + +(provide 'custom-ide-config) diff --git a/home/emacs/modules/custom-ligatures-config.el b/home/emacs/config/modules/custom-ligatures-config.el similarity index 97% rename from home/emacs/modules/custom-ligatures-config.el rename to home/emacs/config/modules/custom-ligatures-config.el index b5ba19d7..4b6ca4aa 100644 --- a/home/emacs/modules/custom-ligatures-config.el +++ b/home/emacs/config/modules/custom-ligatures-config.el @@ -55,4 +55,6 @@ "Setup Fira Code Symbols" (set-fontset-font t '(#Xe100 . #Xe16f) "Fira Code Symbol")) -(provide 'fira-code-mode) +(fira-code-mode) + +(provide 'custom-ligatures-config) diff --git a/home/emacs/config/modules/custom-project-config.el b/home/emacs/config/modules/custom-project-config.el new file mode 100644 index 00000000..07c07aa2 --- /dev/null +++ b/home/emacs/config/modules/custom-project-config.el @@ -0,0 +1,8 @@ +(setq project-switch-use-entire-map t + project-switch-commands + '((project-dired "Browse directory") + (project-find-file "Find file") + (project-find-regexp "Find regexp") + (project-find-dir "Find directory") + (project-eshell "Eshell"))) +(provide 'custom-project-config) diff --git a/home/emacs/default.nix b/home/emacs/default.nix index 9957c5d4..f39fae2f 100644 --- a/home/emacs/default.nix +++ b/home/emacs/default.nix @@ -4,8 +4,10 @@ imports = [ ./formatters.nix ./lsp_servers.nix ]; stylix.targets.emacs.enable = false; xdg.configFile = { - "emacs/init.el".source = ./init.el; - "emacs/modules".source = ./modules; + emacs = { + source = ./config; + recursive = true; + }; "emacs/crafted-emacs".source = crafted-emacs; }; services.git-sync = { @@ -23,7 +25,7 @@ # Theme doom-themes - # crafted-completion-packages + # completion-packages cape consult corfu @@ -34,43 +36,51 @@ orderless vertico - # crafted-ide-packages - treesit-auto + # ide-packages editorconfig aggressive-indent ibuffer-project - - # tree-sitter grammars + # custom treesit-grammars.with-all-grammars + treesit-auto + apheleia + direnv + nix-mode + rust-mode - # crafted-org-packages + # org-packages denote org-appear - # crafted-ui-packages + # ui-packages all-the-icons elisp-demos helpful - # crafted-workspaces-packages + # workspaces-packages tabspaces - # crafted-writing-packages + # writing-packages markdown-mode pandoc-mode auctex auctex-latexmk - # custom-email-packages - mu4e - mu4e-alert + # email-packages + notmuch + notmuch-indicator + + # feed-packages + elfeed + elfeed-org + elfeed-webkit + elfeed-tube + elfeed-tube-mpv # Additional packages + which-key magit vterm - direnv - nix-mode - rust-mode ])); }; home = { diff --git a/home/emacs/modules/custom-email-config.el b/home/emacs/modules/custom-email-config.el deleted file mode 100644 index eb7d1579..00000000 --- a/home/emacs/modules/custom-email-config.el +++ /dev/null @@ -1,70 +0,0 @@ -(setq mu4e-maildir "~/Mail" - mu4e-attachment-dir "~/Downloads" - mu4e-get-mail-command "mbsync --pull-new inboxes" - mu4e-update-interval (* 5 60) ; Every 5 minutes - mu4e-sent-messages-behavior 'sent - mu4e-change-filenames-when-moving t - mu4e-alert-modeline-formatter 'mu4e-alert-default-mode-line-formatter - sendmail-program (executable-find "msmtp") - send-mail-function #'smtpmail-send-it - message-sendmail-f-is-evil t - message-sendmail-extra-arguments '("--read-envelope-from") - message-send-mail-function #'message-send-mail-with-sendmail - mu4e-maildir-shortcuts '((:maildir "/Proton/Inbox/" :key ?p) - (:maildir "/iCloud/Inbox/" :key ?i) - (:maildir "/Outlook/Inbox/" :key ?o)) - mu4e-modeline-all-read '("R:" . "󰑇 ") - mu4e-modeline-all-clear '("C:" . "󰚭 ") - mu4e-modeline-new-items '("N:" . "󰎔 ") - mu4e-modeline-unread-items '("U:" . "󰮒 ") - mu4e-search-full-label '("F" . "󱊖 ") - mu4e-search-hide-label '("H" . "󰘓 ") - mu4e-search-related-label '("R" . "󰌹 ") - mu4e-search-skip-duplicates-label '("D" . "󰆑 ") - mu4e-search-threaded-label'("T" . "󱇫 ")) - -(require 'mu4e) - -(setq mu4e-contexts - (list - (make-mu4e-context - :name "Proton" - :match-func - (lambda (msg) - (when msg) - (string-prefix-p "/Proton" (mu4e-message-field msg :maildir))) - :vars - '((user-mail-address . "e.litherlandsmith@proton.me") - (mu4e-sent-folder . "/Proton/Sent") - (mu4e-drafts-folder . "/Proton/Drafts") - (mu4e-trash-folder . "/Proton/Trash") - (mu4e-refile-folder . "/Proton/Archive")) - ) - (make-mu4e-context - :name "iCloud" - :match-func - (lambda (msg) - (when msg) - (string-prefix-p "/iCloud" (mu4e-message-field msg :maildir))) - :vars - '((user-mail-address . "e.litherlandsmith@icloud.com") - (mu4e-sent-folder . "/iCloud/Sent") - (mu4e-drafts-folder . "/iCloud/Drafts") - (mu4e-trash-folder . "/iCloud/Trash") - (mu4e-refile-folder . "/iCloud/Archive")) - ) - (make-mu4e-context - :name "Outlook" - :match-func - (lambda (msg) - (when msg) - (string-prefix-p "/Outlook" (mu4e-message-field msg :maildir))) - :vars - '((user-mail-address . "evie.litherland-smith@ukaea.uk") - (mu4e-sent-folder . "/Outlook/Sent") - (mu4e-drafts-folder . "/Outlook/Drafts") - (mu4e-trash-folder . "/Outlook/Trash") - (mu4e-refile-folder . "/Outlook/Archive")) - ) - )) -(provide 'custom-email-config)