summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Volpiatto <thierry.volpiatto@gmail.com>2016-11-30 10:47:43 +0100
committerThierry Volpiatto <thierry.volpiatto@gmail.com>2016-11-30 10:47:43 +0100
commit12b1dc59a8a1ab8379b34f36c009aa23d6b115ba (patch)
tree76c5847bbb6646450822301c9b32a3da71895f01
parente7d045dcce22d4fbda233c3b4d51ee6f486d4480 (diff)
Handle and match new "group" entry in addressbook.
* helm-bookmark.el (helm-bookmark--addressbook-search-mail): Renamed from helm-bookmark--addressbook-search-fn. (helm-bookmark--addressbook-search-group): New. (helm-bookmark-addressbook-class): Add group prop at initialization and add one more fn to search fns.
-rw-r--r--helm-bookmark.el22
1 files changed, 17 insertions, 5 deletions
diff --git a/helm-bookmark.el b/helm-bookmark.el
index b43d24e9..299d92e9 100644
--- a/helm-bookmark.el
+++ b/helm-bookmark.el
@@ -519,7 +519,7 @@ than `w3m-browse-url' use it."
;;; Addressbook.
;;
;;
-(defun helm-bookmark-addressbook-search-fn (pattern)
+(defun helm-bookmark--addressbook-search-mail (pattern)
(helm-awhile (next-single-property-change (point) 'email)
(goto-char it)
(end-of-line)
@@ -530,6 +530,17 @@ than `w3m-browse-url' use it."
(cl-return
(+ (point) (match-end 0))))))
+(defun helm-bookmark--addressbook-search-group (pattern)
+ (helm-awhile (next-single-property-change (point) 'group)
+ (goto-char it)
+ (end-of-line)
+ (when (string-match pattern
+ (get-text-property
+ 0 'group (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)
@@ -537,10 +548,11 @@ than `w3m-browse-url' use it."
(helm-init-candidates-in-buffer
'global
(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)
+ collect (propertize b
+ 'email (bookmark-prop-get b 'email)
+ 'group (bookmark-prop-get b 'group))))))
+ (search :initform '(helm-bookmark--addressbook-search-group
+ helm-bookmark--addressbook-search-mail))
(persistent-action :initform
(lambda (candidate)
(let ((bmk (helm-bookmark-get-bookmark-from-name