summaryrefslogtreecommitdiff
path: root/helm-bookmark.el
diff options
context:
space:
mode:
authorAdam Porter <adam@alphapapa.net>2017-04-13 01:02:23 -0500
committerAdam Porter <adam@alphapapa.net>2017-04-13 10:45:13 -0500
commit15625ffb83f12bd8dee61466d80d7a3e0abe2887 (patch)
treeab3537b81899df4efad56c671b21efa9e725716d /helm-bookmark.el
parentc442e39115a069b13f1cc950c9ab458338f55f4b (diff)
Add Org file bookmarks to helm-bookmarks
* helm-bookmark.el: Do it. - helm-bookmark-default-filtered-sources - (helm-bookmark-uncategorized-bookmark-p) - (helm-bookmark-org-file-p) - (helm-bookmark-org-setup-alist) - helm-source-bookmark-org
Diffstat (limited to 'helm-bookmark.el')
-rw-r--r--helm-bookmark.el24
1 files changed, 22 insertions, 2 deletions
diff --git a/helm-bookmark.el b/helm-bookmark.el
index 62e02f60..eb5e25a5 100644
--- a/helm-bookmark.el
+++ b/helm-bookmark.el
@@ -45,7 +45,8 @@
:type 'boolean)
(defcustom helm-bookmark-default-filtered-sources
- (append '(helm-source-bookmark-files&dirs
+ (append '(helm-source-bookmark-org
+ helm-source-bookmark-files&dirs
helm-source-bookmark-helm-find-files
helm-source-bookmark-info
helm-source-bookmark-gnus
@@ -296,6 +297,11 @@ This excludes bookmarks of a more specific kind (Info, Gnus, and W3m)."
(isnonfile (equal filename helm-bookmark--non-file-filename)))
(and filename (not isnonfile) (not (bookmark-get-handler bookmark)))))
+(defun helm-bookmark-org-file-p (bookmark)
+ (let* ((filename (bookmark-get-filename bookmark)))
+ (or (string-suffix-p ".org" filename t)
+ (string-suffix-p ".org_archive" filename t))))
+
(defun helm-bookmark-helm-find-files-p (bookmark)
"Return non-nil if BOOKMARK bookmarks a `helm-find-files' session.
BOOKMARK is a bookmark name or a bookmark record."
@@ -311,7 +317,8 @@ BOOKMARK is a bookmark name or a bookmark record."
(defun helm-bookmark-uncategorized-bookmark-p (bookmark)
"Return non--nil if BOOKMARK match no known category."
- (cl-loop for pred in '(helm-bookmark-addressbook-p
+ (cl-loop for pred in '(helm-bookmark-org-file-p
+ helm-bookmark-addressbook-p
helm-bookmark-gnus-bookmark-p
helm-bookmark-w3m-bookmark-p
helm-bookmark-woman-man-bookmark-p
@@ -412,6 +419,19 @@ than `w3m-browse-url' use it."
(helm-init-candidates-in-buffer
'global (helm-bookmark-man-setup-alist)))))
+;;; Org files
+;;
+(defun helm-bookmark-org-setup-alist ()
+ "Specialized filter function for Org file bookmarks."
+ (helm-bookmark-filter-setup-alist 'helm-bookmark-org-file-p))
+
+(defvar helm-source-bookmark-org
+ (helm-make-source " Bookmarked Org files" 'helm-source-filtered-bookmarks
+ :init (lambda ()
+ (bookmark-maybe-load-default-file)
+ (helm-init-candidates-in-buffer
+ 'global (helm-bookmark-org-setup-alist)))))
+
;;; Gnus
;;
(defun helm-bookmark-gnus-setup-alist ()