Emacs: Check if mu4e is available to run email stuff, fix Welcome image link

This commit is contained in:
Joseph Ferano 2024-06-06 10:42:51 +07:00
parent a7ae3d1df8
commit 7271263df1
2 changed files with 80 additions and 78 deletions

View File

@ -70,7 +70,7 @@
(goto-char (point-min)) (goto-char (point-min))
(let ((bmarks (read (current-buffer)))) (let ((bmarks (read (current-buffer))))
(mapcar (lambda (bm) (cons (car bm) (cdr (nth 1 bm)))) bmarks))) (mapcar (lambda (bm) (cons (car bm) (cdr (nth 1 bm)))) bmarks)))
(list '("No Bookmark Fls"))))) (list '("No Bookmarks")))))
(defun welcome--load-projects () (defun welcome--load-projects ()
(with-temp-buffer (with-temp-buffer
@ -101,7 +101,7 @@
(buffer-size) (buffer-size)
(erase-buffer) (erase-buffer)
(goto-char (point-min)) (goto-char (point-min))
(insert-image (create-image "/home/joe/.config/emacs/elisp/Emacs@256.png")) (insert-image (create-image "/home/joe/.config/emacs/Emacs@256.png"))
(insert "\n\n\n") (insert "\n\n\n")
(insert "Welcome to Emacs!\n\n") (insert "Welcome to Emacs!\n\n")
;; (dashboard-insert-center "testing this thing out\n\n") ;; (dashboard-insert-center "testing this thing out\n\n")

View File

@ -1828,62 +1828,63 @@ odd looking ~'(t .t)~ is for specifying a default for all other actions.
#+end_src #+end_src
** Email ** Email
#+begin_src emacs-lisp #+begin_src emacs-lisp
(add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e/") (when (file-exists-p "/usr/share/emacs/site-lisp/mu4e/")
(require 'mu4e) (add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e/")
(require 'mu4e)
;; Attach files to a message composition buffer by going into `dired' ;; Attach files to a message composition buffer by going into `dired'
;; and doing C-c C-m C-a (M-x `gnus-dired-attach'). ;; and doing C-c C-m C-a (M-x `gnus-dired-attach').
(require 'gnus-dired) ; does not require `gnus' (require 'gnus-dired) ; does not require `gnus'
(add-hook 'dired-mode-hook #'gnus-dired-mode) (add-hook 'dired-mode-hook #'gnus-dired-mode)
(add-hook 'mu4e-main-mode-hook 'olivetti-mode) (add-hook 'mu4e-main-mode-hook 'olivetti-mode)
(add-to-list 'auto-mode-alist '("authinfo" . authinfo-mode)) (add-to-list 'auto-mode-alist '("authinfo" . authinfo-mode))
(setq mu4e-get-mail-command "parallel mbsync -V \"-c ~/.config/mbsync/config\" ::: ferano.io.inbox gmail.allmail") (setq mu4e-get-mail-command "parallel mbsync -V \"-c ~/.config/mbsync/config\" ::: ferano.io.inbox gmail.allmail")
;;; Sending email (SMTP) ;;; Sending email (SMTP)
(require 'smtpmail) (require 'smtpmail)
(setq smtpmail-default-smtp-server "mail.gandi.net" (setq smtpmail-default-smtp-server "mail.gandi.net"
smtpmail-smtp-server "mail.gandi.net" smtpmail-smtp-server "mail.gandi.net"
smtpmail-stream-type 'ssl smtpmail-stream-type 'ssl
smtpmail-smtp-service 465 smtpmail-smtp-service 465
smtpmail-queue-mail nil) smtpmail-queue-mail nil)
(require 'sendmail) (require 'sendmail)
(setq send-mail-function 'smtpmail-send-it) (setq send-mail-function 'smtpmail-send-it)
(setq mu4e-update-interval 30) (setq mu4e-update-interval 30)
(setq mu4e-hide-index-messages t) (setq mu4e-hide-index-messages t)
(setq mu4e-completing-read-function 'completing-read) (setq mu4e-completing-read-function 'completing-read)
(setq mu4e-context-policy 'pick-first) (setq mu4e-context-policy 'pick-first)
(setq mu4e-compose-context-policy 'ask) (setq mu4e-compose-context-policy 'ask)
(setq mu4e-view-auto-mark-as-read nil) (setq mu4e-view-auto-mark-as-read nil)
;; (setq mu4e-sent-messages-behavior 'sent) ;; (setq mu4e-sent-messages-behavior 'sent)
(setq message-kill-buffer-on-exit t) (setq message-kill-buffer-on-exit t)
(require 'age) (require 'age)
(setq age-default-identity '("~/.local/credentials/personal")) (setq age-default-identity '("~/.local/credentials/personal"))
(setq age-default-recipient '("~/.local/credentials/personal.pub")) (setq age-default-recipient '("~/.local/credentials/personal.pub"))
(setq auth-source-do-cache nil) (setq auth-source-do-cache nil)
(defun joe/mu4e-auth-get-field (host prop) (defun joe/mu4e-auth-get-field (host prop)
"Find PROP in `auth-sources' for HOST entry." "Find PROP in `auth-sources' for HOST entry."
(when-let ((source (auth-source-search :host host))) (when-let ((source (auth-source-search :host host)))
(if (eq prop :secret) (if (eq prop :secret)
(funcall (plist-get (car source) prop)) (funcall (plist-get (car source) prop))
(plist-get (flatten-list source) prop)))) (plist-get (flatten-list source) prop))))
(setq auth-sources '("~/.local/credentials/authinfo.age")) (setq auth-sources '("~/.local/credentials/authinfo.age"))
(setq mu4e-change-filenames-when-moving t) (setq mu4e-change-filenames-when-moving t)
(age-file-enable) (age-file-enable)
(age-encryption-mode +1) (age-encryption-mode +1)
(setq mu4e-bookmarks nil) (setq mu4e-bookmarks nil)
(setq mu4e-contexts (setq mu4e-contexts
`(,(make-mu4e-context `(,(make-mu4e-context
:name "Ferano.io" :name "Ferano.io"
:enter-func (lambda () (mu4e-message "Entering ferano.io")) :enter-func (lambda () (mu4e-message "Entering ferano.io"))
@ -1911,13 +1912,13 @@ odd looking ~'(t .t)~ is for specifying a default for all other actions.
(mu4e-trash-folder . "/gmail/[Gmail]/Trash/") (mu4e-trash-folder . "/gmail/[Gmail]/Trash/")
(mu4e-sent-folder . "/gmail/[Gmail]/Sent Mail/"))))) (mu4e-sent-folder . "/gmail/[Gmail]/Sent Mail/")))))
(setq mu4e-maildir-shortcuts (setq mu4e-maildir-shortcuts
'((:maildir "/ferano.io/Inbox" :key ?f) '((:maildir "/ferano.io/Inbox" :key ?f)
(:maildir "/gmail/[Gmail]/All Mail" :key ?g))) (:maildir "/gmail/[Gmail]/All Mail" :key ?g)))
(mu4e 't) (mu4e 't)
(add-hook 'after-init-hook #'mu4e-alert-enable-mode-line-display) (add-hook 'after-init-hook #'mu4e-alert-enable-mode-line-display))
;; (:name "Ferano.io Unread" :query "m:/ferano.io/Inbox AND g:unread" :key ?u))) ;; (:name "Ferano.io Unread" :query "m:/ferano.io/Inbox AND g:unread" :key ?u)))
#+end_src #+end_src
Fold threads. This is a gist provided by Rougier [[https://gist.github.com/rougier/98e83fb50e19fb73fe34a7ecc5fc1ccc][here]]. His other package is Fold threads. This is a gist provided by Rougier [[https://gist.github.com/rougier/98e83fb50e19fb73fe34a7ecc5fc1ccc][here]]. His other package is
@ -1926,13 +1927,14 @@ be kept here commented out in case we want to try it again.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(load-file "/home/joe/Dotfiles/.config/emacs/elisp/mu4e-fast-folding.el") (when (file-exists-p "/usr/share/emacs/site-lisp/mu4e/")
(load-file "/home/joe/Dotfiles/.config/emacs/elisp/mu4e-fast-folding.el")
(evil-define-key 'normal mu4e-headers-mode-map (kbd "TAB") (evil-define-key 'normal mu4e-headers-mode-map (kbd "TAB")
#'mu4e-fast-folding-thread-toggle) #'mu4e-fast-folding-thread-toggle)
(evil-define-key 'normal mu4e-headers-mode-map (kbd "<backtab>") (evil-define-key 'normal mu4e-headers-mode-map (kbd "<backtab>")
#'mu4e-fast-folding-thread-toggle-all) #'mu4e-fast-folding-thread-toggle-all))
;; (load-file "/home/joe/Dotfiles/.config/emacs/elisp/mu4e-thread-folding.el") ;; (load-file "/home/joe/Dotfiles/.config/emacs/elisp/mu4e-thread-folding.el")
;; (require 'mu4e-fast-folding) ;; (require 'mu4e-fast-folding)