diff options
author | jao <jao@gnu.org> | 2021-03-25 17:52:35 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-03-25 17:52:35 +0000 |
commit | 55704c31109c278f03d4a1e9c84770d88781d976 (patch) | |
tree | 6bee556d70fa61f761bacc4ab719ab3b4be4862f /lib/net | |
parent | ec9aa2881c1bfd3cfde296f84d9fb71490961cc0 (diff) | |
download | elibs-55704c31109c278f03d4a1e9c84770d88781d976.tar.gz elibs-55704c31109c278f03d4a1e9c84770d88781d976.tar.bz2 |
new message: org link (and use it consistently: notmuch, recoll, etc.)
Diffstat (limited to 'lib/net')
-rw-r--r-- | lib/net/jao-maildir.el | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/net/jao-maildir.el b/lib/net/jao-maildir.el index d68fbe0..d7cd4d6 100644 --- a/lib/net/jao-maildir.el +++ b/lib/net/jao-maildir.el @@ -34,6 +34,7 @@ (defvar jao-maildir-echo-p t) (defvar jao-maildir-tracked-maildirs nil) (defvar jao-maildir-info-string "") +(defvar jao-maildir-home (expand-file-name "~/var/mail")) (defgroup jao-maildir-faces nil "Faces" :group 'faces) @@ -150,6 +151,33 @@ (t (error "Invalid mode-line value"))) (jao-maildir--setup-watches cb)) +;;;###autoload +(defun jao-maildir-file-to-group (file) + "Calculate the Gnus group name from the given file name. +Example: + + IN: /home/jao/var/mail/jao/foo/cur/1259184569.M4818P3384.localhost,W=6921:2,S + OUT: nnimap:jao/foo + + IN: /home/jao/var/mail/gmane/foo/bar/100 + OUT: nntp+localhost:gmane.foo.bar + + IN: /home/jao/var/mail/bigml/cur/1259176906.M17483P24679.localhost,W=2488:2,S + OUT:nnimap:bigml/inbox" + (let* ((g (directory-file-name (file-name-directory file))) + (g (replace-regexp-in-string (file-name-as-directory jao-maildir-home) + "" g)) + (nntp (string-match-p "^\\(gmane\\|gwene\\)/" g)) + (g (if nntp + (concat "nntp+localhost:" g) + (replace-regexp-in-string "^\\([^/]+\\)/" "nnimap:\\1/" + (file-name-directory g) t))) + (g (if nntp (replace-regexp-in-string "/" "." g) g)) + (g (replace-regexp-in-string "[/.]$" "" g))) + (cond ((string-match ":$" g) (concat g "inbox")) + (nntp g) + (t (replace-regexp-in-string ":\\." ":" g))))) + (provide 'jao-maildir) ;;; jao-maildir.el ends here |