Emacs: Check if mu4e is available to run email stuff, fix Welcome image link
This commit is contained in:
		
							parent
							
								
									a7ae3d1df8
								
							
						
					
					
						commit
						7271263df1
					
				| @ -70,7 +70,7 @@ | ||||
|           (goto-char (point-min)) | ||||
|           (let ((bmarks (read (current-buffer)))) | ||||
|             (mapcar (lambda (bm) (cons (car bm) (cdr (nth 1 bm)))) bmarks))) | ||||
|       (list '("No Bookmark Fls"))))) | ||||
|       (list '("No Bookmarks"))))) | ||||
| 
 | ||||
| (defun welcome--load-projects () | ||||
|   (with-temp-buffer | ||||
| @ -101,7 +101,7 @@ | ||||
|     (buffer-size) | ||||
|     (erase-buffer) | ||||
|     (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 "Welcome to Emacs!\n\n") | ||||
|     ;; (dashboard-insert-center "testing this thing out\n\n") | ||||
|  | ||||
| @ -1828,96 +1828,97 @@ odd looking ~'(t .t)~ is for specifying a default for all other actions. | ||||
| #+end_src | ||||
| ** Email | ||||
| #+begin_src emacs-lisp | ||||
| (add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e/") | ||||
| (require 'mu4e) | ||||
| (when (file-exists-p "/usr/share/emacs/site-lisp/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' | ||||
| ;; and doing C-c C-m C-a (M-x `gnus-dired-attach'). | ||||
| (require 'gnus-dired) ; does not require `gnus' | ||||
| (add-hook 'dired-mode-hook #'gnus-dired-mode) | ||||
| (add-hook 'mu4e-main-mode-hook 'olivetti-mode) | ||||
|     ;; Attach files to a message composition buffer by going into `dired' | ||||
|     ;; and doing C-c C-m C-a (M-x `gnus-dired-attach'). | ||||
|     (require 'gnus-dired) ; does not require `gnus' | ||||
|     (add-hook 'dired-mode-hook #'gnus-dired-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) | ||||
| (require 'smtpmail) | ||||
| (setq smtpmail-default-smtp-server "mail.gandi.net" | ||||
|       smtpmail-smtp-server "mail.gandi.net" | ||||
|       smtpmail-stream-type 'ssl | ||||
|       smtpmail-smtp-service 465 | ||||
|       smtpmail-queue-mail nil) | ||||
|     ;;; Sending email (SMTP) | ||||
|     (require 'smtpmail) | ||||
|     (setq smtpmail-default-smtp-server "mail.gandi.net" | ||||
|         smtpmail-smtp-server "mail.gandi.net" | ||||
|         smtpmail-stream-type 'ssl | ||||
|         smtpmail-smtp-service 465 | ||||
|         smtpmail-queue-mail nil) | ||||
| 
 | ||||
| (require 'sendmail) | ||||
| (setq send-mail-function 'smtpmail-send-it) | ||||
|     (require 'sendmail) | ||||
|     (setq send-mail-function 'smtpmail-send-it) | ||||
| 
 | ||||
| (setq mu4e-update-interval 30) | ||||
| (setq mu4e-hide-index-messages t) | ||||
| (setq mu4e-completing-read-function 'completing-read) | ||||
| (setq mu4e-context-policy 'pick-first) | ||||
| (setq mu4e-compose-context-policy 'ask) | ||||
| (setq mu4e-view-auto-mark-as-read nil) | ||||
|     (setq mu4e-update-interval 30) | ||||
|     (setq mu4e-hide-index-messages t) | ||||
|     (setq mu4e-completing-read-function 'completing-read) | ||||
|     (setq mu4e-context-policy 'pick-first) | ||||
|     (setq mu4e-compose-context-policy 'ask) | ||||
|     (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) | ||||
| (setq age-default-identity '("~/.local/credentials/personal")) | ||||
| (setq age-default-recipient '("~/.local/credentials/personal.pub")) | ||||
|     (require 'age) | ||||
|     (setq age-default-identity '("~/.local/credentials/personal")) | ||||
|     (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) | ||||
|   "Find PROP in `auth-sources' for HOST entry." | ||||
|   (when-let ((source (auth-source-search :host host))) | ||||
|     (if (eq prop :secret) | ||||
|        (funcall (plist-get (car source) prop)) | ||||
|       (plist-get (flatten-list source) prop)))) | ||||
|     (defun joe/mu4e-auth-get-field (host prop) | ||||
|     "Find PROP in `auth-sources' for HOST entry." | ||||
|     (when-let ((source (auth-source-search :host host))) | ||||
|         (if (eq prop :secret) | ||||
|         (funcall (plist-get (car 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-encryption-mode +1) | ||||
| (setq mu4e-bookmarks nil) | ||||
| (setq mu4e-contexts | ||||
|       `(,(make-mu4e-context | ||||
|           :name "Ferano.io" | ||||
|           :enter-func (lambda () (mu4e-message "Entering ferano.io")) | ||||
|           :leave-func (lambda () (mu4e-message "Leaving ferano.io")) | ||||
|           :match-func (lambda (msg) | ||||
|                         (when msg | ||||
|                           (mu4e-message-contact-field-matches | ||||
|                            msg :to (joe/mu4e-auth-get-field "mail.gandi.net" :user)))) | ||||
|           :vars `((user-mail-address . ,(joe/mu4e-auth-get-field "mail.gandi.net" :user)) | ||||
|                   (user-full-name . "Joseph Ferano") | ||||
|                   (mu4e-drafts-folder . "/ferano.io/Drafts/") | ||||
|                   (mu4e-trash-folder . "/ferano.io/Trash/") | ||||
|                   (mu4e-sent-folder . "/ferano.io/Sent/"))) | ||||
|           ,(make-mu4e-context | ||||
|             :name "Gmail" | ||||
|             :enter-func (lambda () (mu4e-message "Entering gmail")) | ||||
|             :leave-func (lambda () (mu4e-message "Leaving gmail")) | ||||
|     (age-file-enable) | ||||
|     (age-encryption-mode +1) | ||||
|     (setq mu4e-bookmarks nil) | ||||
|     (setq mu4e-contexts | ||||
|         `(,(make-mu4e-context | ||||
|             :name "Ferano.io" | ||||
|             :enter-func (lambda () (mu4e-message "Entering ferano.io")) | ||||
|             :leave-func (lambda () (mu4e-message "Leaving ferano.io")) | ||||
|             :match-func (lambda (msg) | ||||
|                           (when msg | ||||
|                             (when msg | ||||
|                             (mu4e-message-contact-field-matches | ||||
|                              msg :to (joe/mu4e-auth-get-field "mail.gmail.com" :user)))) | ||||
|             :vars `((user-mail-address . ,(joe/mu4e-auth-get-field "mail.gmail.com" :user)) | ||||
|                             msg :to (joe/mu4e-auth-get-field "mail.gandi.net" :user)))) | ||||
|             :vars `((user-mail-address . ,(joe/mu4e-auth-get-field "mail.gandi.net" :user)) | ||||
|                     (user-full-name . "Joseph Ferano") | ||||
|                     (mu4e-drafts-folder . "/gmail/[Gmail]/Drafts/") | ||||
|                     (mu4e-trash-folder . "/gmail/[Gmail]/Trash/") | ||||
|                     (mu4e-sent-folder . "/gmail/[Gmail]/Sent Mail/"))))) | ||||
|                     (mu4e-drafts-folder . "/ferano.io/Drafts/") | ||||
|                     (mu4e-trash-folder . "/ferano.io/Trash/") | ||||
|                     (mu4e-sent-folder . "/ferano.io/Sent/"))) | ||||
|             ,(make-mu4e-context | ||||
|                 :name "Gmail" | ||||
|                 :enter-func (lambda () (mu4e-message "Entering gmail")) | ||||
|                 :leave-func (lambda () (mu4e-message "Leaving gmail")) | ||||
|                 :match-func (lambda (msg) | ||||
|                             (when msg | ||||
|                                 (mu4e-message-contact-field-matches | ||||
|                                 msg :to (joe/mu4e-auth-get-field "mail.gmail.com" :user)))) | ||||
|                 :vars `((user-mail-address . ,(joe/mu4e-auth-get-field "mail.gmail.com" :user)) | ||||
|                         (user-full-name . "Joseph Ferano") | ||||
|                         (mu4e-drafts-folder . "/gmail/[Gmail]/Drafts/") | ||||
|                         (mu4e-trash-folder . "/gmail/[Gmail]/Trash/") | ||||
|                         (mu4e-sent-folder . "/gmail/[Gmail]/Sent Mail/"))))) | ||||
| 
 | ||||
| (setq mu4e-maildir-shortcuts | ||||
|     '((:maildir "/ferano.io/Inbox"   :key ?f) | ||||
|       (:maildir "/gmail/[Gmail]/All Mail"   :key ?g))) | ||||
|     (setq mu4e-maildir-shortcuts | ||||
|         '((:maildir "/ferano.io/Inbox"   :key ?f) | ||||
|         (:maildir "/gmail/[Gmail]/All Mail"   :key ?g))) | ||||
| 
 | ||||
| (mu4e 't) | ||||
| (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))) | ||||
|     (mu4e 't) | ||||
|     (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))) | ||||
| #+end_src | ||||
| 
 | ||||
| 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 | ||||
| 
 | ||||
| (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") | ||||
|   #'mu4e-fast-folding-thread-toggle) | ||||
|   (evil-define-key 'normal mu4e-headers-mode-map (kbd "TAB") | ||||
|     #'mu4e-fast-folding-thread-toggle) | ||||
| 
 | ||||
| (evil-define-key 'normal mu4e-headers-mode-map (kbd "<backtab>") | ||||
|   #'mu4e-fast-folding-thread-toggle-all) | ||||
|   (evil-define-key 'normal mu4e-headers-mode-map (kbd "<backtab>") | ||||
|     #'mu4e-fast-folding-thread-toggle-all)) | ||||
| 
 | ||||
| ;; (load-file "/home/joe/Dotfiles/.config/emacs/elisp/mu4e-thread-folding.el") | ||||
| ;; (require 'mu4e-fast-folding) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user