Programming Helm: Quick File Access

Code

(setq jwow/org-dir (expand-file-name "~/org/"))
;; Named these functions for debugging.
;; Wanted to modify the lists in place by adding the display name as first element
(defun jwow/helm-action  (candidate) (find-file (cl-first candidate)))
(defun jwow/helm-transformer (candidates)
  (mapcar
   (lambda (file-with-attributes)
     (cons (file-name-nondirectory (cl-first file-with-attributes))
           file-with-attributes))
   (sort candidates (lambda (c1 c2) (time-less-p (nth 7 c2) (nth 7 c1))))))

(setq jwow/org-dir-helm-source
      (helm-build-sync-source
          "Quick Open Org File"
        :action #'jwow/helm-action
        :candidates (directory-files-and-attributes jwow/org-dir
                                                    t
                                                    ".org$\\|.org.gpg$"
                                                    t)
        ;; sorted by last modified time, descending
        :candidate-transformer #'jwow/helm-transformer
        :diacritics t))

(defun jwow/org-dir-quick-jump ()
  (interactive)
  (helm :sources '(jwow/org-dir-helm-source)))

(define-key xah-fly-command-map (kbd "C-SPC o") #'jwow/org-dir-quick-jump)