summaryrefslogtreecommitdiff
path: root/jakob.org
diff options
context:
space:
mode:
authorJakob L. Kreuze2019-03-24 11:34:56 -0400
committerJakob L. Kreuze2019-03-24 11:34:56 -0400
commit103d4e49a935a1220debbe204256ec19b833d57e (patch)
treeab187b533a7e3d78bb21c425f316b8bacfb7d271 /jakob.org
parentcfc020f7199662518d16a9573ab3c837e32b2b1b (diff)
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.
Diffstat (limited to 'jakob.org')
-rw-r--r--jakob.org27
1 files changed, 17 insertions, 10 deletions
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 ()

© 2015 - 2026 Jakob L. Kreuze