From 103d4e49a935a1220debbe204256ec19b833d57e Mon Sep 17 00:00:00 2001 From: Jakob L. Kreuze Date: Sun, 24 Mar 2019 11:34:56 -0400 Subject: Fix issues with 'notes-page-goto This commit implements handling for Index.org in 'notes-page-goto, and resolves the issue of 'notes-page-goto treating non-Org files as directories. --- jakob.org | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'jakob.org') diff --git a/jakob.org b/jakob.org index a8eaa06..ebd7117 100644 --- a/jakob.org +++ b/jakob.org @@ -1205,9 +1205,11 @@ Code for interactively navigating the personal wiki. (concat notes-directory "/" category) notes-directory)) (contents (cl-remove-if #'notes-file-should-ignore - (directory-files path))) + (directory-files path))) (pages (cl-remove-if-not #'notes-file-is-page contents)) - (categories (cl-remove-if #'notes-file-is-page contents)) + (categories (cl-remove-if-not #'(lambda (subcategory) + (file-directory-p (concat path "/" subcategory))) + contents)) (categories (if category (map 'list #'(lambda (subcategory) (concat category "/" subcategory)) @@ -1221,15 +1223,20 @@ Code for interactively navigating the personal wiki. (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." + 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 (if (notes-file-is-page path) - (cl-subseq path 0 -4) - path) - (concat notes-directory "/" path) - (notes-file-is-page path))) + #'(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 () -- cgit v1.3