Testing OS and Email configs
This commit is contained in:
parent
2121924cf1
commit
09e4066ab8
192
Emacs.org
192
Emacs.org
|
@ -23,6 +23,15 @@ The following variables are used to tweak some of the configuration pieces for u
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
||||||
|
* Getting environment
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
|
||||||
|
;(defvar current-os '(shell-command-to-string "uname -s"))
|
||||||
|
(defvar current-os '(shell-command "uname -s"))
|
||||||
|
|
||||||
|
#+end_src
|
||||||
|
|
||||||
* Tips for Use
|
* Tips for Use
|
||||||
|
|
||||||
In this document I've added links in many places that lead you to documentation for the various packages we use. If you're looking at this file in Emacs, you can put your cursor on a link and press =C-c C-o= or run =M-x org-open-at-point= to open the link in your web browser.
|
In this document I've added links in many places that lead you to documentation for the various packages we use. If you're looking at this file in Emacs, you can put your cursor on a link and press =C-c C-o= or run =M-x org-open-at-point= to open the link in your web browser.
|
||||||
|
@ -212,33 +221,38 @@ I am using the [[https://github.com/tonsky/FiraCode][Fira Code]] and [[https://f
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
|
||||||
(cond
|
;(cond
|
||||||
((eq system-type 'windows-nt)
|
;((eq system-type 'windows-nt)
|
||||||
(progn
|
;(progn
|
||||||
(message "Microsoft Windows")))
|
; (message "Microsoft Windows")))
|
||||||
((eq system-type 'darwin)
|
;((eq system-type 'darwin)
|
||||||
(progn
|
;(progn
|
||||||
(
|
;(
|
||||||
(set-face-attribute 'default nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
|
(set-face-attribute 'default nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
|
||||||
|
|
||||||
;; Set the fixed pitch face
|
;; Set the fixed pitch face
|
||||||
(set-face-attribute 'fixed-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
|
(set-face-attribute 'fixed-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
|
||||||
|
|
||||||
;; Set the variable pitch face
|
;; Set the variable pitch face
|
||||||
(set-face-attribute 'variable-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-variable-font-size :weight 'regular)
|
(set-face-attribute 'variable-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-variable-font-size :weight 'regular)
|
||||||
)))
|
;)
|
||||||
((eq system-type 'gnu/linux)
|
;)
|
||||||
(progn
|
;)
|
||||||
(
|
;((eq system-type 'gnu/linux)
|
||||||
(set-face-attribute 'default nil :font "Comic Code" :height efs/default-font-size)
|
;(progn
|
||||||
|
;(
|
||||||
|
;(set-face-attribute 'default nil :font "Comic Code" :height efs/default-font-size)
|
||||||
|
|
||||||
;; Set the fixed pitch face
|
;; Set the fixed pitch face
|
||||||
(set-face-attribute 'fixed-pitch nil :font "Comic Code" :height efs/default-font-size)
|
;(set-face-attribute 'fixed-pitch nil :font "Comic Code" :height efs/default-font-size)
|
||||||
|
|
||||||
;; Set the variable pitch face
|
;; Set the variable pitch face
|
||||||
(set-face-attribute 'variable-pitch nil :font "Comic Code" :height efs/default-variable-font-size :weight 'regular)
|
;(set-face-attribute 'variable-pitch nil :font "Comic Code" :height efs/default-variable-font-size :weight 'regular)
|
||||||
|
|
||||||
|
;)
|
||||||
|
;)
|
||||||
|
;))
|
||||||
|
|
||||||
))))
|
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
@ -1267,7 +1281,7 @@ Run a terminal with =M-x term!=
|
||||||
(use-package term
|
(use-package term
|
||||||
:commands term
|
:commands term
|
||||||
:config
|
:config
|
||||||
(setq explicit-shell-file-name "bash") ;; Change this to zsh, etc
|
(setq explicit-shell-file-name "fish") ;; Change this to zsh, etc
|
||||||
;;(setq explicit-zsh-args '()) ;; Use 'explicit-<shell>-args for shell-specific args
|
;;(setq explicit-zsh-args '()) ;; Use 'explicit-<shell>-args for shell-specific args
|
||||||
|
|
||||||
;; Match the default Bash shell prompt. Update this if you have a custom prompt
|
;; Match the default Bash shell prompt. Update this if you have a custom prompt
|
||||||
|
@ -1480,6 +1494,138 @@ Dired is a built-in file manager for Emacs that does some pretty amazing things!
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
||||||
|
* Email
|
||||||
|
|
||||||
|
** mu4e
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
|
||||||
|
(use-package mu4e
|
||||||
|
:ensure nil
|
||||||
|
:load-path "/opt/homebrew/share/emacs/site-lisp/mu4e"
|
||||||
|
:defer 20 ; Wait until 20 seconds after startup
|
||||||
|
;:defer t
|
||||||
|
:config
|
||||||
|
|
||||||
|
;; Load org-mode integration
|
||||||
|
;(require 'org-mu4e)
|
||||||
|
|
||||||
|
;; Refresh mail using isync every 10 minutes
|
||||||
|
(setq mu4e-update-interval (* 10 60))
|
||||||
|
(setq mu4e-get-mail-command "mbsync -a")
|
||||||
|
(setq mu4e-maildir "~/Mail")
|
||||||
|
|
||||||
|
;; Use Ivy for mu4e completions (maildir folders, etc)
|
||||||
|
(setq mu4e-completing-read-function #'ivy-completing-read)
|
||||||
|
|
||||||
|
;; Make sure that moving a message (like to Trash) causes the
|
||||||
|
;; message to get a new file name. This helps to avoid the
|
||||||
|
;; dreaded "UID is N beyond highest assigned" error.
|
||||||
|
;; See this link for more info: https://stackoverflow.com/a/43461973
|
||||||
|
(setq mu4e-change-filenames-when-moving t)
|
||||||
|
|
||||||
|
;; Set up contexts for email accounts
|
||||||
|
(setq mu4e-contexts
|
||||||
|
`(,(make-mu4e-context
|
||||||
|
:name "Fastmail"
|
||||||
|
:match-func (lambda (msg) (when msg
|
||||||
|
(string-prefix-p "/Fastmail" (mu4e-message-field msg :maildir))))
|
||||||
|
:vars '(
|
||||||
|
(user-full-name . "David Wilson")
|
||||||
|
(user-mail-address . "david@daviwil.com")
|
||||||
|
(mu4e-sent-folder . "/Fastmail/Sent Items")
|
||||||
|
(mu4e-trash-folder . "/Fastmail/Trash")
|
||||||
|
(mu4e-drafts-folder . "/Fastmail/Drafts")
|
||||||
|
(mu4e-refile-folder . "/Fastmail/Archive")
|
||||||
|
(mu4e-sent-messages-behavior . sent)))
|
||||||
|
,(make-mu4e-context
|
||||||
|
:name "Personal"
|
||||||
|
:match-func (lambda (msg) (when msg
|
||||||
|
(string-prefix-p "/Personal" (mu4e-message-field msg :maildir))))
|
||||||
|
:vars '(
|
||||||
|
(mu4e-sent-folder . "/Personal/Sent")
|
||||||
|
(mu4e-trash-folder . "/Personal/Deleted")
|
||||||
|
(mu4e-refile-folder . "/Personal/Archive")))))
|
||||||
|
(setq mu4e-context-policy 'pick-first)
|
||||||
|
|
||||||
|
;; Prevent mu4e from permanently deleting trashed items
|
||||||
|
;; This snippet was taken from the following article:
|
||||||
|
;; http://cachestocaches.com/2017/3/complete-guide-email-emacs-using-mu-and-/
|
||||||
|
(defun remove-nth-element (nth list)
|
||||||
|
(if (zerop nth) (cdr list)
|
||||||
|
(let ((last (nthcdr (1- nth) list)))
|
||||||
|
(setcdr last (cddr last))
|
||||||
|
list)))
|
||||||
|
(setq mu4e-marks (remove-nth-element 5 mu4e-marks))
|
||||||
|
(add-to-list 'mu4e-marks
|
||||||
|
'(trash
|
||||||
|
:char ("d" . "▼")
|
||||||
|
:prompt "dtrash"
|
||||||
|
:dyn-target (lambda (target msg) (mu4e-get-trash-folder msg))
|
||||||
|
:action (lambda (docid msg target)
|
||||||
|
(mu4e~proc-move docid
|
||||||
|
(mu4e~mark-check-target target) "-N"))))
|
||||||
|
|
||||||
|
;; Display options
|
||||||
|
(setq mu4e-view-show-images t)
|
||||||
|
(setq mu4e-view-show-addresses 't)
|
||||||
|
|
||||||
|
;; Composing mail
|
||||||
|
(setq mu4e-compose-dont-reply-to-self t)
|
||||||
|
|
||||||
|
;; Use mu4e for sending e-mail
|
||||||
|
(setq mail-user-agent 'mu4e-user-agent
|
||||||
|
message-send-mail-function 'smtpmail-send-it
|
||||||
|
smtpmail-smtp-server "smtp.fastmail.com"
|
||||||
|
smtpmail-smtp-service 465
|
||||||
|
smtpmail-stream-type 'ssl)
|
||||||
|
|
||||||
|
;; Signing messages (use mml-secure-sign-pgpmime)
|
||||||
|
(setq mml-secure-openpgp-signers '("3A74994A3EB078555A0FFDD599F6A2219E3A3C44"))
|
||||||
|
|
||||||
|
;; (See the documentation for `mu4e-sent-messages-behavior' if you have
|
||||||
|
;; additional non-Gmail addresses and want assign them different
|
||||||
|
;; behavior.)
|
||||||
|
|
||||||
|
;; setup some handy shortcuts
|
||||||
|
;; you can quickly switch to your Inbox -- press ``ji''
|
||||||
|
;; then, when you want archive some messages, move them to
|
||||||
|
;; the 'All Mail' folder by pressing ``ma''.
|
||||||
|
(setq mu4e-maildir-shortcuts
|
||||||
|
'(("/Fastmail/INBOX" . ?i)
|
||||||
|
("/Fastmail/Lists/*" . ?l)
|
||||||
|
("/Fastmail/Sent Mail" . ?s)
|
||||||
|
("/Fastmail/Trash" . ?t)))
|
||||||
|
|
||||||
|
(add-to-list 'mu4e-bookmarks
|
||||||
|
'(:name "All Inboxes"
|
||||||
|
:query "maildir:/Fastmail/INBOX OR maildir:/Personal/Inbox"
|
||||||
|
:key ?i))
|
||||||
|
|
||||||
|
;; don't keep message buffers around
|
||||||
|
(setq message-kill-buffer-on-exit t)
|
||||||
|
|
||||||
|
(setq dw/mu4e-inbox-query
|
||||||
|
"(maildir:/Personal/Inbox OR maildir:/Fastmail/INBOX) AND flag:unread")
|
||||||
|
|
||||||
|
(defun dw/go-to-inbox ()
|
||||||
|
(interactive)
|
||||||
|
(mu4e-headers-search dw/mu4e-inbox-query))
|
||||||
|
|
||||||
|
(dw/leader-key-def
|
||||||
|
"m" '(:ignore t :which-key "mail")
|
||||||
|
"mm" 'mu4e
|
||||||
|
"mc" 'mu4e-compose-new
|
||||||
|
"mi" 'dw/go-to-inbox
|
||||||
|
"ms" 'mu4e-update-mail-and-index)
|
||||||
|
|
||||||
|
;; Start mu4e in the background so that it syncs mail periodically
|
||||||
|
(mu4e t))
|
||||||
|
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
|
||||||
* Applications
|
* Applications
|
||||||
|
|
||||||
** Some App
|
** Some App
|
||||||
|
|
161
init.el
161
init.el
|
@ -11,6 +11,9 @@
|
||||||
;; Electric pair mode
|
;; Electric pair mode
|
||||||
(electric-pair-mode 1)
|
(electric-pair-mode 1)
|
||||||
|
|
||||||
|
;(defvar current-os '(shell-command-to-string "uname -s"))
|
||||||
|
(defvar current-os '(shell-command "uname -s"))
|
||||||
|
|
||||||
;; The default is 800 kilobytes. Measured in bytes.
|
;; The default is 800 kilobytes. Measured in bytes.
|
||||||
(setq gc-cons-threshold (* 50 1000 1000))
|
(setq gc-cons-threshold (* 50 1000 1000))
|
||||||
|
|
||||||
|
@ -139,13 +142,13 @@
|
||||||
|
|
||||||
(global-set-key (kbd "C-x l") 'load-file)
|
(global-set-key (kbd "C-x l") 'load-file)
|
||||||
|
|
||||||
(cond
|
;(cond
|
||||||
((eq system-type 'windows-nt)
|
;((eq system-type 'windows-nt)
|
||||||
(progn
|
;(progn
|
||||||
(message "Microsoft Windows")))
|
; (message "Microsoft Windows")))
|
||||||
((eq system-type 'darwin)
|
;((eq system-type 'darwin)
|
||||||
(progn
|
;(progn
|
||||||
(
|
;(
|
||||||
(set-face-attribute 'default nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
|
(set-face-attribute 'default nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
|
||||||
|
|
||||||
;; Set the fixed pitch face
|
;; Set the fixed pitch face
|
||||||
|
@ -153,19 +156,23 @@
|
||||||
|
|
||||||
;; Set the variable pitch face
|
;; Set the variable pitch face
|
||||||
(set-face-attribute 'variable-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-variable-font-size :weight 'regular)
|
(set-face-attribute 'variable-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-variable-font-size :weight 'regular)
|
||||||
)))
|
;)
|
||||||
((eq system-type 'gnu/linux)
|
;)
|
||||||
(progn
|
;)
|
||||||
(
|
;((eq system-type 'gnu/linux)
|
||||||
(set-face-attribute 'default nil :font "Comic Code" :height efs/default-font-size)
|
;(progn
|
||||||
|
;(
|
||||||
|
;(set-face-attribute 'default nil :font "Comic Code" :height efs/default-font-size)
|
||||||
|
|
||||||
;; Set the fixed pitch face
|
;; Set the fixed pitch face
|
||||||
(set-face-attribute 'fixed-pitch nil :font "Comic Code" :height efs/default-font-size)
|
;(set-face-attribute 'fixed-pitch nil :font "Comic Code" :height efs/default-font-size)
|
||||||
|
|
||||||
;; Set the variable pitch face
|
;; Set the variable pitch face
|
||||||
(set-face-attribute 'variable-pitch nil :font "Comic Code" :height efs/default-variable-font-size :weight 'regular)
|
;(set-face-attribute 'variable-pitch nil :font "Comic Code" :height efs/default-variable-font-size :weight 'regular)
|
||||||
|
|
||||||
))))
|
;)
|
||||||
|
;)
|
||||||
|
;))
|
||||||
|
|
||||||
;; Make ESC quit prompts
|
;; Make ESC quit prompts
|
||||||
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
|
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
|
||||||
|
@ -806,7 +813,7 @@
|
||||||
(use-package term
|
(use-package term
|
||||||
:commands term
|
:commands term
|
||||||
:config
|
:config
|
||||||
(setq explicit-shell-file-name "bash") ;; Change this to zsh, etc
|
(setq explicit-shell-file-name "fish") ;; Change this to zsh, etc
|
||||||
;;(setq explicit-zsh-args '()) ;; Use 'explicit-<shell>-args for shell-specific args
|
;;(setq explicit-zsh-args '()) ;; Use 'explicit-<shell>-args for shell-specific args
|
||||||
|
|
||||||
;; Match the default Bash shell prompt. Update this if you have a custom prompt
|
;; Match the default Bash shell prompt. Update this if you have a custom prompt
|
||||||
|
@ -888,5 +895,127 @@
|
||||||
(evil-collection-define-key 'normal 'dired-mode-map
|
(evil-collection-define-key 'normal 'dired-mode-map
|
||||||
"H" 'dired-hide-dotfiles-mode))
|
"H" 'dired-hide-dotfiles-mode))
|
||||||
|
|
||||||
|
(use-package mu4e
|
||||||
|
:ensure nil
|
||||||
|
:load-path "/opt/homebrew/share/emacs/site-lisp/mu4e"
|
||||||
|
:defer 20 ; Wait until 20 seconds after startup
|
||||||
|
;:defer t
|
||||||
|
:config
|
||||||
|
|
||||||
|
;; Load org-mode integration
|
||||||
|
;(require 'org-mu4e)
|
||||||
|
|
||||||
|
;; Refresh mail using isync every 10 minutes
|
||||||
|
(setq mu4e-update-interval (* 10 60))
|
||||||
|
(setq mu4e-get-mail-command "mbsync -a")
|
||||||
|
(setq mu4e-maildir "~/Mail")
|
||||||
|
|
||||||
|
;; Use Ivy for mu4e completions (maildir folders, etc)
|
||||||
|
(setq mu4e-completing-read-function #'ivy-completing-read)
|
||||||
|
|
||||||
|
;; Make sure that moving a message (like to Trash) causes the
|
||||||
|
;; message to get a new file name. This helps to avoid the
|
||||||
|
;; dreaded "UID is N beyond highest assigned" error.
|
||||||
|
;; See this link for more info: https://stackoverflow.com/a/43461973
|
||||||
|
(setq mu4e-change-filenames-when-moving t)
|
||||||
|
|
||||||
|
;; Set up contexts for email accounts
|
||||||
|
(setq mu4e-contexts
|
||||||
|
`(,(make-mu4e-context
|
||||||
|
:name "Fastmail"
|
||||||
|
:match-func (lambda (msg) (when msg
|
||||||
|
(string-prefix-p "/Fastmail" (mu4e-message-field msg :maildir))))
|
||||||
|
:vars '(
|
||||||
|
(user-full-name . "David Wilson")
|
||||||
|
(user-mail-address . "david@daviwil.com")
|
||||||
|
(mu4e-sent-folder . "/Fastmail/Sent Items")
|
||||||
|
(mu4e-trash-folder . "/Fastmail/Trash")
|
||||||
|
(mu4e-drafts-folder . "/Fastmail/Drafts")
|
||||||
|
(mu4e-refile-folder . "/Fastmail/Archive")
|
||||||
|
(mu4e-sent-messages-behavior . sent)))
|
||||||
|
,(make-mu4e-context
|
||||||
|
:name "Personal"
|
||||||
|
:match-func (lambda (msg) (when msg
|
||||||
|
(string-prefix-p "/Personal" (mu4e-message-field msg :maildir))))
|
||||||
|
:vars '(
|
||||||
|
(mu4e-sent-folder . "/Personal/Sent")
|
||||||
|
(mu4e-trash-folder . "/Personal/Deleted")
|
||||||
|
(mu4e-refile-folder . "/Personal/Archive")))))
|
||||||
|
(setq mu4e-context-policy 'pick-first)
|
||||||
|
|
||||||
|
;; Prevent mu4e from permanently deleting trashed items
|
||||||
|
;; This snippet was taken from the following article:
|
||||||
|
;; http://cachestocaches.com/2017/3/complete-guide-email-emacs-using-mu-and-/
|
||||||
|
(defun remove-nth-element (nth list)
|
||||||
|
(if (zerop nth) (cdr list)
|
||||||
|
(let ((last (nthcdr (1- nth) list)))
|
||||||
|
(setcdr last (cddr last))
|
||||||
|
list)))
|
||||||
|
(setq mu4e-marks (remove-nth-element 5 mu4e-marks))
|
||||||
|
(add-to-list 'mu4e-marks
|
||||||
|
'(trash
|
||||||
|
:char ("d" . "▼")
|
||||||
|
:prompt "dtrash"
|
||||||
|
:dyn-target (lambda (target msg) (mu4e-get-trash-folder msg))
|
||||||
|
:action (lambda (docid msg target)
|
||||||
|
(mu4e~proc-move docid
|
||||||
|
(mu4e~mark-check-target target) "-N"))))
|
||||||
|
|
||||||
|
;; Display options
|
||||||
|
(setq mu4e-view-show-images t)
|
||||||
|
(setq mu4e-view-show-addresses 't)
|
||||||
|
|
||||||
|
;; Composing mail
|
||||||
|
(setq mu4e-compose-dont-reply-to-self t)
|
||||||
|
|
||||||
|
;; Use mu4e for sending e-mail
|
||||||
|
(setq mail-user-agent 'mu4e-user-agent
|
||||||
|
message-send-mail-function 'smtpmail-send-it
|
||||||
|
smtpmail-smtp-server "smtp.fastmail.com"
|
||||||
|
smtpmail-smtp-service 465
|
||||||
|
smtpmail-stream-type 'ssl)
|
||||||
|
|
||||||
|
;; Signing messages (use mml-secure-sign-pgpmime)
|
||||||
|
(setq mml-secure-openpgp-signers '("3A74994A3EB078555A0FFDD599F6A2219E3A3C44"))
|
||||||
|
|
||||||
|
;; (See the documentation for `mu4e-sent-messages-behavior' if you have
|
||||||
|
;; additional non-Gmail addresses and want assign them different
|
||||||
|
;; behavior.)
|
||||||
|
|
||||||
|
;; setup some handy shortcuts
|
||||||
|
;; you can quickly switch to your Inbox -- press ``ji''
|
||||||
|
;; then, when you want archive some messages, move them to
|
||||||
|
;; the 'All Mail' folder by pressing ``ma''.
|
||||||
|
(setq mu4e-maildir-shortcuts
|
||||||
|
'(("/Fastmail/INBOX" . ?i)
|
||||||
|
("/Fastmail/Lists/*" . ?l)
|
||||||
|
("/Fastmail/Sent Mail" . ?s)
|
||||||
|
("/Fastmail/Trash" . ?t)))
|
||||||
|
|
||||||
|
(add-to-list 'mu4e-bookmarks
|
||||||
|
'(:name "All Inboxes"
|
||||||
|
:query "maildir:/Fastmail/INBOX OR maildir:/Personal/Inbox"
|
||||||
|
:key ?i))
|
||||||
|
|
||||||
|
;; don't keep message buffers around
|
||||||
|
(setq message-kill-buffer-on-exit t)
|
||||||
|
|
||||||
|
(setq dw/mu4e-inbox-query
|
||||||
|
"(maildir:/Personal/Inbox OR maildir:/Fastmail/INBOX) AND flag:unread")
|
||||||
|
|
||||||
|
(defun dw/go-to-inbox ()
|
||||||
|
(interactive)
|
||||||
|
(mu4e-headers-search dw/mu4e-inbox-query))
|
||||||
|
|
||||||
|
(dw/leader-key-def
|
||||||
|
"m" '(:ignore t :which-key "mail")
|
||||||
|
"mm" 'mu4e
|
||||||
|
"mc" 'mu4e-compose-new
|
||||||
|
"mi" 'dw/go-to-inbox
|
||||||
|
"ms" 'mu4e-update-mail-and-index)
|
||||||
|
|
||||||
|
;; Start mu4e in the background so that it syncs mail periodically
|
||||||
|
(mu4e t))
|
||||||
|
|
||||||
;; Make gc pauses faster by decreasing the threshold.
|
;; Make gc pauses faster by decreasing the threshold.
|
||||||
(setq gc-cons-threshold (* 2 1000 1000))
|
(setq gc-cons-threshold (* 2 1000 1000))
|
||||||
|
|
Loading…
Reference in New Issue