[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnorb d28a099 005/449: gnorb-bbdb.el: New function gnor
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnorb d28a099 005/449: gnorb-bbdb.el: New function gnorb-bbdb-tag-agenda |
Date: |
Fri, 27 Nov 2020 23:14:57 -0500 (EST) |
branch: externals/gnorb
commit d28a099ad04edd56a00746018171cd6b3b9b1611
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
gnorb-bbdb.el: New function gnorb-bbdb-tag-agenda
Open Org tag search agendas using tags attached to BBDB records.
---
README.md | 9 +++++++++
lisp/gnorb-bbdb.el | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/README.md b/README.md
index b72cdc9..f785acc 100644
--- a/README.md
+++ b/README.md
@@ -15,3 +15,12 @@ stable releases of those packages, but I'm not promising
anything.
Put "gnorb/lisp" in your load path, then either require "gnorb" to
load everything, or pick bits and pieces: "gnorb-gnus", "gnorb-org",
or "gnorb-bbdb".
+
+gnorb-bbdb
+----------
+
+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.
diff --git a/lisp/gnorb-bbdb.el b/lisp/gnorb-bbdb.el
index ff84370..2db8db3 100644
--- a/lisp/gnorb-bbdb.el
+++ b/lisp/gnorb-bbdb.el
@@ -32,5 +32,45 @@
:group 'gnorb)
+(defcustom gnorb-bbdb-org-tag-field 'org-tags
+ "The name (as a symbol) of the field to use for org tags."
+ :group 'gnorb-bbdb
+ :type 'symbol)
+
+(unless (assoc gnorb-bbdb-org-tag-field bbdb-separator-alist)
+ (push `(,gnorb-bbdb-org-tag-field ":" ":") bbdb-separator-alist))
+
+(defun gnorb-bbdb-tag-agenda (records)
+ "Open an Org agenda tags view from the BBDB buffer, using the
+value of the record's org-tags field. A prefix argument limits to
+TODOs only; a \"*\" prefix operates on all currently visible
+records. If you want both, use \"C-u\" before the \"*\"."
+ (interactive (list (bbdb-do-records)))
+ (require 'org-agenda)
+ (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 ((tag-string
+ (mapconcat
+ 'identity
+ (delete-dups
+ (mapcan (lambda (r)
+ (bbdb-record-xfield-split r gnorb-bbdb-org-tag-field))
+ records))
+ "|")))
+ (if tag-string
+ ;; C-u = todos only
+ (if (equal current-prefix-arg '(4))
+ (org-tags-view t tag-string)
+ (org-tags-view nil tag-string))
+ (error "No org-tags field present"))))
+
+;; (eval-after-load "gnorb-bbdb"
+;; '(progn
+;; (define-key bbdb-mode-map (kbd "O") 'gnorb-bbdb-tag-agenda)))
+
+
+
(provide 'gnorb-bbdb)
;;; gnorb-bbdb.el ends here
- [elpa] externals/gnorb 3429f3b 009/449: gnorb-org.el: (gnorb-org-contact-link), (continued)
- [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
- [elpa] externals/gnorb 5adcc84 008/449: gnorb-utils: (gnorb-prompt-for-bbdb-record), Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb bedce9d 012/449: gnorb-gnus.el: (gnorb-gnus(article|mime)-org-attach), Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb d28a099 005/449: gnorb-bbdb.el: New function gnorb-bbdb-tag-agenda,
Stefan Monnier <=
- [elpa] externals/gnorb 63ac8f6 011/449: gnorb-org.el: (gnorb-org-handle-mail, gnorb-org-handle-mail-agenda), Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb c2b1a3a 013/449: Docstring for gnorb-org-contact-link, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb d4987a7 014/449: gnorb-utils.el: More likely requires for Org libraries, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 62368b7 017/449: gnorb-gnus.el: Make attachment fiddling work in org capture, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb da7cf10 018/449: gnorb-utils.el: Require mailcap, and parse, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 5264b3c 021/449: README.org: Document gnorb-org-email-subtree, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 82bb9db 023/449: README.org: Add keybindings to gnus mime commands., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 534b2bf 024/449: gnorb-org.el: new option gnorb-org-mail-todos, Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb 9c5d04a 027/449: README.org: More explanation about the mail stuff., Stefan Monnier, 2020/11/27
- [elpa] externals/gnorb e53d908 028/449: gnorb-gnus.el: bugfix in gnorb-gnus-collect-all-attachments, Stefan Monnier, 2020/11/27