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'." 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 ;; This has to return a non-nil value so that org knows we handled the C-c C-c
(interactive "P") (interactive "P")
(let ((modified (buffer-modified-p)) (save-current-buffer
;; we only restore the restriction if the sending below fails (let ((modified (buffer-modified-p))
(old-rest (cons (point-min) (point-max)))) ;; we only restore the restriction if the sending below fails
(widen) (old-rest (cons (point-min) (point-max))))
(let ((save-text (buffer-substring-no-properties (point-min) (widen)
(point-max)))) (let ((save-text (buffer-substring-no-properties (point-min)
(condition-case _ (point-max))))
(progn (condition-case _
(when org-mu4e--html-message-p (progn
(org-mu4e--htmlize-and-cleanup)) (when org-mu4e--html-message-p
(message-send arg) (org-mu4e--htmlize-and-cleanup))
'sent) (message-send arg)
((or error quit) 'sent)
(erase-buffer) ((or error quit)
(insert save-text) (erase-buffer)
(narrow-to-region (car old-rest) (cdr old-rest)) (insert save-text)
(restore-buffer-modified-p modified) (narrow-to-region (car old-rest) (cdr old-rest))
'failed))))) (restore-buffer-modified-p modified)
'failed))))))
(defun org-mu4e-send-and-exit (&optional arg) (defun org-mu4e-send-and-exit (&optional arg)
"Call `org-mu4e-send', the save and kill the buffer. "Call `org-mu4e-send', the save and kill the buffer.

32
init.el
View File

@@ -4,6 +4,13 @@
(require 'cl-lib) (require 'cl-lib)
(require 'xdg) (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 ;; Some other config files
(cl-eval-when (compile load eval) (cl-eval-when (compile load eval)
(add-to-list 'load-path (expand-file-name "elisp" user-emacs-directory)) (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 :ensure nil
:hook (sh-mode . my/-setup-sh-mode) :hook (sh-mode . my/-setup-sh-mode)
:init :init
(add-to-list 'auto-mode-alist '("/\\.envrc\\'" . sh-mode))
(defun my/-setup-sh-mode () (defun my/-setup-sh-mode ()
(add-hook 'completion-at-point-functions #'cape-file nil t))) (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-c C-b" #'inferior-cc-eval-buffer)
(keymap-set java-ts-mode-map "C-M-x" #'inferior-cc-eval-defun)) (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 ;; jupyter
(use-package jupyter (use-package jupyter
:hook (jupyter-repl-mode . my/-setup-jupyter-mode) :hook (jupyter-repl-mode . my/-setup-jupyter-mode)
@@ -2837,10 +2850,10 @@ Actually, return the method name."
("ga" "git add $*") ("ga" "git add $*")
("gcm" "git commit -m ${string-join $* \" \"}") ("gcm" "git commit -m ${string-join $* \" \"}")
("ldg" "ledger -f \"$HOME/docs/finance/finances.ledger\" $*") ("ldg" "ledger -f \"$HOME/docs/finance/finances.ledger\" $*")
("tp" "trash-put $*") ("tp" "clash put $*")
("trr" "trash-restore $*") ("trr" "clash restore $*")
("tre" "trash-empty $*") ("tre" "clash empty $*")
("trm" "trash-rm $*") ("trm" "clash empty $*")
("rm" "echo 'rm: I''m unsafe! Don''t use me.'; false") ("rm" "echo 'rm: I''m unsafe! Don''t use me.'; false")
("\\rm" "eshell/rm"))) ("\\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)) ("C-c k" . khard-insert-email-contact))
:init :init
(require 'mu4e) (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-main-mode-map "q" #'bury-buffer)
(evil-define-key '(normal motion) mu4e-view-mode-map (evil-define-key '(normal motion) mu4e-view-mode-map
"gy" #'mu4e-view-save-url "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 " (concat "flag:unread AND NOT flag:trashed AND NOT "
"maildir:/protonmail/Trash AND NOT maildir:/protonmail/Spam AND NOT " "maildir:/protonmail/Trash AND NOT maildir:/protonmail/Spam AND NOT "
"maildir:/ucsc-gmail/[Gmail]/Trash 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.") "Flag for mail which will appear as \"unread\" and will be notified.")
(setq message-kill-buffer-on-exit t (setq message-kill-buffer-on-exit t
message-confirm-send 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-refile-folder . "/protonmail/Archive")
(mu4e-sent-folder . "/protonmail/Sent") (mu4e-sent-folder . "/protonmail/Sent")
(mu4e-drafts-folder . "/protonmail/Drafts") (mu4e-drafts-folder . "/protonmail/Drafts")
(mu4e-trash-folder . "/protonmail/Trash"))) (mu4e-trash-folder . "/protonmail/Trash")
(mu4e-sent-messages-behavior . sent)))
(make-mu4e-context (make-mu4e-context
:name "School" :name "School"
:match-func (lambda (msg) :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-refile-folder . "/ucsc-gmail/[Gmail]/All Mail")
(mu4e-sent-folder . "/ucsc-gmail/[Gmail]/Sent Mail") (mu4e-sent-folder . "/ucsc-gmail/[Gmail]/Sent Mail")
(mu4e-drafts-folder . "/ucsc-gmail/[Gmail]/Drafts") (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 (use-package mu4e-alert
:after mu4e :after mu4e
:hook (after-init . mu4e-alert-enable-notifications) :hook (after-init . mu4e-alert-enable-notifications)