Move almost all config into new format

Think I've got the important stuff using use-package at least, will
probably need a bit more config but that's lower priority
This commit is contained in:
Evie Litherland-Smith 2023-11-09 08:10:57 +00:00
parent 1adf46af4a
commit 9defe7b742
2 changed files with 464 additions and 527 deletions

View file

@ -328,6 +328,37 @@
(add-hook 'org-agenda-mode-hook #'khalel-import-events)
(khalel-add-capture-template "e"))
;; Return or left-click with mouse follows link
(customize-set-variable 'org-return-follows-link t)
(customize-set-variable 'org-mouse-1-follows-link t)
;; Display links as the description provided
(customize-set-variable 'org-link-descriptive t)
;; Visually indent org-mode files to a given header level
(add-hook 'org-mode-hook #'org-indent-mode)
;; Hide markup markers
(customize-set-variable 'org-hide-emphasis-markers t)
(when (locate-library "org-appear")
(add-hook 'org-mode-hook 'org-appear-mode))
;; Disable auto-pairing of "<" in org-mode with electric-pair-mode
(defun crafted-org-enhance-electric-pair-inhibit-predicate ()
"Disable auto-pairing of \"<\" in `org-mode' when using `electric-pair-mode'."
(when (and electric-pair-mode (eql major-mode #'org-mode))
(setq-local electric-pair-inhibit-predicate
`(lambda (c)
(if (char-equal c ?<)
t
(,electric-pair-inhibit-predicate c))))))
;; Add hook to both electric-pair-mode-hook and org-mode-hook
;; This ensures org-mode buffers don't behave weirdly,
;; no matter when electric-pair-mode is activated.
(add-hook 'electric-pair-mode-hook #'crafted-org-enhance-electric-pair-inhibit-predicate)
(add-hook 'org-mode-hook #'crafted-org-enhance-electric-pair-inhibit-predicate)
(use-package rainbow-delimiters
:ensure t
:hook (prog-mode))
@ -395,109 +426,44 @@ manually with something like this:
(use-package magit
:ensure t)
(when (require 'emms-setup nil :noerror)
(setq emms-player-list '(emms-player-mpv)
emms-info-functions '(emms-info-native)
emms-source-file-default-directory "~/Music"
emms-lyrics-dir "~/Music/lyrics"
emms-mode-line-icon-color "white")
(emms-all)
(add-hook 'emms-player-started-hook #'emms-show)
(add-hook 'emms-player-paused-hook #'emms-show)
(when (require 'hydra nil :noerror)
(defhydra emms (global-map "C-c e")
"emms"
("b" emms-smart-browse)
("d" emms-show)
("s" emms-start)
("S" emms-stop)
("n" emms-next)
("p" emms-previous)
("P" emms-pause))))
;;; Vertico
(when (require 'vertico nil :noerror)
(setq vertico-cycle t)
(use-package vertico
:ensure t
:config
(require 'vertico-directory)
;; Cycle back to top/bottom result when the edge is reached
(customize-set-variable 'vertico-cycle t)
(vertico-mode +1))
;; Start Vertico
(vertico-mode 1)
(setq marginalia-annotators '(marginalia-annotators-heavy
marginalia-annotators-light
nil))
(use-package marginalia
:ensure t
:config (marginalia-mode +1))
;; Turn off the built-in fido-vertical-mode and icomplete-vertical-mode, if
;; they have been turned on by crafted-defaults-config, because they interfere
;; with this module.
(with-eval-after-load 'crafted-defaults-config
(fido-mode -1)
(fido-vertical-mode -1)
(icomplete-mode -1)
(icomplete-vertical-mode -1)))
(use-package orderless
:ensure t
:config (setq completion-styles '(orderless basic)
completion-category-overrides '((file (styles . (partial-completion))))))
;;; Marginalia
(when (require 'marginalia nil :noerror)
;; Configure Marginalia
(customize-set-variable 'marginalia-annotators
'(marginalia-annotators-heavy
marginalia-annotators-light
nil))
(marginalia-mode 1))
(setq corfu-cycle t
corfu-auto t
corfu-auto-prefix 3
corfu-auto-delay 0.5)
;;; Consult
;; Since Consult doesn't need to be required, we assume the user wants these
;; setting if it is installed (regardless of the installation method).
(when (locate-library "consult")
;; Set some consult bindings
(keymap-global-set "C-s" 'consult-line)
(keymap-set minibuffer-local-map "C-r" 'consult-history)
(setq completion-in-region-function #'consult-completion-in-region))
;;; Orderless
(when (require 'orderless nil :noerror)
;; Set up Orderless for better fuzzy matching
(customize-set-variable 'completion-styles '(orderless basic))
(customize-set-variable 'completion-category-overrides
'((file (styles . (partial-completion))))))
;;; Embark
(when (require 'embark nil :noerror)
(keymap-global-set "<remap> <describe-bindings>" #'embark-bindings)
(keymap-global-set "C-." 'embark-act)
;; Use Embark to show bindings in a key prefix with `C-h`
(setq prefix-help-command #'embark-prefix-help-command)
(when (require 'embark-consult nil :noerror)
(with-eval-after-load 'embark-consult
(add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode))))
;;; Corfu
(when (require 'corfu nil :noerror)
(unless (display-graphic-p)
(when (require 'corfu-terminal nil :noerror)
(corfu-terminal-mode +1)))
;; Setup corfu for popup like completion
(customize-set-variable 'corfu-cycle t) ; Allows cycling through candidates
(customize-set-variable 'corfu-auto t) ; Enable auto completion
(customize-set-variable 'corfu-auto-prefix 2) ; Complete with less prefix keys
(global-corfu-mode 1)
(use-package corfu
:ensure t
:config
(global-corfu-mode +1)
(when (require 'corfu-popupinfo nil :noerror)
(corfu-popupinfo-mode 1)
(eldoc-add-command #'corfu-insert)
(keymap-set corfu-map "M-p" #'corfu-popupinfo-scroll-down)
(keymap-set corfu-map "M-n" #'corfu-popupinfo-scroll-up)
(keymap-set corfu-map "M-d" #'corfu-popupinfo-toggle)))
;;; Cape
(when (require 'cape nil :noerror)
(use-package cape
:ensure t
:config
;; Setup Cape for better completion-at-point support and more
;; Add useful defaults completion sources from cape
@ -521,47 +487,161 @@ manually with something like this:
(corfu-mode))
(add-hook 'eshell-mode-hook #'crafted-completion-corfu-eshell))
;; Return or left-click with mouse follows link
(customize-set-variable 'org-return-follows-link t)
(customize-set-variable 'org-mouse-1-follows-link t)
(use-package consult
:ensure t
:bind (("C-s" . consult-line)
:map minibuffer-local-map
("C-r" . consult-history))
:config (setq completion-in-region-function #'consult-completion-in-region))
;; Display links as the description provided
(customize-set-variable 'org-link-descriptive t)
(use-package embark
:ensure t
:bind (("<remap> <describe-bindings>" . embark-bindings)
("C-." . embark-act))
:config (setq prefix-help-command #'embark-prefix-help-command))
;; Visually indent org-mode files to a given header level
(add-hook 'org-mode-hook #'org-indent-mode)
(use-package embark-consult
:ensure t
:after (embark consult)
:hook (embark-collect-mode . consult-preview-at-point-mode))
;; Hide markup markers
(customize-set-variable 'org-hide-emphasis-markers t)
(when (locate-library "org-appear")
(add-hook 'org-mode-hook 'org-appear-mode))
(setq 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
message-kill-buffer-on-exit t
mail-user-agent 'mu4e-user-agent
read-mail-command 'mu4e
mu4e-split-view 'single-window
mu4e-maildir "~/Mail"
mu4e-attachment-dir "~/Downloads"
mu4e-get-mail-command "mbsync -a"
mu4e-update-interval (* 5 60) ; Every 5 minutes
mu4e-sent-messages-behavior 'sent
mu4e-change-filenames-when-moving t
mu4e-context-policy 'pick-first
mu4e-use-fancy-chars t
mu4e-headers-thread-single-orphan-prefix '("─>" . "─▶")
mu4e-headers-thread-orphan-prefix '("┬>" . "┬▶")
mu4e-headers-thread-connection-prefix '("" . "")
mu4e-headers-thread-first-child-prefix '("├>" . "├▶")
mu4e-headers-thread-child-prefix '("├>" . "├▶")
mu4e-headers-thread-last-child-prefix '("└>" . "╰▶")
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" . "󱇫 ")
mu4e-alert-modeline-formatter 'mu4e-alert-default-mode-line-formatter
mu4e-headers-fields '((:human-date . 12)
(:flags . 6)
(:from-or-to . 25)
(:subject))
mu4e-headers-actions '(("org capture message" . mu4e-org-store-and-capture)
("capture message" . mu4e-action-capture-message)
("show this thread" . mu4e-action-show-thread))
mu4e-maildir-shortcuts '((:maildir "/Proton/Inbox/" :key ?p)
(:maildir "/iCloud/Inbox/" :key ?i)
(:maildir "/Outlook/Inbox/" :key ?w)))
;; Disable auto-pairing of "<" in org-mode with electric-pair-mode
(defun crafted-org-enhance-electric-pair-inhibit-predicate ()
"Disable auto-pairing of \"<\" in `org-mode' when using `electric-pair-mode'."
(when (and electric-pair-mode (eql major-mode #'org-mode))
(setq-local electric-pair-inhibit-predicate
`(lambda (c)
(if (char-equal c ?<)
t
(,electric-pair-inhibit-predicate c))))))
(use-package mu4e
:bind (("C-c m m" . mu4e)
("C-c m c" . mu4e-compose-new)
("C-c m s" . mu4e-search)
("C-c m b" . mu4e-search-bookmark)
("C-c m j" . mu4e-search-maildir))
:config (setq mu4e-contexts
(list
(make-mu4e-context
:name "Xenia"
:vars '((user-mail-address . "evie@xenia.me.uk")
(mu4e-sent-folder . "/Proton/Sent")
(mu4e-drafts-folder . "/Proton/Drafts")
(mu4e-trash-folder . "/Proton/Trash")
(mu4e-refile-folder . "/Proton/Archive")))
(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 Messages")
(mu4e-drafts-folder . "/iCloud/Drafts")
(mu4e-trash-folder . "/iCloud/Deleted Messages")
(mu4e-refile-folder . "/iCloud/Archive")))
(make-mu4e-context
:name "Work"
: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"))))))
;; Add hook to both electric-pair-mode-hook and org-mode-hook
;; This ensures org-mode buffers don't behave weirdly,
;; no matter when electric-pair-mode is activated.
(add-hook 'electric-pair-mode-hook #'crafted-org-enhance-electric-pair-inhibit-predicate)
(add-hook 'org-mode-hook #'crafted-org-enhance-electric-pair-inhibit-predicate)
(use-package mu4e-alert
:after mu4e
:config
(mu4e-alert-set-default-style 'libnotify)
(mu4e-alert-enable-notifications)
(mu4e-alert-enable-mode-line-display))
(with-eval-after-load 'tabspaces
(customize-set-variable 'tabspaces-use-filtered-buffers-as-default t)
(customize-set-variable 'tabspaces-remove-to-default t)
(customize-set-variable 'tabspaces-include-buffers '("*scratch*")))
(let ((elfeed-base-directory "~/.elfeed"))
(setq elfeed-db-directory (expand-file-name "db" elfeed-base-directory)
elfeed-enclosure-default-dir (expand-file-name "enclosures" elfeed-base-directory)
rmh-elfeed-org-files (list (expand-file-name "feeds.org" elfeed-base-directory))))
;; Activate it
(customize-set-variable 'tabspaces-mode t)
(use-package elfeed
:bind (("C-c f f" . elfeed)
("C-c f u" . elfeed-update))
:hook (elfeed-search-mode . elfeed-update)
:config
(use-package elfeed-org
:ensure t
:config (elfeed-org))
(use-package elfeed-tube
:ensure t
:config (elfeed-tube-setup)))
;; Make sure project is initialized
(project--ensure-read-project-list)
(setq mastodon-instance-url "https://tech.lgbt"
mastodon-active-user "Tux922")
(use-package mastodon
:commands mastodon)
(use-package ement
:commands ement-connect)
(when (require 'emms-setup nil :noerror)
(setq emms-player-list '(emms-player-mpv)
emms-info-functions '(emms-info-native)
emms-source-file-default-directory "~/Music"
emms-lyrics-dir "~/Music/lyrics"
emms-mode-line-icon-color "white")
(emms-all)
(add-hook 'emms-player-started-hook #'emms-show)
(add-hook 'emms-player-paused-hook #'emms-show)
(when (require 'hydra nil :noerror)
(defhydra emms (global-map "C-c e")
"emms"
("b" emms-smart-browse)
("d" emms-show)
("s" emms-start)
("S" emms-stop)
("n" emms-next)
("p" emms-previous)
("P" emms-pause))))
;;; Whitespace
(defun crafted-writing-configure-whitespace (use-tabs &optional use-globally &rest enabled-modes)
@ -733,119 +813,3 @@ Depends on having `pdf-tools'."
;; when pdf-tools is loaded, apply settings.
(with-eval-after-load 'pdf-tools
(setq-default pdf-view-display-size 'fit-width)))
(setq 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
message-kill-buffer-on-exit t
mail-user-agent 'mu4e-user-agent
read-mail-command 'mu4e
mu4e-split-view 'single-window
mu4e-maildir "~/Mail"
mu4e-attachment-dir "~/Downloads"
mu4e-get-mail-command "mbsync -a"
mu4e-update-interval (* 5 60) ; Every 5 minutes
mu4e-sent-messages-behavior 'sent
mu4e-change-filenames-when-moving t
mu4e-context-policy 'pick-first
mu4e-use-fancy-chars t
mu4e-headers-thread-single-orphan-prefix '("─>" . "─▶")
mu4e-headers-thread-orphan-prefix '("┬>" . "┬▶")
mu4e-headers-thread-connection-prefix '("" . "")
mu4e-headers-thread-first-child-prefix '("├>" . "├▶")
mu4e-headers-thread-child-prefix '("├>" . "├▶")
mu4e-headers-thread-last-child-prefix '("└>" . "╰▶")
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" . "󱇫 ")
mu4e-alert-modeline-formatter 'mu4e-alert-default-mode-line-formatter
mu4e-headers-fields '((:human-date . 12)
(:flags . 6)
(:from-or-to . 25)
(:subject))
mu4e-headers-actions '(("org capture message" . mu4e-org-store-and-capture)
("capture message" . mu4e-action-capture-message)
("show this thread" . mu4e-action-show-thread))
mu4e-maildir-shortcuts '((:maildir "/Proton/Inbox/" :key ?p)
(:maildir "/iCloud/Inbox/" :key ?i)
(:maildir "/Outlook/Inbox/" :key ?w)))
(use-package mu4e
:bind (("C-c m m" . mu4e)
("C-c m c" . mu4e-compose-new)
("C-c m s" . mu4e-search)
("C-c m b" . mu4e-search-bookmark)
("C-c m j" . mu4e-search-maildir))
:config (setq mu4e-contexts
(list
(make-mu4e-context
:name "Xenia"
:vars '((user-mail-address . "evie@xenia.me.uk")
(mu4e-sent-folder . "/Proton/Sent")
(mu4e-drafts-folder . "/Proton/Drafts")
(mu4e-trash-folder . "/Proton/Trash")
(mu4e-refile-folder . "/Proton/Archive")))
(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 Messages")
(mu4e-drafts-folder . "/iCloud/Drafts")
(mu4e-trash-folder . "/iCloud/Deleted Messages")
(mu4e-refile-folder . "/iCloud/Archive")))
(make-mu4e-context
:name "Work"
: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"))))))
(use-package mu4e-alert
:after mu4e
:config
(mu4e-alert-set-default-style 'libnotify)
(mu4e-alert-enable-notifications)
(mu4e-alert-enable-mode-line-display))
(let ((elfeed-base-directory "~/.elfeed"))
(setq elfeed-db-directory (expand-file-name "db" elfeed-base-directory)
elfeed-enclosure-default-dir (expand-file-name "enclosures" elfeed-base-directory)
rmh-elfeed-org-files (list (expand-file-name "feeds.org" elfeed-base-directory))))
(use-package elfeed
:bind (("C-c f f" . elfeed)
("C-c f u" . elfeed-update))
:hook (elfeed-search-mode . elfeed-update)
:config
(use-package elfeed-org
:ensure t
:config (elfeed-org))
(use-package elfeed-tube
:ensure t
:config (elfeed-tube-setup)))
(setq mastodon-instance-url "https://tech.lgbt"
mastodon-active-user "Tux922")
(use-package mastodon
:commands mastodon)
(use-package ement
:commands ement-connect)

View file

@ -384,6 +384,40 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
(add-hook 'org-agenda-mode-hook #'khalel-import-events)
(khalel-add-capture-template "e"))
#+end_src
** TODO Crafted config
#+BEGIN_SRC emacs-lisp
;; Return or left-click with mouse follows link
(customize-set-variable 'org-return-follows-link t)
(customize-set-variable 'org-mouse-1-follows-link t)
;; Display links as the description provided
(customize-set-variable 'org-link-descriptive t)
;; Visually indent org-mode files to a given header level
(add-hook 'org-mode-hook #'org-indent-mode)
;; Hide markup markers
(customize-set-variable 'org-hide-emphasis-markers t)
(when (locate-library "org-appear")
(add-hook 'org-mode-hook 'org-appear-mode))
;; Disable auto-pairing of "<" in org-mode with electric-pair-mode
(defun crafted-org-enhance-electric-pair-inhibit-predicate ()
"Disable auto-pairing of \"<\" in `org-mode' when using `electric-pair-mode'."
(when (and electric-pair-mode (eql major-mode #'org-mode))
(setq-local electric-pair-inhibit-predicate
`(lambda (c)
(if (char-equal c ?<)
t
(,electric-pair-inhibit-predicate c))))))
;; Add hook to both electric-pair-mode-hook and org-mode-hook
;; This ensures org-mode buffers don't behave weirdly,
;; no matter when electric-pair-mode is activated.
(add-hook 'electric-pair-mode-hook #'crafted-org-enhance-electric-pair-inhibit-predicate)
(add-hook 'org-mode-hook #'crafted-org-enhance-electric-pair-inhibit-predicate)
#+END_SRC
* Development Environment
#+BEGIN_SRC emacs-lisp
(use-package rainbow-delimiters
@ -460,11 +494,232 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
(use-package magit
:ensure t)
#+end_src
* Copy (to sort)
For now I'll just copy all config into this file, to confirm that it works properly.
Will reorganise into separate sections later
** [5/7] Completion
*** DONE Vertico
#+begin_src emacs-lisp
(setq vertico-cycle t)
(use-package vertico
:ensure t
:config
(require 'vertico-directory)
(vertico-mode +1))
#+end_src
** TODO Media
*** DONE Marginalia
#+begin_src emacs-lisp
(setq marginalia-annotators '(marginalia-annotators-heavy
marginalia-annotators-light
nil))
(use-package marginalia
:ensure t
:config (marginalia-mode +1))
#+end_src
*** DONE Orderless
#+begin_src emacs-lisp
(use-package orderless
:ensure t
:config (setq completion-styles '(orderless basic)
completion-category-overrides '((file (styles . (partial-completion))))))
#+end_src
*** TODO Corfu and Cape
#+begin_src emacs-lisp
(setq corfu-cycle t
corfu-auto t
corfu-auto-prefix 3
corfu-auto-delay 0.5)
(use-package corfu
:ensure t
:config
(global-corfu-mode +1)
(when (require 'corfu-popupinfo nil :noerror)
(corfu-popupinfo-mode 1)
(eldoc-add-command #'corfu-insert)
(keymap-set corfu-map "M-p" #'corfu-popupinfo-scroll-down)
(keymap-set corfu-map "M-n" #'corfu-popupinfo-scroll-up)
(keymap-set corfu-map "M-d" #'corfu-popupinfo-toggle)))
(use-package cape
:ensure t
:config
;; Setup Cape for better completion-at-point support and more
;; Add useful defaults completion sources from cape
(add-to-list 'completion-at-point-functions #'cape-file)
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
;; Silence the pcomplete capf, no errors or messages!
;; Important for corfu
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
;; Ensure that pcomplete does not write to the buffer
;; and behaves as a pure `completion-at-point-function'.
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify)
;; No auto-completion or completion-on-quit in eshell
(defun crafted-completion-corfu-eshell ()
"Special settings for when using corfu with eshell."
(setq-local corfu-quit-at-boundary t
corfu-quit-no-match t
corfu-auto nil)
(corfu-mode))
(add-hook 'eshell-mode-hook #'crafted-completion-corfu-eshell))
#+end_src
*** DONE Consult
#+begin_src emacs-lisp
(use-package consult
:ensure t
:bind (("C-s" . consult-line)
:map minibuffer-local-map
("C-r" . consult-history))
:config (setq completion-in-region-function #'consult-completion-in-region))
#+end_src
*** DONE Embark
#+begin_src emacs-lisp
(use-package embark
:ensure t
:bind (("<remap> <describe-bindings>" . embark-bindings)
("C-." . embark-act))
:config (setq prefix-help-command #'embark-prefix-help-command))
(use-package embark-consult
:ensure t
:after (embark consult)
:hook (embark-collect-mode . consult-preview-at-point-mode))
#+end_src
* Internet
** Email
#+BEGIN_SRC emacs-lisp
(setq 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
message-kill-buffer-on-exit t
mail-user-agent 'mu4e-user-agent
read-mail-command 'mu4e
mu4e-split-view 'single-window
mu4e-maildir "~/Mail"
mu4e-attachment-dir "~/Downloads"
mu4e-get-mail-command "mbsync -a"
mu4e-update-interval (* 5 60) ; Every 5 minutes
mu4e-sent-messages-behavior 'sent
mu4e-change-filenames-when-moving t
mu4e-context-policy 'pick-first
mu4e-use-fancy-chars t
mu4e-headers-thread-single-orphan-prefix '("─>" . "─▶")
mu4e-headers-thread-orphan-prefix '("┬>" . "┬▶")
mu4e-headers-thread-connection-prefix '("│ " . "│ ")
mu4e-headers-thread-first-child-prefix '("├>" . "├▶")
mu4e-headers-thread-child-prefix '("├>" . "├▶")
mu4e-headers-thread-last-child-prefix '("└>" . "╰▶")
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" . "󱇫 ")
mu4e-alert-modeline-formatter 'mu4e-alert-default-mode-line-formatter
mu4e-headers-fields '((:human-date . 12)
(:flags . 6)
(:from-or-to . 25)
(:subject))
mu4e-headers-actions '(("org capture message" . mu4e-org-store-and-capture)
("capture message" . mu4e-action-capture-message)
("show this thread" . mu4e-action-show-thread))
mu4e-maildir-shortcuts '((:maildir "/Proton/Inbox/" :key ?p)
(:maildir "/iCloud/Inbox/" :key ?i)
(:maildir "/Outlook/Inbox/" :key ?w)))
(use-package mu4e
:bind (("C-c m m" . mu4e)
("C-c m c" . mu4e-compose-new)
("C-c m s" . mu4e-search)
("C-c m b" . mu4e-search-bookmark)
("C-c m j" . mu4e-search-maildir))
:config (setq mu4e-contexts
(list
(make-mu4e-context
:name "Xenia"
:vars '((user-mail-address . "evie@xenia.me.uk")
(mu4e-sent-folder . "/Proton/Sent")
(mu4e-drafts-folder . "/Proton/Drafts")
(mu4e-trash-folder . "/Proton/Trash")
(mu4e-refile-folder . "/Proton/Archive")))
(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 Messages")
(mu4e-drafts-folder . "/iCloud/Drafts")
(mu4e-trash-folder . "/iCloud/Deleted Messages")
(mu4e-refile-folder . "/iCloud/Archive")))
(make-mu4e-context
:name "Work"
: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"))))))
(use-package mu4e-alert
:after mu4e
:config
(mu4e-alert-set-default-style 'libnotify)
(mu4e-alert-enable-notifications)
(mu4e-alert-enable-mode-line-display))
#+END_SRC
** Feeds
#+BEGIN_SRC emacs-lisp
(let ((elfeed-base-directory "~/.elfeed"))
(setq elfeed-db-directory (expand-file-name "db" elfeed-base-directory)
elfeed-enclosure-default-dir (expand-file-name "enclosures" elfeed-base-directory)
rmh-elfeed-org-files (list (expand-file-name "feeds.org" elfeed-base-directory))))
(use-package elfeed
:bind (("C-c f f" . elfeed)
("C-c f u" . elfeed-update))
:hook (elfeed-search-mode . elfeed-update)
:config
(use-package elfeed-org
:ensure t
:config (elfeed-org))
(use-package elfeed-tube
:ensure t
:config (elfeed-tube-setup)))
#+END_SRC
** Social
#+BEGIN_SRC emacs-lisp
(setq mastodon-instance-url "https://tech.lgbt"
mastodon-active-user "Tux922")
(use-package mastodon
:commands mastodon)
(use-package ement
:commands ement-connect)
#+END_SRC
* TODO Media
#+BEGIN_SRC emacs-lisp
(when (require 'emms-setup nil :noerror)
(setq emms-player-list '(emms-player-mpv)
@ -489,162 +744,7 @@ Will reorganise into separate sections later
("P" emms-pause))))
#+END_SRC
** TODO Completion (Crafted)
#+BEGIN_SRC emacs-lisp
;;; Vertico
(when (require 'vertico nil :noerror)
(require 'vertico-directory)
;; Cycle back to top/bottom result when the edge is reached
(customize-set-variable 'vertico-cycle t)
;; Start Vertico
(vertico-mode 1)
;; Turn off the built-in fido-vertical-mode and icomplete-vertical-mode, if
;; they have been turned on by crafted-defaults-config, because they interfere
;; with this module.
(with-eval-after-load 'crafted-defaults-config
(fido-mode -1)
(fido-vertical-mode -1)
(icomplete-mode -1)
(icomplete-vertical-mode -1)))
;;; Marginalia
(when (require 'marginalia nil :noerror)
;; Configure Marginalia
(customize-set-variable 'marginalia-annotators
'(marginalia-annotators-heavy
marginalia-annotators-light
nil))
(marginalia-mode 1))
;;; Consult
;; Since Consult doesn't need to be required, we assume the user wants these
;; setting if it is installed (regardless of the installation method).
(when (locate-library "consult")
;; Set some consult bindings
(keymap-global-set "C-s" 'consult-line)
(keymap-set minibuffer-local-map "C-r" 'consult-history)
(setq completion-in-region-function #'consult-completion-in-region))
;;; Orderless
(when (require 'orderless nil :noerror)
;; Set up Orderless for better fuzzy matching
(customize-set-variable 'completion-styles '(orderless basic))
(customize-set-variable 'completion-category-overrides
'((file (styles . (partial-completion))))))
;;; Embark
(when (require 'embark nil :noerror)
(keymap-global-set "<remap> <describe-bindings>" #'embark-bindings)
(keymap-global-set "C-." 'embark-act)
;; Use Embark to show bindings in a key prefix with `C-h`
(setq prefix-help-command #'embark-prefix-help-command)
(when (require 'embark-consult nil :noerror)
(with-eval-after-load 'embark-consult
(add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode))))
;;; Corfu
(when (require 'corfu nil :noerror)
(unless (display-graphic-p)
(when (require 'corfu-terminal nil :noerror)
(corfu-terminal-mode +1)))
;; Setup corfu for popup like completion
(customize-set-variable 'corfu-cycle t) ; Allows cycling through candidates
(customize-set-variable 'corfu-auto t) ; Enable auto completion
(customize-set-variable 'corfu-auto-prefix 2) ; Complete with less prefix keys
(global-corfu-mode 1)
(when (require 'corfu-popupinfo nil :noerror)
(corfu-popupinfo-mode 1)
(eldoc-add-command #'corfu-insert)
(keymap-set corfu-map "M-p" #'corfu-popupinfo-scroll-down)
(keymap-set corfu-map "M-n" #'corfu-popupinfo-scroll-up)
(keymap-set corfu-map "M-d" #'corfu-popupinfo-toggle)))
;;; Cape
(when (require 'cape nil :noerror)
;; Setup Cape for better completion-at-point support and more
;; Add useful defaults completion sources from cape
(add-to-list 'completion-at-point-functions #'cape-file)
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
;; Silence the pcomplete capf, no errors or messages!
;; Important for corfu
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
;; Ensure that pcomplete does not write to the buffer
;; and behaves as a pure `completion-at-point-function'.
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify)
;; No auto-completion or completion-on-quit in eshell
(defun crafted-completion-corfu-eshell ()
"Special settings for when using corfu with eshell."
(setq-local corfu-quit-at-boundary t
corfu-quit-no-match t
corfu-auto nil)
(corfu-mode))
(add-hook 'eshell-mode-hook #'crafted-completion-corfu-eshell))
#+END_SRC
** TODO Org (Crafted)
#+BEGIN_SRC emacs-lisp
;; Return or left-click with mouse follows link
(customize-set-variable 'org-return-follows-link t)
(customize-set-variable 'org-mouse-1-follows-link t)
;; Display links as the description provided
(customize-set-variable 'org-link-descriptive t)
;; Visually indent org-mode files to a given header level
(add-hook 'org-mode-hook #'org-indent-mode)
;; Hide markup markers
(customize-set-variable 'org-hide-emphasis-markers t)
(when (locate-library "org-appear")
(add-hook 'org-mode-hook 'org-appear-mode))
;; Disable auto-pairing of "<" in org-mode with electric-pair-mode
(defun crafted-org-enhance-electric-pair-inhibit-predicate ()
"Disable auto-pairing of \"<\" in `org-mode' when using `electric-pair-mode'."
(when (and electric-pair-mode (eql major-mode #'org-mode))
(setq-local electric-pair-inhibit-predicate
`(lambda (c)
(if (char-equal c ?<)
t
(,electric-pair-inhibit-predicate c))))))
;; Add hook to both electric-pair-mode-hook and org-mode-hook
;; This ensures org-mode buffers don't behave weirdly,
;; no matter when electric-pair-mode is activated.
(add-hook 'electric-pair-mode-hook #'crafted-org-enhance-electric-pair-inhibit-predicate)
(add-hook 'org-mode-hook #'crafted-org-enhance-electric-pair-inhibit-predicate)
#+END_SRC
** TODO Workspaces (Crafted)
#+BEGIN_SRC emacs-lisp
(with-eval-after-load 'tabspaces
(customize-set-variable 'tabspaces-use-filtered-buffers-as-default t)
(customize-set-variable 'tabspaces-remove-to-default t)
(customize-set-variable 'tabspaces-include-buffers '("*scratch*")))
;; Activate it
(customize-set-variable 'tabspaces-mode t)
;; Make sure project is initialized
(project--ensure-read-project-list)
#+END_SRC
** TODO Writing (Crafted)
* TODO Writing
#+BEGIN_SRC emacs-lisp
;;; Whitespace
(defun crafted-writing-configure-whitespace (use-tabs &optional use-globally &rest enabled-modes)
@ -818,130 +918,3 @@ Will reorganise into separate sections later
(setq-default pdf-view-display-size 'fit-width)))
#+END_SRC
* Internet
** Email
#+BEGIN_SRC emacs-lisp
(setq 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
message-kill-buffer-on-exit t
mail-user-agent 'mu4e-user-agent
read-mail-command 'mu4e
mu4e-split-view 'single-window
mu4e-maildir "~/Mail"
mu4e-attachment-dir "~/Downloads"
mu4e-get-mail-command "mbsync -a"
mu4e-update-interval (* 5 60) ; Every 5 minutes
mu4e-sent-messages-behavior 'sent
mu4e-change-filenames-when-moving t
mu4e-context-policy 'pick-first
mu4e-use-fancy-chars t
mu4e-headers-thread-single-orphan-prefix '("─>" . "─▶")
mu4e-headers-thread-orphan-prefix '("┬>" . "┬▶")
mu4e-headers-thread-connection-prefix '("│ " . "│ ")
mu4e-headers-thread-first-child-prefix '("├>" . "├▶")
mu4e-headers-thread-child-prefix '("├>" . "├▶")
mu4e-headers-thread-last-child-prefix '("└>" . "╰▶")
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" . "󱇫 ")
mu4e-alert-modeline-formatter 'mu4e-alert-default-mode-line-formatter
mu4e-headers-fields '((:human-date . 12)
(:flags . 6)
(:from-or-to . 25)
(:subject))
mu4e-headers-actions '(("org capture message" . mu4e-org-store-and-capture)
("capture message" . mu4e-action-capture-message)
("show this thread" . mu4e-action-show-thread))
mu4e-maildir-shortcuts '((:maildir "/Proton/Inbox/" :key ?p)
(:maildir "/iCloud/Inbox/" :key ?i)
(:maildir "/Outlook/Inbox/" :key ?w)))
(use-package mu4e
:bind (("C-c m m" . mu4e)
("C-c m c" . mu4e-compose-new)
("C-c m s" . mu4e-search)
("C-c m b" . mu4e-search-bookmark)
("C-c m j" . mu4e-search-maildir))
:config (setq mu4e-contexts
(list
(make-mu4e-context
:name "Xenia"
:vars '((user-mail-address . "evie@xenia.me.uk")
(mu4e-sent-folder . "/Proton/Sent")
(mu4e-drafts-folder . "/Proton/Drafts")
(mu4e-trash-folder . "/Proton/Trash")
(mu4e-refile-folder . "/Proton/Archive")))
(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 Messages")
(mu4e-drafts-folder . "/iCloud/Drafts")
(mu4e-trash-folder . "/iCloud/Deleted Messages")
(mu4e-refile-folder . "/iCloud/Archive")))
(make-mu4e-context
:name "Work"
: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"))))))
(use-package mu4e-alert
:after mu4e
:config
(mu4e-alert-set-default-style 'libnotify)
(mu4e-alert-enable-notifications)
(mu4e-alert-enable-mode-line-display))
#+END_SRC
** Feeds
#+BEGIN_SRC emacs-lisp
(let ((elfeed-base-directory "~/.elfeed"))
(setq elfeed-db-directory (expand-file-name "db" elfeed-base-directory)
elfeed-enclosure-default-dir (expand-file-name "enclosures" elfeed-base-directory)
rmh-elfeed-org-files (list (expand-file-name "feeds.org" elfeed-base-directory))))
(use-package elfeed
:bind (("C-c f f" . elfeed)
("C-c f u" . elfeed-update))
:hook (elfeed-search-mode . elfeed-update)
:config
(use-package elfeed-org
:ensure t
:config (elfeed-org))
(use-package elfeed-tube
:ensure t
:config (elfeed-tube-setup)))
#+END_SRC
** Social
#+BEGIN_SRC emacs-lisp
(setq mastodon-instance-url "https://tech.lgbt"
mastodon-active-user "Tux922")
(use-package mastodon
:commands mastodon)
(use-package ement
:commands ement-connect)
#+END_SRC