From 29cb3385a9b60603ce9b040db1fa8ce49f38facb Mon Sep 17 00:00:00 2001 From: fpi Date: Tue, 7 Jul 2020 19:43:35 +0200 Subject: Add gnorb to combine gnus, org & bbdb --- emacs-init.org | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- gnus.org | 31 ++++++++++++++++++++--- 2 files changed, 105 insertions(+), 4 deletions(-) diff --git a/emacs-init.org b/emacs-init.org index cd0b1de..77a5662 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -2585,7 +2585,8 @@ Switch projects and subprojects from NEXT back to TODO" :straight t :hook (org-load . org-pdftools-setup-link)) (use-package org-id - :custom (org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)) + :custom (org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id) + <>) (use-package org-clock :custom (org-clock-out-remove-zero-time-clocks t) @@ -2726,6 +2727,78 @@ print the list. :after org :straight (org-plus-contrib)) #+end_src +*** Gnorb +:PROPERTIES: +:ID: 990e2668-11d6-45eb-9c9b-1dc0b89b556d +:END: +This combines [[file:gnus.org][Gnus]] conversations with Org mode for note taking and [[id:390b66e5-b123-4cb1-9a56-61e41d7a818a][BBDB]] for contact information. +#+begin_src emacs-lisp +(use-package gnorb + :straight t + :config + (gnorb-install-defaults) + :custom + <>) +#+end_src +To setup =gnorb= we need to do several things according to [[info:gnorb#Tracking Setup][the manual]]: +1. Activate the gnus registry with ~(gnus-registry-initialize)~ +2. Make sure global id tracking in org-id is enabled + #+begin_src emacs-lisp :noweb-ref org-id-custom :tangle no + (org-id-track-globally t) + #+end_src +3. Add nngnorb to ~gnus-secondary-select-methods~ +4. Call ~(gnorb-tracking-initialize)~. As this requires =gnus= to be loaded, this is called in =gnus.org= +5. Set gnorb saved messages groups + #+begin_src emacs-lisp :tangle no :noweb-ref gnorb-custom + (gnorb-gnus-sent-groups '("nnimap+imsmail:INBOX/work" "nnimap+imsmail:Gesendete ELemente")) + #+end_src +6. Set todo capture template + #+begin_src emacs-lisp :tangle no :noweb-ref gnorb-custom + (gnorb-gnus-new-todo-capture-key "t") + #+end_src + +Default keybindings: +#+begin_example emacs-lisp +(global-set-key (kbd "C-c A") 'gnorb-restore-layout) +(eval-after-load "gnorb-bbdb" + '(progn + (define-key bbdb-mode-map (kbd "C-c S") #'gnorb-bbdb-mail-search) + (define-key bbdb-mode-map (kbd "C-c l") #'gnorb-bbdb-open-link) + (define-key bbdb-mode-map [remap bbdb-mail] #'gnorb-bbdb-mail) + (eval-after-load "gnorb-org" + (org-defkey org-mode-map (kbd "C-c C") #'gnorb-org-contact-link)))) +(eval-after-load "gnorb-org" + '(progn + (org-defkey org-mode-map (kbd "C-c t") #'gnorb-org-handle-mail) + (org-defkey org-mode-map (kbd "C-c v") #'gnorb-org-view) + (org-defkey org-mode-map (kbd "C-c E") #'gnorb-org-email-subtree) + (setq gnorb-org-agenda-popup-bbdb t) + (eval-after-load "org-agenda" + '(progn (org-defkey org-agenda-mode-map (kbd "C-c t") #'gnorb-org-handle-mail) + (org-defkey org-agenda-mode-map (kbd "C-c v") #'gnorb-org-view))))) +(eval-after-load "gnorb-gnus" + '(progn + (define-key gnus-summary-mime-map "a" #'gnorb-gnus-article-org-attach) + (define-key gnus-summary-mode-map (kbd "C-c t") #'gnorb-gnus-incoming-do-todo) + (define-key gnus-summary-mode-map (kbd "C-c v") #'gnorb-gnus-view) + (define-key gnus-summary-mode-map (kbd "C-c C-t") #'gnorb-gnus-tag-message) + (define-key gnus-summary-limit-map (kbd "g") #'gnorb-gnus-insert-tagged-messages) + (define-key gnus-summary-limit-map (kbd "G") #'gnorb-gnus-insert-tracked-messages) + (setq gnorb-gnus-capture-always-attach t) + (push '("attach to org heading" . gnorb-gnus-mime-org-attach) + gnus-mime-action-alist) + (push '(gnorb-gnus-mime-org-attach "a" "Attach to Org heading") + gnus-mime-button-commands) + (setq gnus-mime-button-map + (let ((map (make-sparse-keymap))) + (dolist (c gnus-mime-button-commands) + (define-key map (cadr c) (car c))) + map)))) +(eval-after-load "message" + '(progn + (define-key message-mode-map (kbd "C-c t") #'gnorb-gnus-outgoing-do-todo))) +#+end_example + *** Inline images Resize inline images to 400px but respect width specifications in attribute lines. @@ -4187,6 +4260,9 @@ For now I use this bad code. (footnote-section-tag "")) #+end_src ** BBDB +:PROPERTIES: +:ID: 390b66e5-b123-4cb1-9a56-61e41d7a818a +:END: #+begin_src emacs-lisp (use-package bbdb :straight t) diff --git a/gnus.org b/gnus.org index 84d5a33..d59780f 100644 --- a/gnus.org +++ b/gnus.org @@ -1,4 +1,4 @@ -#+PROPERTY: header-args:emacs-lisp :tangle tangle/gnus.el +#+PROPERTY: header-args:emacs-lisp :tangle tangle/gnus.el :noweb yes #+begin_src shell :results silent :tangle tangle/symlink.sh :shebang "#!/bin/bash" ln -siv $(pwd)/tangle/gnus.el ~/.gnus.el @@ -56,6 +56,7 @@ RSS/Atom Feeds asynchronously. (nnir-search-engine imap) (nnimap-inbox "INBOX"))) (add-to-list 'gnus-secondary-select-methods '(nntp "localhost" 4321)) +<> #+end_src ** Options *** General @@ -193,6 +194,30 @@ Slow scoring decay prevents huge scores from building up. Only run on =.ADAPT= s gnus-score-decay-constant 1 gnus-score-decay-scale 0.01) #+end_src +**** Registry +Use the [[info:gnus#The Gnus Registry][Gnus Registry]]. This is required to use [[id:990e2668-11d6-45eb-9c9b-1dc0b89b556d][Gnorb]]. +#+begin_src emacs-lisp +(gnus-registry-initialize) +#+end_src +#+begin_src emacs-lisp :tangle no :noweb-ref secondary-select-methods +(add-to-list 'gnus-secondary-select-methods '(nngnorb "Gnorb server")) +#+end_src +Enable gnorb tracking +#+begin_src emacs-lisp +(gnorb-tracking-initialize) +#+end_src +Hint for existing relevant tracked conversations in the summary buffer (see [[info:gnorb#Hinting in Gnus][info:gnorb#Hinting in Gnus]]). Already tracked messages are marked with =&= and new maybe relevant messages with =ยก=. +#+begin_src fundamental :tangle no :noweb-ref gnorb-summary-line-format +%ug +#+end_src +Display [[info:gnorb#Tagging Messages and Contacts][message tags]] in the summary line. Stop other summary line content at column 120 and insert the tags after. +#+begin_src fundamental :tangle no :noweb-ref gnorb-summary-tags +%-120=%uG +#+end_src +Also automatically set message tags +#+begin_src emacs-lisp +(setq gnorb-gnus-auto-tag-messages t) +#+end_src *** Display Sort by newest first #+begin_src emacs-lisp @@ -220,8 +245,8 @@ Also try to connect threads by guessing which articles are missing Better thread display (from [[https://www.emacswiki.org/emacs/GnusFormatting][emacswiki/GnusFormatting)]]. #+begin_src emacs-lisp (setq - gnus-summary-line-format "%U%R%z %(%&user-date; %-15,15f %B%s%)\n" - gnus-user-date-format-alist '((t . "%Y-%m-%d %H:%M")) + gnus-summary-line-format "%U%R%z<> %(%&user-date; %-15,15f %B%s%) <>\n" + gnus-user-date-format-alist '((t . "%y-%m-%d %H:%M")) gnus-summary-thread-gathering-function 'gnus-gather-threads-by-references gnus-sum-thread-tree-false-root "" gnus-sum-thread-tree-indent " " -- cgit v1.2.3