feat(emacs): TRAMP on Guix, move notmuch to Mail.org

This commit is contained in:
Pavel Korytov 2021-06-18 17:03:51 +03:00
parent 973062cca2
commit 4707940163
3 changed files with 62 additions and 46 deletions

View file

@ -844,6 +844,10 @@ then it takes a second \\[keyboard-quit] to abort the minibuffer."
vc-ignore-dir-regexp
tramp-file-name-regexp))
(setq tramp-remote-path
(append tramp-remote-path
'(tramp-own-remote-path)))
(defun my/dired-bookmark-open ()
(interactive)
(unless (boundp 'my/dired-bookmarks)
@ -1464,13 +1468,18 @@ parent."
(dolist (elem (cdr table))
(when
(and
;; Category
(or
;; Category not set and not present in the table
(and
(not category)
(or (not category) (string-empty-p category))
(not category-name-index))
;; Category is set and present in the table
(and
category-name-index
(not (string-empty-p category))
(string-match-p category (nth category-name-index elem))))
;; Not disabled
(or
(not disabled-name-index)
(string-empty-p (nth disabled-name-index elem))))
@ -1489,7 +1498,8 @@ parent."
'("/home/pavel/Emacs.org"
"/home/pavel/Desktop.org"
"/home/pavel/Console.org"
"/home/pavel/Guix.org"))
"/home/pavel/Guix.org"
"/home/pavel/Mail.org"))
(add-hook 'org-mode-hook
(lambda ()
@ -2386,11 +2396,11 @@ parent."
(with-eval-after-load 'tramp
(add-to-list 'tramp-methods
'("yadm"
`("yadm"
(tramp-login-program "yadm")
(tramp-login-args (("enter")))
(tramp-login-env (("SHELL") (locate-file "file" exec-path)))
(tramp-remote-shell (locate-file "file" exec-path))
(tramp-login-env (("SHELL") "/bin/sh"))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c")))))
@ -2414,22 +2424,7 @@ parent."
(general-define-key "C-c f" 'my/open-yadm-file)
(my-leader-def "cf" 'my/open-yadm-file)
(use-package notmuch
:ensure nil
:commands (notmuch)
:config
(setq mail-specify-envelope-from t)
(setq message-sendmail-envelope-from 'header)
(setq mail-envelope-from 'header)
(setq notmuch-always-prompt-for-sender t)
(setq sendmail-program "/usr/bin/msmtp")
(setq send-mail-function #'sendmail-send-it)
(add-hook 'notmuch-hello-mode-hook
(lambda () (display-line-numbers-mode 0)))
(custom-set-faces
`(notmuch-wash-cited-text ((t (:foreground ,(doom-color 'yellow)))))))
(my-leader-def "am" 'notmuch)
(load-file (expand-file-name "mail.el" user-emacs-directory))
(use-package elfeed
:straight (:repo "SqrtMinusOne/elfeed" :host github)

32
.emacs.d/mail.el Normal file
View file

@ -0,0 +1,32 @@
(setq my/notmuch-loaded nil)
(defun my/run-notmuch ()
(interactive)
(when (not my/notmuch-loaded)
(let* ((notmuch-dir (shell-command-to-string "readlink -f $(which notmuch)"))
(notmuch-version (substring (shell-command-to-string "notmuch --version") 8 -1))
(notmuch-lisp-dir (concat
(substring notmuch-dir 0 -13)
"/share/emacs/site-lisp/notmuch-"
notmuch-version
"/")))
(push notmuch-lisp-dir load-path))
(setq my/notmuch-loaded t))
(notmuch))
(my-leader-def "am" 'my/run-notmuch)
(use-package notmuch
;; :ensure nil
:commands (notmuch)
:config
(setq mail-specify-envelope-from t)
(setq message-sendmail-envelope-from 'header)
(setq mail-envelope-from 'header)
(setq notmuch-always-prompt-for-sender t)
(setq sendmail-program (executable-find "msmtp"))
(setq send-mail-function #'sendmail-send-it)
(add-hook 'notmuch-hello-mode-hook
(lambda () (display-line-numbers-mode 0)))
(custom-set-faces
`(notmuch-wash-cited-text ((t (:foreground ,(doom-color 'yellow)))))))

View file

@ -1565,6 +1565,13 @@ Some other optimization settings:
vc-ignore-dir-regexp
tramp-file-name-regexp))
#+end_src
Also, here is a hack to make TRAMP find =ls= on Guix:
#+begin_src emacs-lisp
(setq tramp-remote-path
(append tramp-remote-path
'(tramp-own-remote-path)))
#+end_src
** Bookmarks
A simple bookmark list for Dired, mainly to use with TRAMP. I may look into a proper bookmarking system later.
@ -2418,7 +2425,8 @@ Turn off eval confirmations for configuration files.
'("/home/pavel/Emacs.org"
"/home/pavel/Desktop.org"
"/home/pavel/Console.org"
"/home/pavel/Guix.org"))
"/home/pavel/Guix.org"
"/home/pavel/Mail.org"))
(add-hook 'org-mode-hook
(lambda ()
@ -3596,11 +3604,11 @@ Idea:
#+begin_src emacs-lisp
(with-eval-after-load 'tramp
(add-to-list 'tramp-methods
'("yadm"
`("yadm"
(tramp-login-program "yadm")
(tramp-login-args (("enter")))
(tramp-login-env (("SHELL") (locate-file "file" exec-path)))
(tramp-remote-shell (locate-file "file" exec-path))
(tramp-login-env (("SHELL") "/bin/sh"))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c")))))
@ -3630,30 +3638,11 @@ Open a file managed by yadm.
#+end_src
** Notmuch
My notmuch config.
References:
- [[https://sqrtminusone.xyz/posts/2021-02-27-gmail/][My post about notmuch configuration]]
My notmuch config now resides in [[file:Mail.org][Mail.org]].
#+begin_src emacs-lisp
(use-package notmuch
:ensure nil
:commands (notmuch)
:config
(setq mail-specify-envelope-from t)
(setq message-sendmail-envelope-from 'header)
(setq mail-envelope-from 'header)
(setq notmuch-always-prompt-for-sender t)
(setq sendmail-program "/usr/bin/msmtp")
(setq send-mail-function #'sendmail-send-it)
(add-hook 'notmuch-hello-mode-hook
(lambda () (display-line-numbers-mode 0)))
(custom-set-faces
`(notmuch-wash-cited-text ((t (:foreground ,(doom-color 'yellow)))))))
(my-leader-def "am" 'notmuch)
(load-file (expand-file-name "mail.el" user-emacs-directory))
#+end_src
** Elfeed
[[https://github.com/skeeto/elfeed][elfeed]] is an Emacs RSS client.