dev: merge branch 'master' of github.com:doomemacs

This commit is contained in:
Matt Nish-Lapidus 2024-09-05 11:31:00 -04:00
commit 7aaa532d27
11 changed files with 195 additions and 179 deletions

View file

@ -270,7 +270,6 @@ Note: warnings are not considered failures.")
hooks-path)) hooks-path))
(user-error "Aborted"))) (user-error "Aborted")))
(make-directory hooks-path 'parents) (make-directory hooks-path 'parents)
(print-group!
(dolist (hook '("commit-msg" "pre-push")) (dolist (hook '("commit-msg" "pre-push"))
(let* ((hook (doom-path hooks-path hook)) (let* ((hook (doom-path hooks-path hook))
(overwrite-p (file-exists-p hook))) (overwrite-p (file-exists-p hook)))
@ -282,7 +281,7 @@ Note: warnings are not considered failures.")
(set-file-modes hook #o700) (set-file-modes hook #o700)
(print! (success "%s %s") (print! (success "%s %s")
(if overwrite-p "Overwrote" "Created") (if overwrite-p "Overwrote" "Created")
(path hook))))))) (path hook))))))
;; TODO Move to 'doom lint commits' ;; TODO Move to 'doom lint commits'
(defcli! (ci lint-commits) (from &optional to) (defcli! (ci lint-commits) (from &optional to)

View file

@ -81,8 +81,9 @@ Change `$DOOMDIR' with the `--doomdir' option, e.g.
. ,(file-name-with-extension (doom-path template-dir doom-module-packages-file) . ,(file-name-with-extension (doom-path template-dir doom-module-packages-file)
".example.el"))))))) ".example.el")))))))
;; In case no init.el was present the first time it was loaded. ;; In case no init.el (or cli.el) was present before the config was deployed
(doom-load (doom-path doom-user-dir doom-module-init-file) t) (doom-load (doom-path doom-user-dir doom-module-init-file) t)
(doom-load (doom-path doom-user-dir "cli.el") t)
;; Ask if user would like an envvar file generated ;; Ask if user would like an envvar file generated
(if (eq envfile? :no) (if (eq envfile? :no)
@ -99,15 +100,19 @@ Change `$DOOMDIR' with the `--doomdir' option, e.g.
;; Install Doom packages ;; Install Doom packages
(if (eq install? :no) (if (eq install? :no)
(print! (warn "Not installing plugins, as requested")) (print! (warn "Not installing plugins, as requested"))
(print! "Installing plugins") (print! (start "Installing plugins"))
(doom-packages-ensure)) (print-group! (doom-packages-ensure)))
(print! "Regenerating autoloads files") (when (doom-profiles-bootloadable-p)
(doom-profile-generate) (print! (start "Initializing profile bootstrapper..."))
(call! '(profiles sync "--reload")))
(print! (start "Synchronizing default profile..."))
(print-group! (doom-profile-generate))
(if (eq hooks? :no) (if (eq hooks? :no)
(print! (warn "Not deploying commit-msg and pre-push git hooks, as requested")) (print! (warn "Not deploying commit-msg and pre-push git hooks, as requested"))
(print! "Deploying commit-msg and pre-push git hooks") (print! (start "Deploying commit-msg and pre-push git hooks"))
(print-group! (print-group!
(condition-case e (condition-case e
(call! `(ci deploy-hooks ,@(if yes? '("--force")))) (call! `(ci deploy-hooks ,@(if yes? '("--force"))))
@ -117,7 +122,7 @@ Change `$DOOMDIR' with the `--doomdir' option, e.g.
(when (file-exists-p "~/.emacs") (when (file-exists-p "~/.emacs")
(print! (warn "A ~/.emacs file was detected. This conflicts with Doom and should be deleted!"))) (print! (warn "A ~/.emacs file was detected. This conflicts with Doom and should be deleted!")))
(print! (success "\nFinished! Doom is ready to go!\n")) (print! (success "Finished! Doom is ready to go!\n"))
(with-temp-buffer (with-temp-buffer
(insert-file-contents (doom-path doom-emacs-dir "templates/QUICKSTART_INTRO")) (insert-file-contents (doom-path doom-emacs-dir "templates/QUICKSTART_INTRO"))
(print! "%s" (buffer-string))))) (print! "%s" (buffer-string)))))

View file

@ -48,11 +48,7 @@ If any return non-nil, `corfu-auto' will not invoke as-you-type completion.")
circe-mode circe-mode
help-mode help-mode
gud-mode gud-mode
vterm-mode vterm-mode)
;; Needed for `+corfu-want-minibuffer-completion' to be
;; respected. See #7977.
minibuffer-mode
minibuffer-inactive-mode)
t) t)
corfu-cycle t corfu-cycle t
corfu-preselect 'prompt corfu-preselect 'prompt
@ -70,6 +66,7 @@ If any return non-nil, `corfu-auto' will not invoke as-you-type completion.")
(add-to-list 'corfu-continue-commands #'+corfu/smart-sep-toggle-escape) (add-to-list 'corfu-continue-commands #'+corfu/smart-sep-toggle-escape)
(add-hook 'evil-insert-state-exit-hook #'corfu-quit) (add-hook 'evil-insert-state-exit-hook #'corfu-quit)
;; Respect `+corfu-want-minibuffer-completion'
(defun +corfu-enable-in-minibuffer-p () (defun +corfu-enable-in-minibuffer-p ()
"Return non-nil if Corfu should be enabled in the minibuffer. "Return non-nil if Corfu should be enabled in the minibuffer.
See `+corfu-want-minibuffer-completion'." See `+corfu-want-minibuffer-completion'."

View file

@ -1,7 +1,7 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; completion/corfu/packages.el ;;; completion/corfu/packages.el
(package! corfu :pin "921dd7c97ec41fe8ef81dd5f5a08b0f717586c86") (package! corfu :pin "0a616caedf10ebba812a87de3adacd24cd46522b")
(package! cape :pin "9110956a5155d5e3c460160fa1b4dac59322c229") (package! cape :pin "9110956a5155d5e3c460160fa1b4dac59322c229")
(when (modulep! +icons) (when (modulep! +icons)
(package! nerd-icons-corfu :pin "7077bb76fefc15aed967476406a19dc5c2500b3c")) (package! nerd-icons-corfu :pin "7077bb76fefc15aed967476406a19dc5c2500b3c"))

View file

@ -71,15 +71,6 @@
(setq woman-manpath manpath)))) (setq woman-manpath manpath))))
(use-package! drag-stuff
:defer t
:init
(map! "<M-up>" #'drag-stuff-up
"<M-down>" #'drag-stuff-down
"<M-left>" #'drag-stuff-left
"<M-right>" #'drag-stuff-right))
;;;###package tramp ;;;###package tramp
(unless (featurep :system 'windows) (unless (featurep :system 'windows)
(setq tramp-default-method "ssh")) ; faster than the default scp (setq tramp-default-method "ssh")) ; faster than the default scp

View file

@ -37,12 +37,16 @@ This module makes Emacs an email client, using [[https://www.djcbsoftware.nl/cod
- +gmail :: - +gmail ::
Enable gmail-specific configuration for mail ~To~ or ~From~ a gmail address, Enable gmail-specific configuration for mail ~To~ or ~From~ a gmail address,
or a maildir with ~gmail~ in the name. or a maildir with ~gmail~ in the name.
- +mbsync ::
Use [[https://isync.sourceforge.io/][mbsync]] to synchronize with mu.
- +offlineimap ::
Use [[https://www.offlineimap.org/about/][offlineimap]] to synchronize with mu.
- +org :: - +org ::
Use [[doom-package:org-msg]] for composing email in Org, then sending a multipart text (ASCII Use [[doom-package:org-msg]] for composing email in Org, then sending a multipart text (ASCII
export) and HTML message. export) and HTML message.
** Packages ** Packages
- [[doom-package:mu4e-alert]] - [[doom-package:mu4e-compat]]
- [[doom-package:org-msg]] if [[doom-module:+org]] - [[doom-package:org-msg]] if [[doom-module:+org]]
** TODO Hacks ** TODO Hacks
@ -93,12 +97,24 @@ If you use =msmtp=:
#+begin_src nix #+begin_src nix
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
mu mu
# For nixpkgs versions after 23.05: this installs Emacs with mu4e already
# included (you still need mu above; it just doesn't ship with mu4e anymore)
((emacsPackagesFor emacs).emacsWithPackages (epkgs: [ epkgs.mu4e ]))
# And one of the following # And one of the following
isync isync
offlineimap offlineimap
]; ];
#+end_src #+end_src
If you use ~home-manager~ you should specify ~mu4e~ as an additionally included
package as follows (requires ~nixpkgs~ > 23.05):
#+begin_src nix
programs.emacs = {
enable = true;
extraPackages = epkgs: [ epkgs.mu4e ];
}
#+end_src
[[https://github.com/Emiller88/dotfiles/blob/5eaabedf1b141c80a8d32e1b496055231476f65e/modules/shell/mail.nix][An example of setting up mbsync and mu with home-manager]] [[https://github.com/Emiller88/dotfiles/blob/5eaabedf1b141c80a8d32e1b496055231476f65e/modules/shell/mail.nix][An example of setting up mbsync and mu with home-manager]]
* TODO Usage * TODO Usage
@ -112,34 +128,30 @@ environment.systemPackages = with pkgs; [
#+end_quote #+end_quote
** offlineimap ** offlineimap
This module uses =mbsync= by default. To use =offlineimap=, change Enable this module with the =+offlineimap= flag, then [[https://www.offlineimap.org/doc/quick_start.html][write a configuration file]]
~+mu4e-backend~: for =offlineimap= ([[https://github.com/OfflineIMAP/offlineimap/blob/master/offlineimap.conf][a sample config file can be found in offlineimap's repo]]).
#+begin_src emacs-lisp
(setq +mu4e-backend 'offlineimap)
#+end_src
Next, you need to write a configuration file for =offlineimap=. Mine can be Next, download your email with ~$ offlineimap -o~. This may take a while,
found [[https://github.com/hlissner/dotfiles/blob/be0dce5dae8f3cbafaac0cc44269d84b4a742c46/shell/mu/][in my dotfiles repository]]. It is configured to download mail to depending on how many emails need downloading.
~\~/.mail~. I use [[https://www.passwordstore.org/][unix pass]] to securely store my login credentials. You can find
a *very* detailed configuration [[https://github.com/OfflineIMAP/offlineimap/blob/master/offlineimap.conf][here]].
Next you can download your email with ~$ offlineimap -o~. This may take a while, Then proceed to the "mu and mu4e" section below.
especially if you have thousands of mails.
You can now proceed with the [[#mu-and-mu4e][mu and mu4e]] section.
** mbsync ** mbsync
The steps needed to set up =mu4e= with =mbsync= are very similar to the ones for After this module has been enabled with the =+mbsync= flag, the steps to set up
[[#offlineimap][offlineimap]]. =mbsync= are similar to the ones for offlineimap:
Start with writing a =~/.mbsyncrc=. An example for Gmail can be found on Start with writing a =~/.mbsyncrc=. Here are some examples:
[[http://pragmaticemacs.com/emacs/migrating-from-offlineimap-to-mbsync-for-mu4e/][pragmaticemacs.com]]. A non-Gmail example is available as a gist [[https://gist.github.com/agraul/60977cc497c3aec44e10591f94f49ef0][here]]. The [[http://isync.sourceforge.net/mbsync.html][manual
page]] contains all needed information to set up your own.
Next you can download your email with ~$ mbsync --all~. This may take a while, - [[https://pragmaticemacs.wordpress.com/2016/03/22/migrating-from-offlineimap-to-mbsync-for-mu4e/][For Gmail accounts]],
but should be quicker than =offlineimap= ;). - [[https://rakhim.org/fastmail-setup-with-emacs-mu4e-and-mbsync-on-macos/][For Fastmail accounts]],
- [[https://gist.github.com/agraul/60977cc497c3aec44e10591f94f49ef0][A more generic example for other services]].
You can now proceed with the [[#mu-and-mu4e][mu and mu4e]] section. The [[http://isync.sourceforge.net/mbsync.html][manual page]] contains all needed information to set up your own.
Next, download your email with ~$ mbsync --all~. This may take a while, but
should be quicker than =offlineimap= ;).
Then proceed to the "mu and mu4e" section below.
*** Faster syncing *** Faster syncing
It's possible to use IMAP IDLE to be quickly notified of updates, then use a It's possible to use IMAP IDLE to be quickly notified of updates, then use a
@ -149,11 +161,9 @@ If this is of interest, this approach can be seen [[https://tecosaur.github.io/e
[[https://gitlab.com/shackra/goimapnotify][goimapnotify]] is used for this. [[https://gitlab.com/shackra/goimapnotify][goimapnotify]] is used for this.
** Fetching your mail in other ways ** Fetching your mail in other ways
You also have the possiblity to invoke an arbitary shell command to fetch your Mu4e can be configured to call an arbitary shell command to fetch your email. To
mail by disabling this module's backend selection and setting the value of the use it, set [[var:mu4e-get-mail-command]]:
~mu4e-get-mail-command~ to the command you want to execute:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq +mu4e-backend nil)
(after! mu4e (after! mu4e
(setq mu4e-get-mail-command "your_command")) (setq mu4e-get-mail-command "your_command"))
#+end_src #+end_src
@ -356,9 +366,9 @@ mail retrieval/indexing, change the value of ~mu4e-update-interval~:
You will get =No such file or directory, mu4e= errors if you don't run ~$ doom You will get =No such file or directory, mu4e= errors if you don't run ~$ doom
sync~ after installing =mu= through your package manager. sync~ after installing =mu= through your package manager.
Some times the ~mu~ package does not include ~mu4e~ (*cough Ubuntu*). if Sometimes the ~mu~ package does not include ~mu4e~ (*cough Ubuntu*). If that's
that's the case you will need to [[https://github.com/djcb/mu][install]] it and add it to your ~load-path~ you the case you will need to [[https://github.com/djcb/mu][install]] it and add it to your ~load-path~. You can
can do that by: do that by:
#+begin_src emacs-lisp #+begin_src emacs-lisp
(add-to-list 'load-path "your/path/to/mu4e") (add-to-list 'load-path "your/path/to/mu4e")
;; if you installed it using your package manager ;; if you installed it using your package manager

View file

@ -281,7 +281,8 @@ attach a file, or select a folder to open dired in and select file attachments
When otherwise called, open a dired buffer and enable `dired-mu4e-attach-ctrl-c-ctrl-c'." When otherwise called, open a dired buffer and enable `dired-mu4e-attach-ctrl-c-ctrl-c'."
;; TODO add ability to attach files (+dirs) as a single (named) archive ;; TODO add ability to attach files (+dirs) as a single (named) archive
(interactive "p") (interactive "p")
(+mu4e-compose-org-msg-handle-toggle (/= 1 files-to-attach)) (when (fboundp '+mu4e-compose-org-msg-handle-toggle)
(+mu4e-compose-org-msg-handle-toggle (/= 1 files-to-attach)))
(pcase major-mode (pcase major-mode
((or 'mu4e-compose-mode 'org-msg-edit-mode) ((or 'mu4e-compose-mode 'org-msg-edit-mode)
(let ((mail-buffer (current-buffer)) (let ((mail-buffer (current-buffer))

View file

@ -2,6 +2,7 @@
(defvar +mu4e-backend 'mbsync (defvar +mu4e-backend 'mbsync
"Which backend to use. Can either be offlineimap, mbsync or nil (manual).") "Which backend to use. Can either be offlineimap, mbsync or nil (manual).")
(make-obsolete-variable '+mu4e-backend "Use the :email mu4e module's +mbsync or +offlineimap flags instead" "3.0.0")
(defvar +mu4e-personal-addresses 'nil (defvar +mu4e-personal-addresses 'nil
"Alternative to mu4e-personal-addresses that can be set for each account (mu4e context).") "Alternative to mu4e-personal-addresses that can be set for each account (mu4e context).")
@ -19,10 +20,32 @@
(version< mu4e-mu-version "1.4")) (version< mu4e-mu-version "1.4"))
(setq mu4e-maildir "~/.mail" (setq mu4e-maildir "~/.mail"
mu4e-user-mail-address-list nil)) mu4e-user-mail-address-list nil))
(setq mu4e-attachment-dir
(lambda (&rest _)
(expand-file-name ".attachments" (mu4e-root-maildir))))
:config :config
(add-to-list 'doom-debug-variables 'mu4e-debug)
;; mu4e now uses `display-buffer-alist' so we need to add some rules of our own
(set-popup-rule! "^\\*mu4e-\\(main\\|headers\\)\\*" :ignore t)
;; Ensures backward/forward compatibility for mu4e, which is prone to breaking
;; updates, and also cannot be pinned, because it's bundled with mu (which you
;; must install via your OS package manager).
(with-demoted-errors "%s" (require 'mu4e-compat nil t))
;; For users on older mu4e.
(unless (boundp 'mu4e-headers-buffer-name)
(defvar mu4e-headers-buffer-name "*mu4e-headers*"))
(cond ((or (modulep! +mbsync)
(eq +mu4e-backend 'mbsync))
(setq mu4e-get-mail-command
(format "mbsync --all --config %S"
;; XDG support was added to isync 1.5, but this lets
;; users on older benefit from it sooner.
(or (file-exists-p! "isyncrc" (or (getenv "XDG_CONFIG_HOME") "~/.config"))
"~/.mbsyncrc"))
mu4e-change-filenames-when-moving t))
((or (modulep! +offlineimap)
(eq +mu4e-backend 'offlineimap))
(setq mu4e-get-mail-command "offlineimap -o -q")))
(when (version< mu4e-mu-version "1.8") (when (version< mu4e-mu-version "1.8")
;; Define aliases to maintain backwards compatibility. The list of suffixes ;; Define aliases to maintain backwards compatibility. The list of suffixes
;; were obtained by comparing mu4e~ and mu4e-- functions in `obarray'. ;; were obtained by comparing mu4e~ and mu4e-- functions in `obarray'.
@ -67,13 +90,6 @@ is non-nil."
mu4e-view-image-max-width 800 mu4e-view-image-max-width 800
mu4e-view-use-gnus t)) mu4e-view-use-gnus t))
(pcase +mu4e-backend
(`mbsync
(setq mu4e-get-mail-command "mbsync -a"
mu4e-change-filenames-when-moving t))
(`offlineimap
(setq mu4e-get-mail-command "offlineimap -o -q")))
(setq mu4e-update-interval nil (setq mu4e-update-interval nil
mu4e-notification-support t mu4e-notification-support t
mu4e-sent-messages-behavior 'sent mu4e-sent-messages-behavior 'sent
@ -223,15 +239,13 @@ is non-nil."
;; Wrap text in messages ;; Wrap text in messages
(setq-hook! 'mu4e-view-mode-hook truncate-lines nil) (setq-hook! 'mu4e-view-mode-hook truncate-lines nil)
;; mu4e now uses `display-buffer-alist' so we need to add some rules of our own
(set-popup-rule! "^\\*mu4e-\\(main\\|headers\\)\\*" :ignore t)
;; Html mails might be better rendered in a browser ;; Html mails might be better rendered in a browser
(add-to-list 'mu4e-view-actions '("View in browser" . mu4e-action-view-in-browser)) (add-to-list 'mu4e-view-actions '("view in browser" . mu4e-action-view-in-browser))
(when (fboundp 'make-xwidget) (when (fboundp 'xwidget-webkit-browse-url)
(add-to-list 'mu4e-view-actions '("xwidgets view" . mu4e-action-view-in-xwidget))) (add-to-list 'mu4e-view-actions '("xview in xwidget" . mu4e-action-view-in-xwidget)))
;; Detect empty subjects, and give users an opotunity to fill something in ;; Detect empty subjects, and give users an opotunity to fill something in
(add-hook! 'message-send-hook
(defun +mu4e-check-for-subject () (defun +mu4e-check-for-subject ()
"Check that a subject is present, and prompt for a subject if not." "Check that a subject is present, and prompt for a subject if not."
(save-excursion (save-excursion
@ -242,31 +256,29 @@ is non-nil."
(when (string-empty-p subject) (when (string-empty-p subject)
(end-of-line) (end-of-line)
(insert (read-string "Subject (optional): ")) (insert (read-string "Subject (optional): "))
(message "Sending..."))))) (message "Sending..."))))))
(add-hook 'message-send-hook #'+mu4e-check-for-subject) ;; The header view needs a certain amount of horizontal space to actually show
;; you all the information you want to see so if the header view is entered
;; The header view needs a certain amount of horizontal space to ;; from a narrow frame, it's probably worth trying to expand it
;; actually show you all the information you want to see (defvar +mu4e-min-header-frame-width 120
;; so if the header view is entered from a narrow frame, "Minimum reasonable with for the header view.")
;; it's probably worth trying to expand it (add-hook! 'mu4e-headers-mode-hook
(defun +mu4e-widen-frame-maybe () (defun +mu4e-widen-frame-maybe ()
"Expand the mu4e-headers containing frame's width to `+mu4e-min-header-frame-width'." "Expand the mu4e-headers containing frame's width to `+mu4e-min-header-frame-width'."
(dolist (frame (frame-list)) (dolist (frame (frame-list))
(when (and (string= (buffer-name (window-buffer (frame-selected-window frame))) (when (and (string= (buffer-name (window-buffer (frame-selected-window frame)))
mu4e-headers-buffer-name) mu4e-headers-buffer-name)
(< (frame-width) +mu4e-min-header-frame-width)) (< (frame-width) +mu4e-min-header-frame-width))
(set-frame-width frame +mu4e-min-header-frame-width)))) (set-frame-width frame +mu4e-min-header-frame-width)))))
(add-hook 'mu4e-headers-mode-hook #'+mu4e-widen-frame-maybe)
(when (fboundp 'imagemagick-register-types) (when (fboundp 'imagemagick-register-types)
(imagemagick-register-types)) (imagemagick-register-types))
(when (modulep! :ui workspaces) (map! (:when (modulep! :ui workspaces)
(map! :map mu4e-main-mode-map :map mu4e-main-mode-map
:ne "h" #'+workspace/other)) :ne "h" #'+workspace/other)
:map mu4e-headers-mode-map
(map! :map mu4e-headers-mode-map
:vne "l" #'+mu4e/capture-msg-to-agenda) :vne "l" #'+mu4e/capture-msg-to-agenda)
;; Functionality otherwise obscured in mu4e 1.6 ;; Functionality otherwise obscured in mu4e 1.6
@ -344,18 +356,19 @@ Acts like a singular `mu4e-view-save-attachments', without the saving."
:desc "save draft" "S" #'message-dont-send :desc "save draft" "S" #'message-dont-send
:desc "attach" "a" #'+mu4e/attach-files) :desc "attach" "a" #'+mu4e/attach-files)
;; Due to evil, none of the marking commands work when making a visual selection in ;; Due to evil, none of the marking commands work when making a visual
;; the headers view of mu4e. Without overriding any evil commands we may actually ;; selection in the headers view of mu4e. Without overriding any evil commands
;; want to use in and evil selection, this can be easily fixed. ;; we may actually want to use in and evil selection, this can be easily
(when (modulep! :editor evil) ;; fixed.
(map! :map mu4e-headers-mode-map (map! :map mu4e-headers-mode-map
:v "*" #'mu4e-headers-mark-for-something :v "*" #'mu4e-headers-mark-for-something
:v "!" #'mu4e-headers-mark-for-read :v "!" #'mu4e-headers-mark-for-read
:v "?" #'mu4e-headers-mark-for-unread :v "?" #'mu4e-headers-mark-for-unread
:v "u" #'mu4e-headers-mark-for-unmark)) :v "u" #'mu4e-headers-mark-for-unmark)
(add-hook 'mu4e-compose-pre-hook '+mu4e-set-from-address-h) (add-hook 'mu4e-compose-pre-hook #'+mu4e-set-from-address-h)
;; HACK
(defadvice! +mu4e-ensure-compose-writeable-a (&rest _) (defadvice! +mu4e-ensure-compose-writeable-a (&rest _)
"Ensure that compose buffers are writable. "Ensure that compose buffers are writable.
This should already be the case yet it does not always seem to be." This should already be the case yet it does not always seem to be."
@ -365,29 +378,23 @@ This should already be the case yet it does not always seem to be."
:before #'mu4e-compose-resend :before #'mu4e-compose-resend
(read-only-mode -1)) (read-only-mode -1))
;; process lock control ;; HACK: process lock control
(when (featurep :system 'windows) (when (featurep :system 'windows)
(setq (setq +mu4e-lock-file (expand-file-name "~/AppData/Local/Temp/mu4e_lock")
+mu4e-lock-file (expand-file-name "~/AppData/Local/Temp/mu4e_lock")
+mu4e-lock-request-file (expand-file-name "~/AppData/Local/Temp/mu4e_lock_request"))) +mu4e-lock-request-file (expand-file-name "~/AppData/Local/Temp/mu4e_lock_request")))
(add-hook 'kill-emacs-hook #'+mu4e-lock-file-delete-maybe) (add-hook 'kill-emacs-hook #'+mu4e-lock-file-delete-maybe)
(advice-add 'mu4e--start :around #'+mu4e-lock-start) (advice-add #'mu4e--start :around #'+mu4e-lock-start)
(advice-add 'mu4e-quit :after #'+mu4e-lock-file-delete-maybe)) (advice-add #'mu4e-quit :after #'+mu4e-lock-file-delete-maybe))
(unless (modulep! +org)
(after! mu4e
(defun org-msg-mode (&optional _)
"Dummy function."
(message "Enable the +org mu4e flag to use org-msg-mode."))
(defun +mu4e-compose-org-msg-handle-toggle (&rest _)
"Placeholder to allow for the assumtion that this function is defined.
Ignores all arguments and returns nil."
nil)))
(use-package! org-msg (use-package! org-msg
:after mu4e
:when (modulep! +org) :when (modulep! +org)
:defer t
:init
;; Avoid using `:after' because it ties the :config below to when `mu4e'
;; loads, rather than when `org-msg' loads.
(after! mu4e (require 'org-msg))
:config :config
(setq org-msg-options "html-postamble:nil H:5 num:nil ^:{} toc:nil author:nil email:nil tex:dvipng" (setq org-msg-options "html-postamble:nil H:5 num:nil ^:{} toc:nil author:nil email:nil tex:dvipng"
org-msg-startup "hidestars indent inlineimages" org-msg-startup "hidestars indent inlineimages"
@ -403,26 +410,25 @@ Ignores all arguments and returns nil."
(\\(?:attached\\|enclosed\\))\\|\ (\\(?:attached\\|enclosed\\))\\|\
\\(?:attached\\|enclosed\\)[ \t\n]\\(?:for\\|is\\)[ \t\n]") \\(?:attached\\|enclosed\\)[ \t\n]\\(?:for\\|is\\)[ \t\n]")
(defvar +org-msg-currently-exporting nil
"Helper variable to indicate whether org-msg is currently exporting the org buffer to HTML.
Usefull for affecting HTML export config.")
(defadvice! +org-msg--now-exporting-a (&rest _)
:before #'org-msg-org-to-xml
(setq +org-msg-currently-exporting t))
(defadvice! +org-msg--not-exporting-a (&rest _)
:after #'org-msg-org-to-xml
(setq +org-msg-currently-exporting nil))
(advice-add #'org-html-latex-fragment :override #'+org-html-latex-fragment-scaled-a)
(advice-add #'org-html-latex-environment :override #'+org-html-latex-environment-scaled-a)
(map! :map org-msg-edit-mode-map (map! :map org-msg-edit-mode-map
"TAB" #'org-msg-tab ; To mirror the binding on <tab>
:desc "attach" "C-c C-a" #'+mu4e/attach-files :desc "attach" "C-c C-a" #'+mu4e/attach-files
:localleader :localleader
:desc "attach" "a" #'+mu4e/attach-files) :desc "attach" "a" #'+mu4e/attach-files)
;; I feel like it's reasonable to expect files to be attached ;; HACK: ...
;; in the order you attach them, not the reverse. (defvar +org-msg-currently-exporting nil
"Non-nil if org-msg is currently exporting the org buffer to HTML.")
(defadvice! +org-msg--now-exporting-a (fn &rest args)
:around #'org-msg-org-to-xml
(let ((+org-msg-currently-exporting t))
(apply fn args)))
;; HACK: ...
(advice-add #'org-html-latex-fragment :override #'+org-html-latex-fragment-scaled-a)
(advice-add #'org-html-latex-environment :override #'+org-html-latex-environment-scaled-a)
;; HACK: Ensure files are attached in the order they were attached.
(defadvice! +org-msg-attach-attach-in-order-a (file &rest _args) (defadvice! +org-msg-attach-attach-in-order-a (file &rest _args)
"Link FILE into the list of attachment." "Link FILE into the list of attachment."
:override #'org-msg-attach-attach :override #'org-msg-attach-attach
@ -431,31 +437,28 @@ Usefull for affecting HTML export config.")
(org-msg-set-prop "attachment" (nconc files (list file))))) (org-msg-set-prop "attachment" (nconc files (list file)))))
(defvar +mu4e-compose-org-msg-toggle-next t ; t to initialise org-msg (defvar +mu4e-compose-org-msg-toggle-next t ; t to initialise org-msg
"Whether to toggle ") "Whether to toggle `org-msg-toggle' on ")
(defun +mu4e-compose-org-msg-handle-toggle (toggle-p) (defun +mu4e-compose-org-msg-handle-toggle (toggle-p)
(when (xor toggle-p +mu4e-compose-org-msg-toggle-next) (when (xor toggle-p +mu4e-compose-org-msg-toggle-next)
(org-msg-mode (if org-msg-mode -1 1)) (org-msg-mode (if org-msg-mode -1 1))
(setq +mu4e-compose-org-msg-toggle-next (setq +mu4e-compose-org-msg-toggle-next
(not +mu4e-compose-org-msg-toggle-next)))) (not +mu4e-compose-org-msg-toggle-next))))
(defadvice! +mu4e-maybe-toggle-org-msg-a (fn &optional toggle-p) ;; HACK: ...
:around #'mu4e-compose-new (defadvice! +mu4e-maybe-toggle-org-msg-a (&rest _)
:around #'mu4e-compose-reply :before #'mu4e-compose-new
:around #'mu4e-compose-forward :before #'mu4e-compose-reply
:around #'mu4e-compose-resend :before #'mu4e-compose-forward
(interactive "p") :before #'mu4e-compose-resend
(+mu4e-compose-org-msg-handle-toggle (/= 1 (or toggle-p 0))) (+mu4e-compose-org-msg-handle-toggle (/= 1 (or current-prefix-arg 0))))
(funcall fn))
;; HACK: ...
(defadvice! +mu4e-draft-open-signature-a (fn &rest args) (defadvice! +mu4e-draft-open-signature-a (fn &rest args)
"Prevent `mu4e-compose-signature' from being used with `org-msg-mode'." "Prevent `mu4e-compose-signature' from being used with `org-msg-mode'."
:around #'mu4e-draft-open :around #'mu4e-draft-open
(let ((mu4e-compose-signature (unless org-msg-mode mu4e-compose-signature))) (let ((mu4e-compose-signature (unless org-msg-mode mu4e-compose-signature)))
(apply fn args))) (apply fn args)))
(map! :map org-msg-edit-mode-map
"TAB" #'org-msg-tab) ; only <tab> bound by default
(defvar +org-msg-accent-color "#c01c28" (defvar +org-msg-accent-color "#c01c28"
"Accent color to use in org-msg's generated CSS. "Accent color to use in org-msg's generated CSS.
Must be set before org-msg is loaded to take effect.") Must be set before org-msg is loaded to take effect.")
@ -472,8 +475,7 @@ Must be set before org-msg is loaded to take effect.")
(table `((margin-top . "6px") (margin-bottom . "6px") (table `((margin-top . "6px") (margin-bottom . "6px")
(border-left . "none") (border-right . "none") (border-left . "none") (border-right . "none")
(border-top . "2px solid #222222") (border-top . "2px solid #222222")
(border-bottom . "2px solid #222222") (border-bottom . "2px solid #222222")))
))
(ftl-number `(,color ,bold (text-align . "left"))) (ftl-number `(,color ,bold (text-align . "left")))
(inline-modes '(asl c c++ conf cpp csv diff ditaa emacs-lisp (inline-modes '(asl c c++ conf cpp csv diff ditaa emacs-lisp
fundamental ini json makefile man org plantuml fundamental ini json makefile man org plantuml

View file

@ -1,5 +1,8 @@
;; -*- no-byte-compile: t; -*- ;; -*- no-byte-compile: t; -*-
;;; email/mu4e/packages.el ;;; email/mu4e/packages.el
(package! mu4e-compat
:recipe (:host github :repo "tecosaur/mu4e-compat")
:pin "a33345cb8ef83554f01510bbc8f5c7323713aa8d")
(when (modulep! +org) (when (modulep! +org)
(package! org-msg :pin "0b65f0f77a7a71881ddfce19a8cdc60465bda057")) (package! org-msg :pin "59e2042e5f23e25f31c6aef0db1e70c6f54f117d"))

View file

@ -23,6 +23,18 @@
(add-hook 'doom-first-file-hook #'centaur-tabs-mode)) (add-hook 'doom-first-file-hook #'centaur-tabs-mode))
:config :config
(defun +tabs-buffer-list ()
(seq-filter (lambda (b)
(cond ((eq (current-buffer) b) b)
((doom-temp-buffer-p b) nil)
((doom-unreal-buffer-p b) nil)
((buffer-file-name b) b)
((buffer-live-p b) b)))
(if (bound-and-true-p persp-mode)
(persp-buffer-list)
(buffer-list))))
(setq centaur-tabs-buffer-list-function #'+tabs-buffer-list)
(add-hook! '(+doom-dashboard-mode-hook +popup-buffer-mode-hook) (add-hook! '(+doom-dashboard-mode-hook +popup-buffer-mode-hook)
(defun +tabs-disable-centaur-tabs-mode-maybe-h () (defun +tabs-disable-centaur-tabs-mode-maybe-h ()
"Disable `centaur-tabs-mode' in current buffer." "Disable `centaur-tabs-mode' in current buffer."

View file

@ -1,19 +1,15 @@
But before you doom yourself, here are some things you should know: But before you doom yourself, here are some things you should know:
1. Don't forget to run 'doom sync', then restart Emacs, after modifying init.el 1. Don't forget to run 'doom sync' and restart Emacs after modifying init.el or
or packages.el in ~/.config/doom. packages.el in ~/.config/doom. This is never necessary for config.el.
This command ensures needed packages are installed, orphaned packages are 2. If something goes wrong, run `doom doctor` to diagnose common issues with
removed, and your autoloads/cache files are up to date. When in doubt, run your environment, setup, and config.
'doom sync'!
2. If something goes wrong, run `doom doctor`. It diagnoses common issues with
your environment and setup, and may offer clues about what is wrong.
3. Use 'doom upgrade' to update Doom. Doing it any other way will require 3. Use 'doom upgrade' to update Doom. Doing it any other way will require
additional steps. Run 'doom help upgrade' to understand those extra steps. additional steps (see 'doom help upgrade').
4. Access Doom's documentation from within Emacs via 'SPC h d h' or 'C-h d h' 4. Access Doom's documentation from within Emacs via 'SPC h d h' or 'C-h d h'
(or 'M-x doom/help') (or 'M-x doom/help').
Have fun! Have fun!