[Emacs] Better mu4e, nov-mode config

Better formatting for `eshell-info-banner' bookmark

Unbind some keys for some keymaps

Better face for replied to emails

Remove useless `progn'

Go from `:general' to `general-define-key'. For some reason, the
former seems to not perform correctly.
This commit is contained in:
Lucien Cartier-Tilet 2021-07-30 18:23:36 +02:00
parent 59362050d1
commit 8604abc87d
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA

View File

@ -1221,9 +1221,11 @@ We can finally define our bookmarks! The code reads as follows:
:query ,(format "%s AND %s" :query ,(format "%s AND %s"
<<mu4e-bookmarks-inbox-filters>> <<mu4e-bookmarks-inbox-filters>>
<<mu4e-bookmarks-filter-uni>>)) <<mu4e-bookmarks-filter-uni>>))
(:name "eshell-info-banner" :key ?E :query ,(format "%s AND %s" (:name "eshell-info-banner"
<<mu4e-bookmarks-inbox-filters>> :key ?E
"list:eshell-info-banner.el.Phundrak.github.com")) :query ,(format "%s AND %s"
<<mu4e-bookmarks-inbox-filters>>
"list:eshell-info-banner.el.Phundrak.github.com"))
(:name "Sent" :key ?s :query "maildir:/Sent") (:name "Sent" :key ?s :query "maildir:/Sent")
(:name "All Unread" :key ?U :query "flag:unread AND NOT flag:trashed") (:name "All Unread" :key ?U :query "flag:unread AND NOT flag:trashed")
(:name "Today" :key ?t :query "date:today..now AND NOT flag:trashed") (:name "Today" :key ?t :query "date:today..now AND NOT flag:trashed")
@ -1324,12 +1326,14 @@ bépo layout: ~hjkl~ becomes ~ctsr~ for us. Lets undefine some of these:
#+begin_src emacs-lisp :tangle no #+begin_src emacs-lisp :tangle no
(general-define-key (general-define-key
:keymaps '(mu4e-headers-mode-map mu4e-view-mode-map) :keymaps '(mu4e-headers-mode-map mu4e-view-mode-map)
"s" nil) "SPC" nil
"s" nil)
(general-define-key (general-define-key
:states 'normal :states 'normal
:keymaps '(mu4e-headers-mode-map mu4e-view-mode-map) :keymaps '(mu4e-headers-mode-map mu4e-view-mode-map)
"s" nil "SPC" nil
"," nil) "s" nil
"," nil)
(general-define-key (general-define-key
:keymaps 'mu4e-view-mode-map :keymaps 'mu4e-view-mode-map
"SPC" nil "SPC" nil
@ -1529,7 +1533,7 @@ the major-mode leader and call a simple function.
(use-package org-msg (use-package org-msg
:after (org mu4e) :after (org mu4e)
:straight (:build t) :straight (:build t)
:hook (mu4e-compose-pre . org-msg-mode) :hook ((mu4e-compose-pre . org-msg-mode))
:general (:keymaps 'org-msg-edit-mode-map :general (:keymaps 'org-msg-edit-mode-map
:prefix "," :prefix ","
:states 'normal :states 'normal
@ -1539,29 +1543,30 @@ the major-mode leader and call a simple function.
"k" #'message-kill-buffer "k" #'message-kill-buffer
"s" #'message-dont-send "s" #'message-dont-send
"f" #'org-msg-attach) "f" #'org-msg-attach)
:custom-face
(mu4e-replied-face ((t (:weight normal :foreground "#b48ead"))))
:config :config
(progn (defun my/org-msg-signature-convert (orig-fun &rest args)
(defun my/org-msg-signature-convert (orig-fun &rest args) "Tweak my signature when replying as plain/text only."
"Tweak my signature when replying as plain/text only." (let ((res (apply orig-fun args)))
(let ((res (apply orig-fun args))) (when (equal (cadr args) '(text))
(when (equal (cadr args) '(text)) (setf (alist-get 'signature res)
(setf (alist-get 'signature res) (replace-regexp-in-string "\n+" "\n" org-msg-signature)))
(replace-regexp-in-string "\n+" "\n" org-msg-signature))) res))
res)) (advice-add 'org-msg-composition-parameters
(advice-add 'org-msg-composition-parameters :around 'my/org-msg-signature-convert)
:around 'my/org-msg-signature-convert) (add-hook 'mu4e-headers-mode (lambda () (toggle-truncate-lines -1)))
(setq org-msg-startup "inlineimages"
(setq org-msg-startup "inlineimages" org-msg-default-alternatives '((new . (text html))
org-msg-default-alternatives '((new . (text html)) (reply-to-html . (text html))
(reply-to-html . (text html)) (reply-to-text . (text)))
(reply-to-text . (text))) org-msg-convert-citation t
org-msg-convert-citation t org-msg-greeting-name-limit 3
org-msg-greeting-name-limit 3 org-msg-signature (format "\n--\n#+begin_signature\n%s\n#+end_signature"
org-msg-signature (format "\n--\n#+begin_signature\n%s\n#+end_signature" (replace-regexp-in-string (regexp-quote "\n") "\n\n"
(with-temp-buffer (with-temp-buffer
(insert-file-contents mail-signature-file) (insert-file-contents mail-signature-file)
(buffer-string)))))) (buffer-string))))))
#+end_src #+end_src
**** Email alerts **** Email alerts
@ -1597,8 +1602,9 @@ reader?
:straight (:build t) :straight (:build t)
:defer t :defer t
:mode ("\\.epub\\'" . nov-mode) :mode ("\\.epub\\'" . nov-mode)
:general :config
(:keymaps 'nov-mode-map (general-define-key
:keymaps 'nov-mode-map
:states 'normal :states 'normal
"SPC" nil "SPC" nil
"c" #'nov-previous-document "c" #'nov-previous-document
@ -1614,7 +1620,6 @@ reader?
"gt" #'nov-goto-toc "gt" #'nov-goto-toc
"gv" #'nov-view-source "gv" #'nov-view-source
"gV" #'nov-view-content-source) "gV" #'nov-view-content-source)
:config
(setq nov-text-width 95)) (setq nov-text-width 95))
#+end_src #+end_src