summaryrefslogtreecommitdiff
path: root/home/dots
diff options
context:
space:
mode:
Diffstat (limited to 'home/dots')
-rw-r--r--home/dots/.emacs313
1 files changed, 187 insertions, 126 deletions
diff --git a/home/dots/.emacs b/home/dots/.emacs
index 1375d33..be5dfed 100644
--- a/home/dots/.emacs
+++ b/home/dots/.emacs
@@ -26,7 +26,9 @@
magit
markdown-mode
mastodon
+
nix-mode
+ notmuch
nov
pass
pinentry
@@ -385,6 +387,12 @@
(completion-auto-select 'second-tab)
(completion-ignore-case t))
+(use-package notmuch
+ :bind
+ (("C-c m " . notmuch-jump-search))
+ :custom
+ ((notmuch-show-logo nil)))
+
(use-package pass
:defer t
:ensure t)
@@ -519,6 +527,61 @@
:custom
(eww-auto-rename-buffer t)
(eww-buffer-name-length 20)
+ :config
+ (defun unpackaged/eww-imenu-index ()
+ "Return Imenu index for current EWW buffer.
+Index includes links and headings."
+ (let ((shr-heading-faces '( shr-h1 shr-h2 shr-h3 shr-h4 shr-h5
+ shr-h6 shr-heading)))
+ (cl-labels ((range-matching (property predicate)
+ "Return (BEG . END) cons from point where PROPERTY matches PREDICATE.
+ PREDICATE is used for `text-property-search-forward', which see."
+ (when-let ((match (text-property-search-forward property nil predicate))
+ (end (cl-loop
+ for next-change-pos = (prop-match-end match) then next-change-pos
+ for next-change-pos = (next-single-property-change next-change-pos property)
+ when next-change-pos
+ for end-pos = next-change-pos
+ while (funcall predicate nil (get-text-property next-change-pos property))
+ finally return end-pos)))
+ (cons (prop-match-beginning match) end)))
+ (shr-heading-p (_ value-of)
+ (cl-typecase value-of
+ (atom (member value-of shr-heading-faces))
+ (list (seq-intersection value-of shr-heading-faces)))))
+ (let ((links (save-excursion
+ (goto-char (point-min))
+ (delete-dups
+ (cl-loop for url = (get-text-property (point) 'shr-url)
+ when url collect (cons (format "%s <%s>"
+ (button-label (button-at (point)))
+ url)
+ (point))
+ for pos = (next-single-property-change (point) 'shr-url)
+ while pos do (goto-char pos)))))
+ (headings (save-excursion
+ (goto-char (point-min))
+ (cl-loop for (next-beg . next-end) = (range-matching 'face #'shr-heading-p)
+ while next-beg
+ for text = (buffer-substring next-beg next-end)
+ collect (cons text next-beg)
+ and do (goto-char next-end)))))
+ (list (cons "Headings" headings)
+ (cons "Links" links))))))
+
+ (defun unpackaged/eww-imenu-goto (_label position)
+ "Go to POSITION and call `eww-follow-link' if one is there."
+ (goto-char position)
+ (when (button-at (point))
+ (declare-function eww-follow-link "eww")
+ (call-interactively #'eww-follow-link)))
+
+ (defun unpackaged/eww-imenu-setup ()
+ "Setup Imenu in EWW buffers."
+ (setq-local imenu-create-index-function #'unpackaged/eww-imenu-index
+ imenu-default-goto-function #'unpackaged/eww-imenu-goto))
+ :hook
+ ((eww-mode . unpackaged/eww-imenu-setup))
:bind
((:map eww-mode-map
("+" . image-increase-size))))
@@ -907,6 +970,8 @@
"#netbsd"
"#guile"
"#nonguix"
+ "#linux"
+ "#notmuch"
"#guix")))
:bind
("\C-ceo" .
@@ -994,8 +1059,6 @@
(org-mode . visual-line-mode)
(org-mode . variable-pitch-mode)))
-
-
(use-package org-id
:after org
:init
@@ -1347,12 +1410,10 @@
(use-package message
:custom
(user-mail-address "marc@coquand.email")
- (message-default-headers "FCC: ~/personal-db/mail/home/out/sent.mbox")
(message-signature "Marc")
(message-expand-name-standard-ui t)
(message-wide-reply-confirm-recipients t)
(message-interactive t)
- (message-fcc-handler-function 'rmail-output)
(message-citation-line-function 'message-insert-formatted-citation-line)
(message-mail-alias-type 'ecomplete)
(message-self-insert-commands nil)
@@ -1375,128 +1436,128 @@
:custom
(sendmail-program (executable-find "msmtp")))
-(use-package rmail
- :init
- (defvar selected-rmail-account "home")
- (defun rmail-reply-t ()
- "Reply only to the sender of the current message. (See rmail-reply.)"
- (interactive)
- (rmail-reply t))
-
- (defmacro without-yes-or-no (&rest body)
- "Override `yes-or-no-p' & `y-or-n-p', not to prompt for input and return t."
- (declare (indent 1))
- `(cl-letf (((symbol-function 'yes-or-no-p) (lambda (&rest _) t))
- ((symbol-function 'y-or-n-p) (lambda (&rest _) t)))
- ,@body))
-
- ;; Copied from the pipe of mu4e
- (defun rmail-process-file-through-pipe (path pipecmd)
- "Process file at PATH through a pipe with PIPECMD."
- (let ((buf (get-buffer-create "*rmail-output")))
- (with-current-buffer buf
- (let ((inhibit-read-only t))
- (erase-buffer)
- (call-process-shell-command pipecmd path t t)
- (view-mode)))
- (display-buffer buf)))
-
- (defun rmail-pipe-email (cmd)
- (interactive "sShell command: ")
- (let ((path
- (concat "/tmp/rmail-pipe-msg-"
- (number-to-string (time-convert (current-time) 'integer))
- ".mbox")))
- (without-yes-or-no
- (rmail-output-as-seen path nil t)
- (rmail-process-file-through-pipe path cmd))))
- :hook
- ((rmail-mode . variable-pitch-mode)
- (rmail-quit . rmail-expunge-and-save))
- :bind
- (("C-c m" . rmail-open)
- ("C-c M" . rmail-open-no-check)
- :map rmail-mode-map
- ("r" . rmail-reply-t)
- ("R" . rmail-reply)
- ("|" . rmail-pipe-email))
- :config
- (defun rmail-no-check ()
- (interactive)
- (rmail-input rmail-file-name))
-
- (defun mail-work ()
- (interactive)
- (setq
- rmail-primary-inbox-list (list (concat "imaps://" "marc.coquand%40piva.earth" ":" piva-password "@imap.gmail.com:993"))
- rmail-default-file "~/personal-db/mail/work/RMAIL"
- rmail-file-name "~/personal-db/mail/work/RMAIL"
- user-mail-address "marc.coquand@piva.earth"
- unrmail-mbox-format 'mboxo
- user-full-name "Marc Coquand"
- message-default-headers "FCC: ~/personal-db/mail/work/out/sent.mbox"
- message-signature "Marc Coquand\nFounder at Pivå"))
-
- (defun mail-home ()
- (interactive)
- (setq
- rmail-default-file "~/personal-db/mail/home/RMAIL"
- rmail-primary-inbox-list (list (concat "imaps://" "marcc%40fastmail.fr" ":" fastmail-password "@imap.fastmail.com:993"))
- rmail-secondary-file-regexp "~/personal-db/mail/home/archives/*.mbox"
- rmail-output-file-alist '(("\\[PATCH.*\\]" . "patch.mbox")
- ("[rR]eceipt" . "receipt.mbox")
- ("[pP]ayment" . "receipt.mbox")
- ("[oO]rder" . "receipt.mbox")
- (".*" . "archive.mbox"))
- rmail-file-name "~/personal-db/mail/home/RMAIL"
- ;; In case there are errors, you can set '("--set=onerror=delete")
- rmail-movemail-flags nil
- user-mail-address "marc@coquand.email"
- unrmail-mbox-format 'mboxo
- user-full-name "Marc Coquand"
- message-default-headers "FCC: ~/personal-db/mail/home/out/sent.mbox"
- message-signature "Marc"))
-
- (defun rmail-open-no-check ()
- "Set account and open rmail. Will not check for new messages."
- (interactive)
- (let ((prev selected-rmail-account))
- (setq selected-rmail-account
- (completing-read
- "Account: "
- '(("home" 1) ("work" 2)) nil t))
- (unless (eq selected-rmail-account prev)
- ;; First kill all RMAIL buffers to not leave any dangling
- (kill-matching-buffers "\\.mbox\\|^RMAIL" nil t))
- (if (string= selected-rmail-account "home")
- (mail-home))
- (if (string= selected-rmail-account "work")
- (mail-work)))
- (rmail-no-check))
-
- (defun rmail-open ()
- "Set account and open rmail. Will check for new messages"
- (interactive)
- (let ((prev selected-rmail-account))
- (setq selected-rmail-account
- (completing-read
- "Account: "
- '(("home" 1) ("work" 2)) nil t))
- (unless (eq selected-rmail-account prev)
- ;; First kill all RMAIL buffers to not leave any dangling
- (kill-matching-buffers "\\.mbox\\|^RMAIL" nil t))
- (if (string= selected-rmail-account "home")
- (mail-home))
- (if (string= selected-rmail-account "work")
- (mail-work)))
- (rmail))
- :custom
- (rmail-remote-password-required nil)
- (rmail-preserve-inbox nil)
- (rmail-mime-prefer-html nil)
- ;; Makes forwarding works as expected
- (rmail-enable-mime-composing nil)
- (rmail-displayed-headers "^\\(?:Cc\\|Date\\|From\\|Subject\\|To\\|List-Id\\):"))
+;; (use-package rmail
+;; :init
+;; (defvar selected-rmail-account "home")
+;; (defun rmail-reply-t ()
+;; "Reply only to the sender of the current message. (See rmail-reply.)"
+;; (interactive)
+;; (rmail-reply t))
+;;
+;; (defmacro without-yes-or-no (&rest body)
+;; "Override `yes-or-no-p' & `y-or-n-p', not to prompt for input and return t."
+;; (declare (indent 1))
+;; `(cl-letf (((symbol-function 'yes-or-no-p) (lambda (&rest _) t))
+;; ((symbol-function 'y-or-n-p) (lambda (&rest _) t)))
+;; ,@body))
+;;
+;; ;; Copied from the pipe of mu4e
+;; (defun rmail-process-file-through-pipe (path pipecmd)
+;; "Process file at PATH through a pipe with PIPECMD."
+;; (let ((buf (get-buffer-create "*rmail-output")))
+;; (with-current-buffer buf
+;; (let ((inhibit-read-only t))
+;; (erase-buffer)
+;; (call-process-shell-command pipecmd path t t)
+;; (view-mode)))
+;; (display-buffer buf)))
+;;
+;; (defun rmail-pipe-email (cmd)
+;; (interactive "sShell command: ")
+;; (let ((path
+;; (concat "/tmp/rmail-pipe-msg-"
+;; (number-to-string (time-convert (current-time) 'integer))
+;; ".mbox")))
+;; (without-yes-or-no
+;; (rmail-output-as-seen path nil t)
+;; (rmail-process-file-through-pipe path cmd))))
+;; :hook
+;; ((rmail-mode . variable-pitch-mode)
+;; (rmail-quit . rmail-expunge-and-save))
+;; :bind
+;; (("C-c m" . rmail-open)
+;; ("C-c M" . rmail-open-no-check)
+;; :map rmail-mode-map
+;; ("r" . rmail-reply-t)
+;; ("R" . rmail-reply)
+;; ("|" . rmail-pipe-email))
+;; :config
+;; (defun rmail-no-check ()
+;; (interactive)
+;; (rmail-input rmail-file-name))
+;;
+;; (defun mail-work ()
+;; (interactive)
+;; (setq
+;; rmail-primary-inbox-list (list (concat "imaps://" "marc.coquand%40piva.earth" ":" piva-password "@imap.gmail.com:993"))
+;; rmail-default-file "~/personal-db/mail/work/RMAIL"
+;; rmail-file-name "~/personal-db/mail/work/RMAIL"
+;; user-mail-address "marc.coquand@piva.earth"
+;; unrmail-mbox-format 'mboxo
+;; user-full-name "Marc Coquand"
+;; message-default-headers "FCC: ~/personal-db/mail/work/out/sent.mbox"
+;; message-signature "Marc Coquand\nFounder at Pivå"))
+;;
+;; (defun mail-home ()
+;; (interactive)
+;; (setq
+;; rmail-default-file "~/personal-db/mail/home/RMAIL"
+;; rmail-primary-inbox-list (list (concat "imaps://" "marcc%40fastmail.fr" ":" fastmail-password "@imap.fastmail.com:993"))
+;; rmail-secondary-file-regexp "~/personal-db/mail/home/archives/*.mbox"
+;; rmail-output-file-alist '(("\\[PATCH.*\\]" . "patch.mbox")
+;; ("[rR]eceipt" . "receipt.mbox")
+;; ("[pP]ayment" . "receipt.mbox")
+;; ("[oO]rder" . "receipt.mbox")
+;; (".*" . "archive.mbox"))
+;; rmail-file-name "~/personal-db/mail/home/RMAIL"
+;; ;; In case there are errors, you can set '("--set=onerror=delete")
+;; rmail-movemail-flags nil
+;; user-mail-address "marc@coquand.email"
+;; unrmail-mbox-format 'mboxo
+;; user-full-name "Marc Coquand"
+;; message-default-headers "FCC: ~/personal-db/mail/home/out/sent.mbox"
+;; message-signature "Marc"))
+;;
+;; (defun rmail-open-no-check ()
+;; "Set account and open rmail. Will not check for new messages."
+;; (interactive)
+;; (let ((prev selected-rmail-account))
+;; (setq selected-rmail-account
+;; (completing-read
+;; "Account: "
+;; '(("home" 1) ("work" 2)) nil t))
+;; (unless (eq selected-rmail-account prev)
+;; ;; First kill all RMAIL buffers to not leave any dangling
+;; (kill-matching-buffers "\\.mbox\\|^RMAIL" nil t))
+;; (if (string= selected-rmail-account "home")
+;; (mail-home))
+;; (if (string= selected-rmail-account "work")
+;; (mail-work)))
+;; (rmail-no-check))
+;;
+;; (defun rmail-open ()
+;; "Set account and open rmail. Will check for new messages"
+;; (interactive)
+;; (let ((prev selected-rmail-account))
+;; (setq selected-rmail-account
+;; (completing-read
+;; "Account: "
+;; '(("home" 1) ("work" 2)) nil t))
+;; (unless (eq selected-rmail-account prev)
+;; ;; First kill all RMAIL buffers to not leave any dangling
+;; (kill-matching-buffers "\\.mbox\\|^RMAIL" nil t))
+;; (if (string= selected-rmail-account "home")
+;; (mail-home))
+;; (if (string= selected-rmail-account "work")
+;; (mail-work)))
+;; (rmail))
+;; :custom
+;; (rmail-remote-password-required nil)
+;; (rmail-preserve-inbox nil)
+;; (rmail-mime-prefer-html nil)
+;; ;; Makes forwarding works as expected
+;; (rmail-enable-mime-composing nil)
+;; (rmail-displayed-headers "^\\(?:Cc\\|Date\\|From\\|Subject\\|To\\|List-Id\\):"))
(use-package mastodon