Created
May 27, 2018 08:32
-
-
Save unhammer/5d73bc42bbeaf78455affe80c26fec8d to your computer and use it in GitHub Desktop.
search notmuch mail from bbdb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'bbdb) | |
(defun my-bbdb-notmuch-search (&optional record) | |
"Search for emails to/from RECORD (or current record if interactive)." | |
(interactive) | |
(let* ((record (or record (bbdb-current-record))) | |
(mails (bbdb-record-field record 'mail)) | |
(query (combine-and-quote-strings mails " OR "))) | |
(notmuch-search query))) | |
(define-key bbdb-mode-map (kbd "F") 'my-bbdb-notmuch-search) | |
(defun my-bbdb-notmuch-search-from (&optional record) | |
"Search for emails from RECORD (or current record if interactive)." | |
(interactive) | |
(let* ((record (or record (bbdb-current-record))) | |
(mails (bbdb-record-field record 'mail)) | |
(from:mails (mapcar (lambda (m) (concat "from:" m)) mails)) | |
(query (combine-and-quote-strings from:mails " OR "))) | |
(notmuch-search query))) | |
(define-key bbdb-mode-map (kbd "f") 'my-bbdb-notmuch-search-from) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment