Open MarcRohrer opened 1 year ago
Hello @MarcRohrer,
Firstly sorry for the late reply.
After looking into this slightly, I've discovered that the issue is
that buffer local variables do not transfer when the major mode of the
buffer changes. For example, when you open, in dired, one of your
denote silos, and inspect the value of denote-directory
, you'll find
that it's value is indeed default-directory
, as per how it's set in
the .dir-local.el
file. However, when you then run list-denotes
,
the major mode of the buffer changes from dired to
denote-menu-mode
, and as a result, all the buffer local variables
get erased. Please see the stackoverflow link below for further details:
A workaround to this is to define a function that sets
denote-directory
to be your silo inside a let construct, and then
call list-denotes
. An example below:
(defun my-open-silo ()
(interactive)
(let ((denote-directory "/tmp/denote-silo"))
(list-denotes)))
You can pull the recent changes in commit dca339b and try and see if
that works. Because denote-directory
is set to the silo value inside
the let block, once you close that denote menu buffer, if you call
list-denotes
again, it should open a denote menu buffer for the global
value of denote-directory
.
Sorry there was a typo in the previous commit. Please pull ceb67d2. Thanks
Hi,
I do not quite understand. I do not switch major modes. I have a file x.org in the direcory y in which there is a .dir-locals.el, that sets denote-directory. I call consult-notes from that file. When does the major mode change?
Marc
Hi Marc,
Could you explain your workflow a little bit more? What does the function consult-notes
do?
Here's my understanding of what's happening:
denote-directory
to be the default-directory
.denote-directory
is the value you expect it to be i.e the path of the denote silo (you can check this with C-h v denote-directory
.list-denotes
inside that buffer. When you do this, the major mode of the buffer changes from org-mode
to denote-menu-mode
. With that change, all directory local variables are cleared and so the fallback value of denote-directory
is used i.e the value you gave it in your init.el file.This is what's happening as far as I am aware. The workaround I gave seems to work except for exporting to dired. I still need to figure out what's going wrong there...
Hi,
sorry, mixed things up here. I use consult-notes
https://github.com/mclear-tools/consult-notes
it provides similar functions to denote-menu. Also not perfect, but silos are used. But I tried denote-menu in exactly the same manner.
denote-directory is a variable defined in ‘denote.el’.
Its value is "h:/Buch/Trockental/material"
Original value was
"h:/src/emacs/Documents/notes/"
Local in buffer Trockental.org; global value is "~/notes"
Directory for storing personal notes.
Marc
Hi namilus,
I use the Silo feature of denote. Unfortunately denote-menu does not seem to be very interested in silos?
denote-directory is a variable defined in ‘denote.el’.
describe-variable denote-directory: Its value is "h:/src/lisp/notes" Original value was "h:/src/emacs/Documents/notes/" Local in buffer .sbcl.lisp; global value is "~/notes"
It uses the global value instead of the one set in .dir-locals.el
Marc
Machine-translated, English is not understandable, please forgive me! I'm not an IT professional, here's a basic description of the problem: With this , had the same problem?
After reading your answer, and using your latest d1d741f Putting together this workaround, a view table can appear
(defun zzf-denote-open-silo-in-job ()
(interactive)
(list-denotes)
(let ((denote-directory "~/notes/job/"))
(list-denotes)))
But cannot use denote-menu-filter-by-keyword, It will still find the denote-directory up
As I currently do not use your package, I do not really need a workaround. But thanx anyway! I just wanted to let you know, that there is a problem.
As Prot recommended your package, it might be relevant to someone else, as Silos are a standard feature of Denote.
Hi @zhuatw @MarcRohrer,
Thank you for pointing out that issue @zhuatw. This seems to be a larger issue than I had first envisioned. I'll continue to work on this and post any progress here too.
The function denote-silo-extras-select-silo-then-command
in denote-silo-extras.el helps me do this with the following snippet that calls list-denotes:
(defun james/denote-select-silo-and-list-denotes (silo)
"Select SILO and run the `list-denotes` command in it.
SILO is a file path from `denote-silo-extras-directories`."
(interactive (list (denote-silo-extras-directory-prompt)))
(denote-silo-extras-select-silo-then-command silo 'list-denotes))
I have it bound to SPC d l
for ease of use.
Hi namilus,
I use the Silo feature of denote. Unfortunately denote-menu does not seem to be very interested in silos?
denote-directory is a variable defined in ‘denote.el’.
It uses the global value instead of the one set in .dir-locals.el
Marc