          (helm-candidates (helm-get-org-candidates-in-file org-filepath 0 1)))
     (ar/format-helm-candidates helm-candidates)))
 
-(setq ar/helm-source-blog '((name . "Blog")
-                            (candidates . ar/get-helm-blog-candidates)
-                            (action . (lambda (candidate)
-                                        (helm-org-goto-marker candidate)
-                                        (org-show-subtree)))))
-
-(setq ar/helm-source-blog-bookmarks '((name . "Bookmarks")
-                                      (candidates . ar/get-helm-blog-bookmark-candidates)
-                                      (action . (lambda (candidate)
-                                                  (helm-org-goto-marker candidate)
-                                                  (org-show-subtree)))))
+(defvar ar/helm-source-blog '((name . "Blog")
+                              (candidates . ar/get-helm-blog-candidates)
+                              (action . (lambda (candidate)
+                                          (helm-org-goto-marker candidate)
+                                          (org-show-subtree)))))
 
 (defun ar/build-org-link ()
   "Build an org link, prompting for url and description."

         `(:heading ,todo-heading :url ,(match-string 0 todo-heading)))
        (`(:heading ,todo-heading :marker ,(copy-marker (point))))))

(defun ar/org-helm-entry-child-candidates (id)
  "Get org child headings for entry with ID."
  (save-excursion
    (org-open-link-from-string (format "[[#%s]]" id))
    (org-end-of-meta-data-and-drawers)
    (let ((child-headings '())
          (child-heading))
      (when (org-at-heading-p)
        ;; Extract first child.
        (setq child-heading (substring-no-properties (org-get-heading 'no-tags)))
        (add-to-list 'child-headings
                     (cons child-heading
                           (ar/org-todo-heading-plist child-heading)))
        (while (org-get-next-sibling)
          (setq child-heading (substring-no-properties (org-get-heading 'no-tags)))
          (add-to-list 'child-headings
                       (cons child-heading
                             (ar/org-todo-heading-plist child-heading)))))
      child-headings)))

(defun ar/todos-helm-candidates ()
  "Get this week's TODOS helm candidates."
  (with-current-buffer (find-file-noselect (expand-file-name
                                            "~/stuff/active/non-public/daily.org"))
    (ar/org-helm-entry-child-candidates "backlog")))

(defun ar/switch-to-file (file-path)
  "Switch to buffer with FILE-PATH."

  "Create an org CUSTOM_ID from a TITLE."
  (replace-regexp-in-string " " "-" (downcase title)))

(defun ar/current-buffer-match-p (re)
  "Return t if RE matches current buffer. nil otherwise."
  (re-search-forward re nil t))

(defun ar/string-match-p (regex string)
  "Return t if REGEX matches STRING. nil otherwise."
  (if (string-match regex string) t nil))
