Compare commits

..

11 Commits

2 changed files with 44 additions and 25 deletions

View File

@@ -326,24 +326,25 @@ This returns a hash table of cid -> path."
ARG is passed directly to `message-send'."
;; This has to return a non-nil value so that org knows we handled the C-c C-c
(interactive "P")
(let ((modified (buffer-modified-p))
;; we only restore the restriction if the sending below fails
(old-rest (cons (point-min) (point-max))))
(widen)
(let ((save-text (buffer-substring-no-properties (point-min)
(point-max))))
(condition-case _
(progn
(when org-mu4e--html-message-p
(org-mu4e--htmlize-and-cleanup))
(message-send arg)
'sent)
((or error quit)
(erase-buffer)
(insert save-text)
(narrow-to-region (car old-rest) (cdr old-rest))
(restore-buffer-modified-p modified)
'failed)))))
(save-current-buffer
(let ((modified (buffer-modified-p))
;; we only restore the restriction if the sending below fails
(old-rest (cons (point-min) (point-max))))
(widen)
(let ((save-text (buffer-substring-no-properties (point-min)
(point-max))))
(condition-case _
(progn
(when org-mu4e--html-message-p
(org-mu4e--htmlize-and-cleanup))
(message-send arg)
'sent)
((or error quit)
(erase-buffer)
(insert save-text)
(narrow-to-region (car old-rest) (cdr old-rest))
(restore-buffer-modified-p modified)
'failed))))))
(defun org-mu4e-send-and-exit (&optional arg)
"Call `org-mu4e-send', the save and kill the buffer.

32
init.el
View File

@@ -4,6 +4,13 @@
(require 'cl-lib)
(require 'xdg)
;; Setup PATH
(dolist (file '("/usr/local/sbin" "~/.local/bin" "~/.ghcup/bin"
"/usr/bin/site_perl" "/usr/bin/vendor_perl"
"/usr/bin/core_perl"))
(add-to-list 'exec-path (directory-file-name
(expand-file-name file))))
;; Some other config files
(cl-eval-when (compile load eval)
(add-to-list 'load-path (expand-file-name "elisp" user-emacs-directory))
@@ -2076,6 +2083,7 @@ This is :around advice, so OLDFUN is the real function
:ensure nil
:hook (sh-mode . my/-setup-sh-mode)
:init
(add-to-list 'auto-mode-alist '("/\\.envrc\\'" . sh-mode))
(defun my/-setup-sh-mode ()
(add-hook 'completion-at-point-functions #'cape-file nil t)))
@@ -2332,6 +2340,11 @@ Note that this erases the buffer before doing anything."
(keymap-set java-ts-mode-map "C-c C-b" #'inferior-cc-eval-buffer)
(keymap-set java-ts-mode-map "C-M-x" #'inferior-cc-eval-defun))
;; racket
(use-package racket-mode
:hook ((racket-mode . rainbow-delimiters-mode)
(racket-mode . evil-cleverparens-mode)))
;; jupyter
(use-package jupyter
:hook (jupyter-repl-mode . my/-setup-jupyter-mode)
@@ -2837,10 +2850,10 @@ Actually, return the method name."
("ga" "git add $*")
("gcm" "git commit -m ${string-join $* \" \"}")
("ldg" "ledger -f \"$HOME/docs/finance/finances.ledger\" $*")
("tp" "trash-put $*")
("trr" "trash-restore $*")
("tre" "trash-empty $*")
("trm" "trash-rm $*")
("tp" "clash put $*")
("trr" "clash restore $*")
("tre" "clash empty $*")
("trm" "clash empty $*")
("rm" "echo 'rm: I''m unsafe! Don''t use me.'; false")
("\\rm" "eshell/rm")))
@@ -3218,6 +3231,9 @@ The name is compared with the field name using TESTFN (defaults to `equal')."
("C-c k" . khard-insert-email-contact))
:init
(require 'mu4e)
(evil-define-key '(normal motion) mu4e-headers-mode-map
"j" #'next-line
"k" #'previous-line)
(evil-define-key '(normal motion) mu4e-main-mode-map "q" #'bury-buffer)
(evil-define-key '(normal motion) mu4e-view-mode-map
"gy" #'mu4e-view-save-url
@@ -3266,7 +3282,7 @@ This is the same as `evil-ret' except that it works for links in
(concat "flag:unread AND NOT flag:trashed AND NOT "
"maildir:/protonmail/Trash AND NOT maildir:/protonmail/Spam AND NOT "
"maildir:/ucsc-gmail/[Gmail]/Trash AND NOT "
"maildir:/ucsc-gmail/[Gmail]/Spam")
"maildir:/ucsc-gmail/[Gmail]/Spam AND NOT maildir:\"/ucsc-gmail/[Gmail]/All Mail\"")
"Flag for mail which will appear as \"unread\" and will be notified.")
(setq message-kill-buffer-on-exit t
message-confirm-send t
@@ -3304,7 +3320,8 @@ This is the same as `evil-ret' except that it works for links in
(mu4e-refile-folder . "/protonmail/Archive")
(mu4e-sent-folder . "/protonmail/Sent")
(mu4e-drafts-folder . "/protonmail/Drafts")
(mu4e-trash-folder . "/protonmail/Trash")))
(mu4e-trash-folder . "/protonmail/Trash")
(mu4e-sent-messages-behavior . sent)))
(make-mu4e-context
:name "School"
:match-func (lambda (msg)
@@ -3319,7 +3336,8 @@ This is the same as `evil-ret' except that it works for links in
(mu4e-refile-folder . "/ucsc-gmail/[Gmail]/All Mail")
(mu4e-sent-folder . "/ucsc-gmail/[Gmail]/Sent Mail")
(mu4e-drafts-folder . "/ucsc-gmail/[Gmail]/Drafts")
(mu4e-trash-folder . "/ucsc-gmail/[Gmail]/Trash"))))))
(mu4e-trash-folder . "/ucsc-gmail/[Gmail]/Trash")
(mu4e-sent-messages-behavior . delete))))))
(use-package mu4e-alert
:after mu4e
:hook (after-init . mu4e-alert-enable-notifications)