diff options
Diffstat (limited to 'lisp/documents.el')
| -rw-r--r-- | lisp/documents.el | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/lisp/documents.el b/lisp/documents.el index 88d3ba2..55ff72e 100644 --- a/lisp/documents.el +++ b/lisp/documents.el @@ -147,43 +147,41 @@ Visits LINK, or if LINK names a subdirectory of (file-directory-p (concat path "/" subcategory))) contents)) (categories (if category - (map 'list - #'(lambda (subcategory) (concat category "/" subcategory)) - categories) + (mapcar #'(lambda (subcategory) (concat category "/" subcategory)) + categories) categories))) (append (if category - (map 'list #'(lambda (page) (concat category "/" page)) pages) + (mapcar #'(lambda (page) (concat category "/" page)) pages) pages) categories - (apply #'append (map 'list #'notes-hierarchy-paths categories))))) + (apply #'append (mapcar #'notes-hierarchy-paths categories))))) (defun notes-hierarchy () "Returns every page and category in `notes-directory'. The result contains lists of the form (NAME PATH IS-PAGE-P), and does not include files that satisfy the `notes-file-should-ignore' predicate." - (map 'list - #'(lambda (path) (list - (cond ((cl-search "Index.org" path) - (let ((name (cl-subseq path 0 -9))) - (if (string= name "") - "/" - name))) - ((notes-file-is-page path) (cl-subseq path 0 -4)) - (t path)) - (concat notes-directory "/" path) - (notes-file-is-page path))) - (notes-hierarchy-paths))) + (mapcar #'(lambda (path) (list + (cond ((cl-search "Index.org" path) + (let ((name (cl-subseq path 0 -9))) + (if (string= name "") + "/" + name))) + ((notes-file-is-page path) (cl-subseq path 0 -4)) + (t path)) + (concat notes-directory "/" path) + (notes-file-is-page path))) + (notes-hierarchy-paths))) (defun notes-page-goto () "Interactively find a page in `notes-directory'." (interactive) (let* ((hierarchy (notes-hierarchy)) - (hierarchy (cl-remove-if-not #'third hierarchy)) - (name (ivy-read "Find file: " (map 'list #'first hierarchy))) - (item (cl-find-if #'(lambda (item) (string= name (first item))) hierarchy))) + (hierarchy (cl-remove-if-not #'cl-third hierarchy)) + (name (ivy-read "Find file: " (mapcar #'cl-first hierarchy))) + (item (cl-find-if #'(lambda (item) (string= name (cl-first item))) hierarchy))) (if item - (find-file (second item)) + (find-file (cl-second item)) (let ((path (concat notes-directory "/" name ".org"))) (find-file path))))) |