From 7e56699b153c601fc024d1e218ce589adfe9438e Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 11 Nov 2021 22:20:11 +0000 Subject: white shuffling --- email.org | 184 ++++++++++++++++++++++++++++++-------------------------------- eww.org | 1 - 2 files changed, 89 insertions(+), 96 deletions(-) diff --git a/email.org b/email.org index f02b605..4088dc1 100644 --- a/email.org +++ b/email.org @@ -1,7 +1,35 @@ #+property: header-args:emacs-lisp :lexical t :tangle yes :comments yes :results silent :shebang ";; -*- lexical-binding: t; -*-" :tangle-mode (identity #o644) #+title: email handling (message mode, bbdb, gnus, notmuch) -#+auto_tangle: t +* gnus +*** directories + #+begin_src emacs-lisp + (setq gnus-init-file "~/.emacs.d/gnus.el" + gnus-home-directory "~/.emacs.d/gnus" + gnus-directory gnus-home-directory + gnus-cache-directory (expand-file-name "cache" gnus-home-directory) + gnus-kill-files-directory (expand-file-name "News" gnus-home-directory) + message-directory (expand-file-name "Mail" gnus-home-directory) + mail-source-directory (expand-file-name "Mail" gnus-home-directory)) + + (when (eq jao-afio-mail-function 'gnus) + (let ((org-file (expand-file-name "gnus.org" jao-emacs-dir))) + (when (file-newer-than-file-p org-file gnus-init-file) + (org-babel-tangle-file org-file)))) + + #+end_src +*** notifications + #+begin_src emacs-lisp + (defun jao-gnus-notify () + (interactive) + (when (fboundp 'jao-gnus--notify) + (unless (derived-mode-p 'gnus-summary-mode + 'gnus-article-mode + 'gnus-group-mode) + (let ((inhibit-message t)) + (gnus-demon-scan-news) + (gnus-group-expire-all-groups))))) + #+end_src * message mode *** Customization #+begin_src emacs-lisp @@ -10,7 +38,6 @@ (defvar jao-mails-regexp) (setq jao-mails-regexp (regexp-opt jao-mails)) - (require 'message) (setq message-send-mail-function 'message-send-mail-with-sendmail message-sendmail-envelope-from 'header message-sendmail-f-is-evil nil) @@ -49,8 +76,7 @@ (setq message-expand-name-standard-ui t) #+end_src *** Encryption - #+BEGIN_SRC emacs-lisp - (require 'gnutls) + #+begin_src emacs-lisp ;; avoiding bogus warning (setq gnutls-min-prime-bits nil) (setq gnus-buttonized-mime-types @@ -68,21 +94,18 @@ (setq smime-CA-directory "/etc/ssl/certs/" smime-certificate-directory"/home/jao/.emacs.d/gnus/Mail/certs/") - ;; Tells Gnus to inline the part - (eval-after-load "mm-decode" - '(add-to-list 'mm-inlined-types "application/pgp$")) - ;; Tells Gnus how to display the part when it is requested - (eval-after-load "mm-decode" - '(add-to-list 'mm-inline-media-tests '("application/pgp$" - mm-inline-text identity))) - ;; Tell Gnus not to wait for a request, just display the thing - ;; straight away. - (eval-after-load "mm-decode" - '(add-to-list 'mm-automatic-display "application/pgp$")) - ;; But don't display the signatures, please. - (eval-after-load "mm-decode" - (quote (setq mm-automatic-display (remove "application/pgp-signature" - mm-automatic-display)))) + (with-eval-after-load "mm-decode" + ;; Tells Gnus to inline the part + (add-to-list 'mm-inlined-types "application/pgp$") + ;; Tells Gnus how to display the part when it is requested + (add-to-list 'mm-inline-media-tests '("application/pgp$" + mm-inline-text identity)) + ;; Tell Gnus not to wait for a request, just display the thing + ;; straight away. + (add-to-list 'mm-automatic-display "application/pgp$") + ;; But don't display the signatures, please. + (setq mm-automatic-display (remove "application/pgp-signature" + mm-automatic-display))) ;; decide whether to encrypt or just sign outgoing messages (defvar jao-message-try-sign nil) @@ -102,14 +125,11 @@ (eval-after-load "rfc2047" '(add-to-list 'rfc2047-header-encoding-alist '("User-Agent" . address-mime))) - - ;; (define-key message-mode-map [f7] 'mml-secure-message-sign-pgp) - (define-key message-mode-map [f8] 'mml-secure-message-encrypt-pgp) - #+END_SRC + #+end_src *** Attach image to message Use ~C-c C-p~ in message-mode. *** Check attachment - #+BEGIN_SRC emacs-lisp + #+begin_src emacs-lisp (defvar jao-message-attachment-regexp "\\([Ww]e send\\|[Ii] send\\|attach\\)") (defun jao-message-check-attachment () "Check if there is an attachment in the message if I claim it." @@ -121,7 +141,7 @@ (message-y-or-n-p "No attachment. Send the message? " nil nil)) (error "No message sent"))))) - #+END_SRC + #+end_src *** Check Fcc/Gcc #+begin_src emacs-lisp (defun jao-message-check-gcc () @@ -148,16 +168,17 @@ #+end_src *** Randomsig #+begin_src emacs-lisp - (when (require 'randomsig nil t) - (define-key message-mode-map (kbd "C-c s") 'randomsig-replace-sig) - (define-key message-mode-map (kbd "C-c S") 'randomsig-select-sig) - (setq randomsig-dir (expand-file-name "~/etc/config/emacs")) - (setq randomsig-files '("signatures.txt")) - ;; or (setq randomsig-files (randomsig-search-sigfiles)) - ;; or (setq randomsig-files 'randomsig-search-sigfiles) - (setq message-signature 'randomsig-signature) - (setq randomsig-delimiter-pattern "^%$" - randomsig-delimiter "%")) + (with-eval-after-load "message" + (when (require 'randomsig nil t) + (define-key message-mode-map (kbd "C-c s") 'randomsig-replace-sig) + (define-key message-mode-map (kbd "C-c S") 'randomsig-select-sig) + (setq randomsig-dir (expand-file-name "~/etc/config/emacs")) + (setq randomsig-files '("signatures.txt")) + ;; or (setq randomsig-files (randomsig-search-sigfiles)) + ;; or (setq randomsig-files 'randomsig-search-sigfiles) + (setq message-signature 'randomsig-signature) + (setq randomsig-delimiter-pattern "^%$" + randomsig-delimiter "%"))) #+end_src *** Send mail hooks #+begin_src emacs-lisp @@ -169,12 +190,13 @@ #+end_src *** Keybindings #+begin_src emacs-lisp - (define-key message-mode-map (kbd "C-c y") #'yank-media) + (with-eval-after-load "message" + ;; (define-key message-mode-map [f7] 'mml-secure-message-sign-pgp) + (define-key message-mode-map [f8] 'mml-secure-message-encrypt-pgp) + (define-key message-mode-map (kbd "C-c y") #'yank-media)) #+end_src * sendmail/smtp #+begin_src emacs-lisp - (require 'smtpmail) - (defun jao-sendmail-gmail () (setq smtpmail-auth-supported '(login cram-md5 plain)) (setq smtpmail-smtp-server "smtp.gmail.com") @@ -198,7 +220,6 @@ * mailcap #+begin_src emacs-lisp (use-package mailcap - :config (add-to-list 'mailcap-mime-extensions '(".JPEG" . "image/jpeg")) (add-to-list 'mailcap-mime-extensions '(".JPG" . "image/jpeg")) @@ -277,11 +298,10 @@ (add-hook 'bbdb-after-change-hook (lambda (arg) (bbdb-save))) (require 'bbdb-anniv) ;; BBDB 3.x this gets birthdays in org agenda ;; and diary - clever stuff - (add-hook 'diary-list-entries-hook 'bbdb-anniv-diary-entries)) + (add-hook 'diary-list-entries-hook 'bbdb-anniv-diary-entries) - (require 'bbdb) - (setq bbdb-file (expand-file-name "~/.emacs.d/bbdb")) - (bbdb-initialize 'message 'pgp) ;; 'mail + (setq bbdb-file (expand-file-name "~/.emacs.d/bbdb")) + (bbdb-initialize 'message 'pgp 'gnus 'mail)) #+end_src * mailboxes #+begin_src emacs-lisp @@ -334,60 +354,34 @@ (jao-consult-add-buffer-source 'jao-mail-consult-source "Mail" ?n) #+end_src -* gnus -*** Directories - #+begin_src emacs-lisp - (setq gnus-init-file "~/.emacs.d/gnus.el" - gnus-home-directory "~/.emacs.d/gnus" - gnus-directory gnus-home-directory - mail-source-directory (expand-file-name "Mail" gnus-home-directory)) - - (when (eq jao-afio-mail-function 'gnus) - (let ((org-file (expand-file-name "gnus.org" jao-emacs-dir))) - (when (file-newer-than-file-p org-file gnus-init-file) - (org-babel-tangle-file org-file)))) - - #+end_src -*** Notifications - #+begin_src emacs-lisp - (defun jao-gnus-notify () - (interactive) - (when (fboundp 'jao-gnus--notify) - (unless (derived-mode-p 'gnus-summary-mode - 'gnus-article-mode - 'gnus-group-mode) - (let ((inhibit-message t)) - (gnus-demon-scan-news) - (gnus-group-expire-all-groups))))) - #+end_src * notmuch #+begin_src emacs-lisp (when (eq jao-afio-mail-function 'notmuch) (jao-load-org "notmuch")) #+end_src -*** consult - #+begin_src emacs-lisp - (jao-load-path "consult-notmuch") - (require 'consult-notmuch) - (consult-customize consult-notmuch :preview-key 'any) - - (defvar jao-consult-notmuch-history nil) - - (defun jao-consult-notmuch-folder (&optional tree folder) - (interactive "P") - (let* ((root "~/var/mail/") - (folder (if folder - (file-name-as-directory folder) - (completing-read "Folder: " - jao-mailbox-folders - nil nil nil - jao-consult-notmuch-history - "."))) - (folder (replace-regexp-in-string "/\\(.\\)" ".\\1" folder)) - (init (read-string "Initial query: ")) - (init (format "folder:/%s/ %s" folder init))) - (if tree (consult-notmuch-tree init) (consult-notmuch init)))) - - (with-eval-after-load "notmuch-hello" - (define-key notmuch-hello-mode-map "f" #'jao-consult-notmuch-folder)) - #+end_src +* consult notmuch + #+begin_src emacs-lisp + (jao-load-path "consult-notmuch") + (require 'consult-notmuch) + (consult-customize consult-notmuch :preview-key 'any) + + (defvar jao-consult-notmuch-history nil) + + (defun jao-consult-notmuch-folder (&optional tree folder) + (interactive "P") + (let* ((root "~/var/mail/") + (folder (if folder + (file-name-as-directory folder) + (completing-read "Folder: " + jao-mailbox-folders + nil nil nil + jao-consult-notmuch-history + "."))) + (folder (replace-regexp-in-string "/\\(.\\)" ".\\1" folder)) + (init (read-string "Initial query: ")) + (init (format "folder:/%s/ %s" folder init))) + (if tree (consult-notmuch-tree init) (consult-notmuch init)))) + + (with-eval-after-load "notmuch-hello" + (define-key notmuch-hello-mode-map "f" #'jao-consult-notmuch-folder)) + #+end_src diff --git a/eww.org b/eww.org index f7cd668..6d4348a 100644 --- a/eww.org +++ b/eww.org @@ -1,6 +1,5 @@ #+property: header-args :lexical t :tangle yes :comments yes :results silent :shebang ";; -*- lexical-binding: t -*-" :tangle-mode (identity #o644) #+title: Web browsing using eww -#+auto_tangle: t * Integration with browse-url and afio #+begin_src emacs-lisp -- cgit v1.2.3