diff options
author | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2016-09-24 10:51:51 +0200 |
---|---|---|
committer | Thierry Volpiatto <thierry.volpiatto@gmail.com> | 2016-09-24 10:51:51 +0200 |
commit | ae993cf463acf05b929b6e554596692d4cb87e27 (patch) | |
tree | 513567eafffcdc407c8e7f4b86f3cc12fbd8a5d9 /helm-bookmark.el | |
parent | fd597d8295b2d515e992a9c27bb36b03da1b38d2 (diff) |
Allow searching in addressbook emails.
* helm-bookmark.el (helm-bookmark-addressbook-search-fn):
New search fn.
(helm-bookmark-addressbook-class): Use it.
Diffstat (limited to 'helm-bookmark.el')
-rw-r--r-- | helm-bookmark.el | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/helm-bookmark.el b/helm-bookmark.el index d513fad1..b433ffc3 100644 --- a/helm-bookmark.el +++ b/helm-bookmark.el @@ -519,13 +519,28 @@ than `w3m-browse-url' use it." ;;; Addressbook. ;; ;; +(defun helm-bookmark-addressbook-search-fn (pattern) + (helm-awhile (next-single-property-change (point) 'email) + (goto-char it) + (end-of-line) + (when (string-match pattern + (get-text-property + 0 'email (buffer-substring + (point-at-bol) (point-at-eol)))) + (cl-return + (+ (point) (match-end 0)))))) + (defclass helm-bookmark-addressbook-class (helm-source-in-buffer) ((init :initform (lambda () (require 'addressbook-bookmark nil t) (bookmark-maybe-load-default-file) (helm-init-candidates-in-buffer 'global - (helm-bookmark-addressbook-setup-alist)))) + (cl-loop for b in (helm-bookmark-addressbook-setup-alist) + collect (propertize + b 'email (bookmark-prop-get + b 'email)))))) + (search :initform 'helm-bookmark-addressbook-search-fn) (persistent-action :initform (lambda (candidate) (let ((bmk (helm-bookmark-get-bookmark-from-name |