emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ebdb 1bc78ab 133/350: Add helm-ebdb file


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 1bc78ab 133/350: Add helm-ebdb file
Date: Mon, 14 Aug 2017 11:46:21 -0400 (EDT)

branch: externals/ebdb
commit 1bc78ab4df569bb504617df9868bc80fd7c0fb35
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Add helm-ebdb file
    
    This will eventually get broken off into its own package.
    
    * helm-ebdb.el: New file, containing basic helm integration for EBDB.
      Provide three actions for selected candidates: display, send mail,
      and insert name/address pair.
---
 helm-ebdb.el | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/helm-ebdb.el b/helm-ebdb.el
new file mode 100644
index 0000000..9d9acf8
--- /dev/null
+++ b/helm-ebdb.el
@@ -0,0 +1,69 @@
+;;; helm-ebdb.el --- Helm integration for EBDB       -*- lexical-binding: t; 
-*-
+
+;; Copyright (C) 2017  Free Software Foundation, Inc.
+
+;; Author: Eric Abrahamsen <address@hidden>
+;; Keywords: mail, convenience
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Helm integration for EBDB.
+
+;;; Code:
+
+(require 'ebdb)
+(require 'helm)
+
+(declare-function ebdb-display-records "ext:ebdb-com"
+                 (records &optional fmt append select pop buf))
+
+(defun helm-ebdb-candidates ()
+  "Return a list of all records in the database."
+  (mapcar (lambda (rec)
+           (cons (ebdb-string rec) rec))
+         (ebdb-records)))
+
+(defun helm-ebdb-display-records (candidate)
+  "Display CANDIDATE or marked candidates."
+  (let ((recs (or (helm-marked-candidates) (list candidate))))
+    (ebdb-display-records recs nil nil t nil
+                         (format "*%s*" ebdb-buffer-name))))
+
+(defun helm-ebdb-compose-mail (candidate)
+  "Compose mail to CANDIDATE or marked candidates."
+  (let ((recs (or (helm-marked-candidates) (list candidate))))
+    (ebdb-mail recs)))
+
+(defun helm-ebdb-cite-records (candidate)
+  "Insert Name <email> string for CANDIDATE or marked candidate."
+  (let ((recs (or (helm-marked-candidates) (list candidate))))
+    (ebdb-cite-records-mail recs)))
+
+(defvar helm-source-ebdb
+  '((name . "EBDB")
+    (candidates . helm-ebdb-candidates)
+    (action . (("Display" . helm-ebdb-display-records)
+              ("Send mail" . helm-ebdb-compose-mail)
+              ("Insert name and address" . helm-ebdb-cite-records)))))
+
+;;;###autoload
+(defun helm-ebdb ()
+  "Preconfigured `helm' for EBDB."
+  (interactive)
+  (helm-other-buffer 'helm-source-ebdb "*helm ebdb*"))
+
+(provide 'helm-ebdb)
+;;; helm-ebdb.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]