Whitespace cleanup

master
Jacopo De Simoi 1 year ago
parent a0aff1f2bf
commit bd37ee975d
  1. 365
      global.org

@ -805,112 +805,114 @@
** mu4e ** mu4e
These are some standard config items These are some standard config items
#+begin_src emacs-lisp #+begin_src emacs-lisp
(require 'smtpmail) (require 'smtpmail)
(require 'mu4e) (require 'mu4e)
(require 'helm-mu) (require 'helm-mu)
(global-set-key (kbd "C-x μ") 'mu4e) (global-set-key (kbd "C-x μ") 'mu4e)
(global-set-key (kbd "C-x 5 μ") (eval-with-new-frame (mu4e))) (global-set-key (kbd "C-x 5 μ") (eval-with-new-frame (mu4e)))
(defalias 'μ 'mu4e) (defalias 'μ 'mu4e)
(setq mu4e-maildir "~/.mail" (setq mu4e-maildir "~/.mail"
mu4e-attachment-dir "~/attachments" mu4e-attachment-dir "~/attachments"
mu4e-html2text-command "w3m -dump -T text/html -cols 72 -o display_link_number=true -o auto_image=false -o display_image=false -o ignore_null_img_alt=true" mu4e-html2text-command "w3m -dump -T text/html -cols 72 -o display_link_number=true -o auto_image=false -o display_image=false -o ignore_null_img_alt=true"
mu4e-headers-show-threads nil mu4e-headers-show-threads nil
mu4e-headers-sort-direction "descending" mu4e-headers-sort-direction "descending"
mail-user-agent 'mu4e-user-agent mail-user-agent 'mu4e-user-agent
read-mail-command 'mu4e read-mail-command 'mu4e
mu4e-update-interval 120 mu4e-update-interval 120
mu4e-view-use-gnus t mu4e-view-use-gnus t
message-kill-buffer-on-exit t message-kill-buffer-on-exit t
mu4e-compose-format-flowed t mu4e-compose-format-flowed t
fill-flowed-encode-column 998 fill-flowed-encode-column 998
mm-text-html-renderer 'gnus-w3m mm-text-html-renderer 'gnus-w3m
mu4e-read-option-use-builtin nil mu4e-read-option-use-builtin nil
mu4e-completing-read-function 'completing-read mu4e-completing-read-function 'completing-read
mu4e-modeline-support nil) mu4e-modeline-support nil
(let (p1 p2 myLine) )
(setq p1 (line-beginning-position) )
(setq p2 (line-end-position) ) (let (p1 p2 myLine)
(setq myLine (buffer-substring-no-properties p1 p2))) (setq p1 (line-beginning-position) )
(setq p2 (line-end-position) )
(defun get-buffer-current-line () (setq myLine (buffer-substring-no-properties p1 p2)))
(let ((p (line-beginning-position))
(q (line-end-position))) (defun get-buffer-current-line ()
(buffer-substring-no-properties p q))) (let ((p (line-beginning-position))
(q (line-end-position)))
(defun get-buffer-to-eol () (buffer-substring-no-properties p q)))
(let ((p (point))
(q (line-end-position))) (defun get-buffer-to-eol ()
(buffer-substring-no-properties p q))) (let ((p (point))
(q (line-end-position)))
(defun format-zoom-meeting () (buffer-substring-no-properties p q)))
(if (boundp 'zoom-link)
(if (boundp 'zoom-passcode) (defun format-zoom-meeting ()
(concat zoom-summary (if (boundp 'zoom-link)
" [[" zoom-link "][link]] (" zoom-passcode ")\n SCHEDULED: " zoom-scheduled-time) (if (boundp 'zoom-passcode)
(concat zoom-summary (concat zoom-summary
" [[" zoom-link "][link]]\n SCHEDULED: " zoom-scheduled-time)) " [[" zoom-link "][link]] (" zoom-passcode ")\n SCHEDULED: " zoom-scheduled-time)
(concat zoom-summary "\n SCHEDULED: " zoom-scheduled-time))) (concat zoom-summary
" [[" zoom-link "][link]]\n SCHEDULED: " zoom-scheduled-time))
(defun create-item-for-meeting (msg) (concat zoom-summary "\n SCHEDULED: " zoom-scheduled-time)))
"Search for messages sent by the sender of the message at point."
(makunbound 'zoom-link) (defun create-item-for-meeting (msg)
(makunbound 'zoom-passcode) "Search for messages sent by the sender of the message at point."
(save-excursion (makunbound 'zoom-link)
(beginning-of-buffer) (makunbound 'zoom-passcode)
(cond ((search-forward "Join Zoom Meeting" nil t) (save-excursion
(message "found zoom meeting") (beginning-of-buffer)
(right-char) (cond ((search-forward "Join Zoom Meeting" nil t)
(setq zoom-link (get-buffer-current-line)) (message "found zoom meeting")
(when (search-forward "Passcode:" nil t) (right-char)
(setq zoom-passcode (get-buffer-current-line))) (setq zoom-link (get-buffer-current-line))
(beginning-of-buffer) (when (search-forward "Passcode:" nil t)
(search-forward "Time:") (setq zoom-passcode (get-buffer-current-line)))
(search-forward "<") (beginning-of-buffer)
(left-char) (search-forward "Time:")
(setq zoom-scheduled-time (get-buffer-to-eol)) (search-forward "<")
(search-backward "Summary:") (left-char)
(right-word) (setq zoom-scheduled-time (get-buffer-to-eol))
(right-word) (search-backward "Summary:")
(left-word) (right-word)
(setq zoom-summary (get-buffer-to-eol)) (right-word)
(org-capture nil "z")) (left-word)
((search-forward "Accept ]") (setq zoom-summary (get-buffer-to-eol))
(message "found generic meeting") (org-capture nil "z"))
(search-forward "Summary:") ((search-forward "Accept ]")
(right-word) (message "found generic meeting")
(right-word) (search-forward "Summary:")
(left-word) (right-word)
(setq zoom-summary (get-buffer-to-eol)) (right-word)
(search-forward "Location:") (left-word)
(right-word) (setq zoom-summary (get-buffer-to-eol))
(left-word) (search-forward "Location:")
(setq zoom-summary (concat zoom-summary " @" (get-buffer-to-eol))) (right-word)
(search-forward "Time:") (left-word)
(search-forward "<") (setq zoom-summary (concat zoom-summary " @" (get-buffer-to-eol)))
(left-char) (search-forward "Time:")
(setq zoom-scheduled-time (get-buffer-to-eol)) (search-forward "<")
(org-capture nil "z"))))) (left-char)
(setq zoom-scheduled-time (get-buffer-to-eol))
(org-capture nil "z")))))
;; define 'z' as the shortcut
(add-to-list 'mu4e-view-actions
'("zCreate agenda item for meeting" . create-item-for-meeting) t) ;; define 'z' as the shortcut
(advice-add 'mu4e-update-mail-and-index :around (add-to-list 'mu4e-view-actions
(lambda (orig-fun &rest args) '("zCreate agenda item for meeting" . create-item-for-meeting) t)
"Only trigger an update if the server is the one that should (advice-add 'mu4e-update-mail-and-index :around
currently be active; otherwise each mu4e instance will trigger an (lambda (orig-fun &rest args)
update" "Only trigger an update if the server is the one that should
(when (string-equal server-name (kde-current-activity-name)) currently be active; otherwise each mu4e instance will trigger an
(apply orig-fun args)))) update"
(when (string-equal server-name (kde-current-activity-name))
(advice-add 'mu4e~header-line-format :around (apply orig-fun args))))
(lambda (orig-fun &rest args)
(let ((mu4e-use-fancy-chars t) (advice-add 'mu4e~header-line-format :around
(mu4e--mark-fringe-len 5)) (lambda (orig-fun &rest args)
(apply orig-fun args)))) (let ((mu4e-use-fancy-chars t)
(mu4e--mark-fringe-len 5))
(apply orig-fun args))))
#+end_src #+end_src
*** Recipient handling *** Recipient handling
@ -979,80 +981,83 @@
Customize ~mu4e~ contexts Customize ~mu4e~ contexts
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq mu4e-contexts (setq mu4e-contexts
`( ,(make-mu4e-context `( ,(make-mu4e-context
:name "Work" :name "Work"
:enter-func (lambda () (mu4e-message "Switch to the Work context")) :enter-func
;; no leave-func (lambda () (mu4e-message "Switch to the Work context"))
;; we match based on the maildir of the message ;; no leave-func
:match-func (lambda (msg) ;; we match based on the maildir of the message
(when msg :match-func (lambda (msg)
(string-match-p "^/math/INBOX" (mu4e-message-field (when msg
msg :maildir)))) (string-match-p "^/math/INBOX" (mu4e-message-field
:vars '( ( user-mail-address . "jacopods@math.utoronto.ca" ) msg :maildir))))
( user-full-name . "Jacopo De Simoi" ) :vars '( ( user-mail-address . "jacopods@math.utoronto.ca" )
( mu4e-sent-folder . "/math/Sent") ( user-full-name . "Jacopo De Simoi" )
( mu4e-drafts-folder . "/math/Drafts") ( mu4e-sent-folder . "/math/Sent")
( mu4e-trash-folder . "/math/Trash") ( mu4e-drafts-folder . "/math/Drafts")
( mu4e-refile-folder . "/math/Archive") ( mu4e-trash-folder . "/math/Trash")
( smtpmail-stream-type . starttls ) ( mu4e-refile-folder . "/math/Archive")
( smtpmail-smtp-service . 587 ) ( smtpmail-stream-type . starttls )
( mu4e-compose-signature . (concat ( smtpmail-smtp-service . 587 )
"Jacopo De Simoi (he · him)\n" ( mu4e-compose-signature . (concat
"Professor · U Toronto\n")))) "Jacopo De Simoi (he · him)\n"
"Professor · U Toronto\n"))))
,(make-mu4e-context
:name "CMP Editor" ,(make-mu4e-context
:enter-func (lambda () (mu4e-message "Switch to the CMP Editor context")) :name "CMP Editor"
:leave-func (lambda () (mu4e-message "Leave the CMP Editor context")) :enter-func
;; we match based on the maildir of the message (lambda () (mu4e-message "Switch to the CMP Editor context"))
:match-func (lambda (msg) :leave-func
(when msg (lambda () (mu4e-message "Leave the CMP Editor context"))
(string-match-p "^/math/editorial.CMP" (mu4e-message-field ;; we match based on the maildir of the message
msg :maildir)))) :match-func (lambda (msg)
:vars '( ( user-mail-address . "jacopods@math.utoronto.ca" ) (when msg
( user-full-name . "Jacopo De Simoi" ) (string-match-p "^/math/editorial.CMP" (mu4e-message-field
( mu4e-sent-folder . "/math/Sent") msg :maildir))))
( mu4e-drafts-folder . "/math/Drafts") :vars '( ( user-mail-address . "jacopods@math.utoronto.ca" )
( mu4e-trash-folder . "/math/Trash") ( user-full-name . "Jacopo De Simoi" )
( mu4e-refile-folder . "/math/editorial.CMP.Archive") ( mu4e-sent-folder . "/math/Sent")
( smtpmail-stream-type . starttls ) ( mu4e-drafts-folder . "/math/Drafts")
( smtpmail-smtp-service . 587 ) ( mu4e-trash-folder . "/math/Trash")
( mu4e-compose-signature . (concat ( mu4e-refile-folder . "/math/editorial.CMP.Archive")
"Jacopo De Simoi (he · him)\n" ( smtpmail-stream-type . starttls )
"Associate Editor for CMP\n" ( smtpmail-smtp-service . 587 )
"Professor · U Toronto\n")))))) ( mu4e-compose-signature . (concat
"Jacopo De Simoi (he · him)\n"
;; set `mu4e-context-policy` and `mu4e-compose-policy` to tweak when mu4e should "Associate Editor for CMP\n"
;; guess or ask the correct context, e.g. "Professor · U Toronto\n"))))))
;; start with the first (default) context; ;; set `mu4e-context-policy` and `mu4e-compose-policy` to tweak when mu4e should
;; default is to ask-if-none (ask when there's no context yet, and none match) ;; guess or ask the correct context, e.g.
(setq mu4e-context-policy 'pick-first)
;; start with the first (default) context;
;; compose with the current context is no context matches; ;; default is to ask-if-none (ask when there's no context yet, and none match)
;; default is to ask (setq mu4e-context-policy 'ask-if-none)
(setq mu4e-compose-context-policy 'pick-first)
;; compose with the current context is no context matches;
;; default is to ask
(add-hook 'mu4e-headers-mode-hook (setq mu4e-compose-context-policy 'ask-if-none)
#'(lambda () (setq-local show-trailing-whitespace nil)))
(add-hook 'mu4e-view-mode-hook
#'(lambda () (setq-local show-trailing-whitespace nil))) (add-hook 'mu4e-headers-mode-hook
(add-hook 'mu4e-compose-mode-hook #'(lambda () (setq-local show-trailing-whitespace nil)))
#'(lambda () (add-hook 'mu4e-view-mode-hook
(auto-fill-mode -1) #'(lambda () (setq-local show-trailing-whitespace nil)))
(visual-line-mode) (add-hook 'mu4e-compose-mode-hook
;; flyspell does not want to work with buffers that #'(lambda ()
;; start with a "*", but this includes compose buffers (auto-fill-mode -1)
;; (that are called *draft*) (visual-line-mode)
(let ((flyspell-lazy-disallow-buffers nil)) ;; flyspell does not want to work with buffers that
(flyspell-mode)))) ;; start with a "*", but this includes compose buffers
;; (that are called *draft*)
(let ((flyspell-lazy-disallow-buffers nil))
(flyspell-mode))))
(define-key-alist message-mode-map (define-key-alist message-mode-map
'(("M-\"" . (lambda (r-begin r-end) '(("M-\"" . (lambda (r-begin r-end)
(interactive "r") (interactive "r")
(add-delimiter "“" "”" r-begin r-end))))) (add-delimiter "“" "”" r-begin r-end)))))
#+end_src #+end_src
@ -1061,7 +1066,7 @@
;; Get mail ;; Get mail
(setq mu4e-get-mail-command " mbsync math-fast; mbsync proton-capture" (setq mu4e-get-mail-command "mbsync math-fast; mbsync proton-capture"
mu4e-change-filenames-when-moving t ; needed for mbsync mu4e-change-filenames-when-moving t ; needed for mbsync
mu4e-headers-include-related nil ;do not include threaded mu4e-headers-include-related nil ;do not include threaded
;sent messages in inbox queries ;sent messages in inbox queries

Loading…
Cancel
Save