Closed emacsomancer closed 3 weeks ago
Forgot to say. Check out the setting org-node-renames-exclude
. Sorry about that.
My dailies are in a subfolder of org-roam
named daily
, but they still get renamed by the hook. I tried even providing the variable the full path, but it still renames them (wrongly, thinking that they're non-dailies).
What does this return in your daily file?
M-: (string-match-p "daily/" buffer-file-name)
35
Sorry for the delay, I waited out the GitHub outage just now.
Well, it should work, since that filter returns non-nil. I don't know what's going on. It works for me. You don't have the function defined to something else? :)
I'm guessing it's an issue with org-node-renames-allowed-dirs
.
I'm thinking that in:
(cl-loop
for dir in org-node-renames-allowed-dirs
if (or (not (string-prefix-p dir path))
(string-match-p org-node-renames-exclude path))
return nil
finally return t)
the loop returns returns true if org-node-renames-allowed-dirs
is empty.
maybe
(when (null org-node-renames-allowed-dirs)
(message "New user option `org-node-renames-allowed-dirs' should be configured"))
should be user-error
instead of message
?
the loop returns returns true if org-node-renames-allowed-dirs is empty.
Oh, well spotted. It was too confusingly written. I changed the loop so it's more readable and won't do that. Sorry for the inconvenience.
should be user-error instead of message?
Yea, if not interactive anyway. Fixed.
Ok, I think it's working for me now.
But now nothing (i.e. non-daily roam files) gets renamed if I set org-node-renames-allowed-dirs
to something like '("~/Documents/Org/org-roam/")
, but it does if I do '("/home/emacsomancer/Documents/Org/org-roam/)
. Does it make sense to use a file-truename
here?,e.g.
...
for dir in org-node-renames-allowed-dirs
if (and (string-prefix-p (file-truename dir) path)
....
Oh, yes, probably.
Heads up, just in case: just edited this command a lot, but it still works in my testing.
After the changes, the rename function tries to rename dailies.