[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb d090df9 007/449: gnorb-bbdb.el: New function gnor
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb d090df9 007/449: gnorb-bbdb.el: New function gnorb-bbdb-mail-search |
Date: |
Fri, 27 Nov 2020 23:14:57 -0500 (EST) |
branch: externals/gnorb
commit d090df9c951d56590702b6782a73e64a59404f10
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
gnorb-bbdb.el: New function gnorb-bbdb-mail-search
Search for mails from the visible record(s). Currently only works for
the notmuch search backend.
---
README.md | 3 +++
lisp/gnorb-bbdb.el | 27 ++++++++++++++++++++++++++-
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index f785acc..ab7d1ed 100644
--- a/README.md
+++ b/README.md
@@ -24,3 +24,6 @@ Current functions include:
* gnorb-bbdb-tag-agenda: Give BBDB records an org-tag field
(customizable), then call this function on the current records(s) to
open an Org agenda tags search using those tags.
+* gnorb-bbdb-mail-search: Call with current records(s) to search for
+ all mail messages from those records. Currently only implemented for
+ the notmuch search backend.
diff --git a/lisp/gnorb-bbdb.el b/lisp/gnorb-bbdb.el
index 7b88ee9..25d9109 100644
--- a/lisp/gnorb-bbdb.el
+++ b/lisp/gnorb-bbdb.el
@@ -66,9 +66,34 @@ records. If you want both, use \"C-u\" before the \"*\"."
(org-tags-view nil tag-string))
(error "No org-tags field present"))))
+
+(defun gnorb-bbdb-mail-search (records)
+ "Initiate a mail search from the BBDB buffer. Use the prefix
+arg to edit the search string first."
+ ;; Currently only notmuch implemented, do the same for mairix,
+ ;; namazu, etc.
+ (interactive (list (bbdb-do-records)))
+ (unless (and (eq major-mode 'bbdb-mode)
+ (equal (buffer-name) bbdb-buffer-name))
+ (error "Only works in the BBDB buffer"))
+ (setq records (bbdb-record-list records))
+ (let* ((mails (cl-mapcan 'bbdb-record-mail records))
+ (search-string
+ (mapconcat
+ (lambda (m)
+ (replace-regexp-in-string "\\." "\\\\." m))
+ mails " OR ")))
+ (require 'notmuch)
+ (when (equal current-prefix-arg '(4))
+ (setq search-string
+ (read-from-minibuffer "Search string: " search-string)))
+ (notmuch-search search-string)
+ (delete-other-windows)))
+
;; (eval-after-load "gnorb-bbdb"
;; '(progn
-;; (define-key bbdb-mode-map (kbd "O") 'gnorb-bbdb-tag-agenda)))
+;; (define-key bbdb-mode-map (kbd "O") 'gnorb-bbdb-tag-agenda)
+;; (define-key bbdb-mode-map (kbd "S") 'gnorb-bbdb-mail-search)))
- [elpa] branch externals/gnorb created (now 5f9611b), Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 88f6bda 002/449: README.md: Basic project description, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb afd587b 003/449: Basic project structure., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 82c06bc 001/449: Initial commit, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb ba4ec1b 004/449: Add customization skeleton., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 1b037b7 006/449: gnorb-utils.el: Common utility file., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb d090df9 007/449: gnorb-bbdb.el: New function gnorb-bbdb-mail-search,
Stefan Monnier <=
- [elpa] externals/gnorb cc208a0 010/449: gnorb-bbdb.el: (gnorb-bbdb-mail-search), Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 869940a 015/449: README.org: Change file format to Org mode, expand docs, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 3429f3b 009/449: gnorb-org.el: (gnorb-org-contact-link), Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb b7dce0b 016/449: gnorb-utils.el: Require the cl library., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb d79617f 019/449: gnorb-org.el: Email current subtree as exported text or file, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 27d08ef 022/449: README.org: Reorganize README, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 3edf1c9 025/449: gnorb-utils.el: gnorb-prompt-for-bbdb-record, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 32ecc09 026/449: gnorb-org.el: gnorb-org-handle-mail, gnorb-org-email-subtree, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 123b521 031/449: gnorb-org.el: bugfix gnorb-org-restore-after-send, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb a9c7410 032/449: gnorb-gnus.el: bugfix gnorb-gnus-attach-part, Stefan Monnier, 2020/11/27