Open anthrolisp opened 5 years ago
Currently, no, I don't know of an easy way to do that, but I admit that it might be useful to be able to quickly present the user with a choice list of existing keywords.
For now, if you have the xapian-delve
command, you should be able to
extract a list of keywords from one or more NotDeft search indexes with
a command such as
xapian-delve -a1 ~/.deft/.notdeft-db/ | grep ^K | cut -b2-
I got the idea from ZettelDeft, which are some functions on top of the deft package. There are others that would be cool to implement, such as listing links to all docs with a certain tag, etc. You can find it here:
+1 for this feature, it would make using keywords much more useful. Is there a way to implement it without adding xapian-delve
as a further requirement?
Yes, surely the Xapian API offers something that can be used to do that.
After all, xapian-delve
is able to do it, and is based on the API.
It would not be very nice to require xapian-delve
. I'd imagine it
would be done by adding a new command to notdeft-xapian
, and a
corresponding function to the `notdeft-xapian' Emacs Lisp API.
I would welcome that feature.
I could imagine adding something. Yet I am not sure I understand your answer correctly. Are you saying we could implement a function to return all keywords simply by calling xapian appropriately? My problem is: I know elisp, and I can type in a command in the shell, but I do not know anything at all about xapian. So could you be a bit more precise as what to do? I.e., how I can list all the keywords by calling xapian on the command line (which then could be transferred to elisp)?
I don't know that you can call Xapian directly from the command line,
but you can call the notdeft-xapian
program.
The first order of affairs would be to add a new command to that program, one whose implementation would be quite similar to the existing "search" command, I'd imagine. The new command would call the Xapian C++ API appropriately, and print out all the keywords.
https://xapian.org/docs/apidoc/html/namespaceXapian.html
I don't know the API that well myself, I just look for something that
could be suitable. In this case Xapian::Database::allterms_begin
sounds promising.
Is there a simple way to get a list of existing #+keywords used? Thanks again!