Closed anthrolisp closed 5 years ago
That code should work with the latest NotDeft.
You can try something simpler. Evaluate the following code (e.g., with C-x C-e)
(setq notdeft-file-display-function (lambda (file w) " TEST"))
and the next time a NotDeft mode buffer is re-rendered, you should see "TEST" as "file path information."
My apologies, it was working! For some reason, I was expecting to see directory info at the beginning of the line. I was used to seeing it that way with deft (with modified code); and was confusing "org" shown as the kind of file rather than the "org" directory that the file was in.
Is there anyway to have it show the name of the sub directory rather than the root, so that for the example, the directory for the "README" file below would show "website" instead or "org"?
org/ --/projects/ -- -- /website/ -- -- -- README.org
Thanks again for all of your help!
It's possible, of course, to have any logic you want, since it's just a function that determines the text to display. Try using
(directory-file-name (file-name-directory X))
to get the directory name for X, and
(file-name-nondirectory X)
to get just the last path component.
Awesome! Unfortunately, I don't know elisp enough to figure out how to put this together. I've tried various combinations following your previous examples but keep getting errors. Sorry to ask you to spell it out. Thank you once more for your patience!
I think I did it! :-)
(setq notdeft-file-display-function (lambda (file w) (when (> w 30) (let* ((s (file-name-nondirectory (directory-file-name (file-name-directory file)))) (s (pcase s ("bibliography-notes" "bib") ("homepage-notes" "hp") (_ s))) (s (if (> (string-width s) 12) (truncate-string-to-width s 12) s))) (concat " " s)))))
Thank you!
File path information not showing in buffer (no change at all) with the following elisp from documentation:
(setq notdeft-file-display-function (lambda (file w) (when (> w 30) (let* ((s (file-name-nondirectory (directory-file-name (notdeft-dir-of-file file)))) (s (pcase s ("bibliography-notes" "bib") ("homepage-notes" "hp") (_ s))) (s (if (> (string-width s) 12) (truncate-string-to-width s 12) s))) (concat " " s)))))