Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. (require 'notmuch)
  2. (setq notmuch-command "~/remote-notmuch.sh")
  3. (setq notmuch-fcc-dirs nil)
  4. (add-hook 'gnus-group-mode-hook 'lld-notmuch-shortcut)
  5. (require 'org-gnus)
  6.  
  7. (defun lld-notmuch-shortcut ()
  8. (define-key gnus-group-mode-map "GG" 'notmuch-search)
  9. )
  10.  
  11. (defun lld-notmuch-file-to-group (file)
  12. "Calculate the Gnus group name from the given file name."
  13. (let ((group (file-name-directory (directory-file-name (file-name-directory file)))))
  14. (setq group (replace-regexp-in-string ".*/Maildir/" "nnimap+apollo.corbe.net:" group))
  15. (setq group (replace-regexp-in-string "/$" "" group))
  16. (if (string-match ":$" group)
  17. (concat group "INBOX")
  18. (replace-regexp-in-string ":\\." ":" group))))
  19.  
  20. (defun lld-notmuch-goto-message-in-gnus ()
  21. "Open a summary buffer containing the current notmuch
  22. article."
  23. (interactive)
  24. (let ((group (lld-notmuch-file-to-group (notmuch-show-get-filename)))
  25. (message-id (replace-regexp-in-string
  26. "^id:" "" (notmuch-show-get-message-id))))
  27. (setq message-id (replace-regexp-in-string "\"" "" message-id))
  28. (if (and group message-id)
  29. (progn
  30. (switch-to-buffer "*Group*")
  31. (switch-to-buffer "*Group*")
  32. (org-gnus-follow-link group message-id))
  33. (message "Couldn't get relevant infos for switching to Gnus."))))
  34.  
  35. (define-key notmuch-show-mode-map (kbd "C-c C-c") 'lld-notmuch-goto-message-in-gnus)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement