Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard to use it. #11

Closed
hwiorn opened this issue Apr 10, 2023 · 5 comments
Closed

Hard to use it. #11

hwiorn opened this issue Apr 10, 2023 · 5 comments

Comments

@hwiorn
Copy link

hwiorn commented Apr 10, 2023

I saw your emacs conf video and I thought this was what I've been searching for. I needed a desktop feature to writing text using my notes. So, I tried your package. I had read the wiki and followed some functions, but I found it was really difficult to use. It would've been nice your screencasts have command-log-mode window.

Is the workflow right?

  1. Add org-roam notes(nodes) into zetteldesk-deskop
  • Add node(each headings) into desktop by zetteldesk-add-node-to-desktop
  • Add buffer by zetteldesk-add-to-desktop
  1. Switch *zetteldesk-scratch* buffer. The *zetteldesk-scratch* buffer is empty at this time. Add node into *zetteldesk-scratch* buffer from zetteldesk-desktop. Then, user can write and revise some text according *zetteldesk-scratch*
  • Insert org-roam-node by zetteldesk-node-insert
  • Insert node with contents by zetteldesk-insert-node-with-contents
  1. Or open some DRAFT-ABOUT-SOMETHING-COOL.org. Insert node and contents by zetteldesk-insert-node-contents

Another questions.

  • Is zetteldesk-switch-to-buffer or zetteldesk-insert-org-file-contents is for index card?
    • I thought the BUFFER is to write *zetteldesk-scratch* as persistent file.
  • How to switch other topics or projects?
    • Does *zetteldesk-scratch* buffer means desktop? Could I switch desktop like change between multiple desks in a room? I think the BUFFER can be a seperate DESKTOP, is this right?

Some functions don't work. The list below could be a seprate issue.

  • If *zetteldesk-scratch* was closed once, new *zetteldesk-scratch* buffer will be created as fundamental-mode.
  • zetteldesk-node-insert doesn't insert node into *zetteldesk-scratch*. Whereas zetteldesk-insert-node-contents does.
  • zetteldesk-save-state doesn't save anything. It makes a directory only.
  • So zetteldesk-restore-desktop doesn't restore anything.
  • There is no zetteldesk-insert-info-contents command in hydra
    • "Wrong type argument: commandp, zetteldesk-insert-info-contents"
  • zetteldesk-insert-node-with-contents inserts two headings that has same level. one is the title and another is a top heading of original body.
@Vidianos-Giannitsis
Copy link
Owner

I hear you. There's honestly a lot of stuff it can do and it can seem intimidating. And my documentation is definitely not the greatest, although I have tried as best as I could to explain the process. I will try to answer your questions as best I can and if you need more help, I will be happy to provide it. Before that, I also want to mention that because there are a lot of functions and I understand its confusing to remember all of them, I highly recommend you also install the zetteldesk-kb package. The hydra it includes has very explanatory descriptions instead of function names which I think will help sort out the mess.

For the workflow you mention. Step 1 is correct. Steps 2 and 3 not exactly. The idea is you have the *zetteldesk-scratch* buffer, which is in the beginning empty. If you want to add the nodes you previously added to the zetteldesk-desktop to the scratch, you use the function zetteldesk-insert-node-contents (i n in the hydra) which prompts for a node in the zetteldesk-desktop and inserts its contents to the *zetteldesk-scratch* and leaves a link to that node in the current buffer. The reason it inserts a link is due to how I personally use it (check here). If you do not want the link, you should use the function zetteldesk-insert-node-contents-without-link which omits that part (i N in the hydra). zetteldesk-node-insert doesn't have any relation to this. Its confusing that it sounds very similar, but the idea of the naming scheme is that zetteldesk-node-insert is the zetteldesk equivalent of org-roam-node-insert (insert a link to a node, but filter it to view only zetteldesk nodes), while zetteldesk-insert-* functions are functions that insert things to the scratch. For your step 3 of inserting the node contents to a different file, none of the functions can do that by default, but by setting the customization variable zetteldesk-insert-scratch-or-current-buffer to nil, you can make it so all the zetteldesk-insert-* functions insert to the current buffer. Hope I explained it well, if you need more clarification tell me.

Is zetteldesk-switch-to-buffer or zetteldesk-insert-org-file-contents is for index card?
I thought the BUFFER is to write zetteldesk-scratch as persistent file.

The zetteldesk-switch-to-buffer function is a filter function following the naming scheme of zetteldesk-node-insert. It runs the generic switch-to-buffer function, but filters it to only display buffers in the zetteldesk-desktop. This does not include nodes as they are easier to view with a filter function such as zetteldesk-node-find (which is the filtered version of org-roam-node-find). Its mainly for use with other buffers you might have stored in the zetteldesk-desktop.

zetteldesk-insert-org-file-contents on the other hand, is the equivalent of zetteldesk-insert-node-contents (as can be inferred from the similarity in their naming scheme) to insert the contents of an org file in the zetteldesk-desktop (which with org file I do not mean an org-roam node, but a separate org file outside org roam). The BUFFER you see passed to many functions is any buffer stored in the zetteldesk-desktop and doesn't have any real relation with the *zetteldesk-scratch*. Except if you mean something else and I haven't fully understood what you are asking.

How to switch other topics or projects?
Does zetteldesk-scratch buffer means desktop? Could I switch desktop like change between multiple desks in a room? I think the BUFFER can be a seperate DESKTOP, is this right?

The *zetteldesk-scratch* is essentially the desktop yes. Switching between different desktops isn't something that is possible, because I personally haven't needed it. However, I can understand why someone would need it and it would make sense to develop something like that. The system recognizes the buffer named *zetteldesk-scratch* as the desktop, so making this should be easy because it basically needs a few interactive renaming functions for setting the "active" desktop and all other open ones as "inactive" but stored in memory. I could try working that out when I have time.

If zetteldesk-scratch was closed once, new zetteldesk-scratch buffer will be created as fundamental-mode

Yes, this is indeed correct. On startup, *zetteldesk-scratch* is initialized by the low level function zetteldesk--create-scratch-buffer which makes sure that the buffer will start in org-mode. If it is closed and a function tries to find the buffer (which doesn't exist) it will create it, but will not set it to org-mode. Fixing that behavior would be kinda hard. It is theoretically possible to make the function that creates the scratch buffer an interactive function (which wouldn't cause increased friction to anything), but it just didn't make much sense to me personally. Maybe if the functionality to use multiple desktops is added as mentioned above it will make more sense. For now, you can reinitialize the buffer correctly by disabling and re-enabling the zetteldesk-mode which has a hook to properly initialize the buffer, or just set it to org-mode manually.

zetteldesk-node-insert doesn't insert node into zetteldesk-scratch. Whereas zetteldesk-insert-node-contents does.

I hope to have answered your question above, while explaining the workflow. zetteldesk-node-insert runs a filtered org-roam-node-insert with everything that implies while zetteldesk-insert-node-contents is a separate function to insert the contents of a node. I am sorry if it causes confusion, but I think if you understand the naming scheme it makes sense. Open to suggestions if you think you have a more fitting name to change it to.

zetteldesk-save-state doesn't save anything. It makes a directory only.

I personally don't use this so I am not sure if there is something that's wrong with it and I haven't noticed, but when I wrote the code, I tested multiple examples and they all seemed to work and nothing has changed since then. I believe the error here is that the file it tries to find doesn't exist and it can't create it. Its location is stored in the variable zetteldesk-saved-state-file and its in the directory /libs under your emacs directory and in a file named zetteldesk-saves.el. It needs a new file, because the only way I could think of implementing a save feature is storing the list of nodes you want to save in a file and then reading from that file in a new session. You can change the location of that file by setq-ing that variable to a different location. Note that that location needs to be in your load path so that the restore function can read the code in that lisp file. But I am pretty positive that the issue is its trying to write to a file that doesn't exist. I am aware that this solution isn't very elegant, but I couldn't come up with a better one.

So zetteldesk-restore-desktop doesn't restore anything.

Naturally, if you can't save a state, you also can't restore it. If you can properly save and restoring still doesn't work, do tell me, although I doubt it as I just tested the function using some old save states I have from testing and it should 100% work should the saving part be done correctly.

There is no zetteldesk-insert-info-contents command in hydra
"Wrong type argument: commandp, zetteldesk-insert-info-contents"

You are correct, there is no such function. The function this could mean is zetteldesk-info-insert-contents. Naming it zetteldesk-insert-info-contents would make more sense (and that was indeed its name in the beginning), but after deciding to split the info stuff to a separate package, to upload it to MELPA, it must be prefixed with zetteldesk-info-* so this change was necessary. However, seeing the hydra on my local version of the repo and on the version uploaded here, the function zetteldesk-insert-info-contents is nowhere to be found. The only thing that could be causing this is you having an old version of the hydra, in which case make sure to update it and check again.

zetteldesk-insert-node-with-contents inserts two headings that has same level. one is the title and another is a top heading of original body.

Yes that is intended behavior. The typical zettelkasten structure wants nodes to be atomic, meaning that if you would split something with headings, each one should probably be a different node. For this reason, I did not find it intuitive for zetteldesk-insert-node-contents to handle headings as it expects a node to have a title (which will become a top level heading) and no other headings. However, because I heavily expect a general org file (or a literature node, which in my case is made with org-noter) to have many headings, this behavior has been implemented for those, so I can easily solve your issue. If you consider this behavior necessary, load this function to your config and use it instead of zetteldesk-insert-node-contents.

(defun zetteldesk-insert-node-contents-with-headings (&optional arg)
  "Select a node that is part of the current `zetteldesk-desktop'.

Add a link to it at point and then insert its contents to the
bottom of the *zetteldesk-scratch* buffer after inserting a
newline there.  Remove the first 67 characters which is the
properties section if it only contains the ID of the node as its
unneeded and change the string #+title to a top level heading as
its more practical when inserting the contents of multiple
files. Then, demote all of its headings by one level (since the
title now acts as a top level heading).

If given the optional argument ARG, which needs to be the
`\\[universal-argument]' also switch to the *zetteldesk-scratch*
buffer in a split."
  (interactive "P")
  (let* ((node (org-roam-node-read nil #'zetteldesk-node-p))
	 (file (org-roam-node-file node))
	 (description (org-roam-node-formatted node))
	 (location (zetteldesk-insert-location)))
    (insert (org-link-make-string
	     (concat "id:" (org-roam-node-id node))
	     description))
    (with-current-buffer location
      (goto-char (point-max))
      (newline)
      (insert-file-contents file nil 67)
      (save-excursion
	(while (not (org-next-visible-heading 1))
	  (org-metaright)))
      (zetteldesk--replace-title)))
  (zetteldesk-insert-switch-to-scratch arg))

I hope I explained all your issues enough, but if you need a better explanation, do mention it and I will try to explain it further. And if you have any other issue, do mention that as well so I can try and help you fix it.

@hwiorn
Copy link
Author

hwiorn commented Apr 17, 2023

Thank you for kind reply.

I will try to answer your questions as best I can and if you need more help, I will be happy to provide it. Before that, I also want to mention that because there are a lot of functions and I understand its confusing to remember all of them, I highly recommend you also install the zetteldesk-kb package. The hydra it includes has very explanatory descriptions instead of function names which I think will help sort out the mess.

I use zetteldesk-kb-complete already. But I used hydra setting accroding to Doom configuration. So the wiki needs to be updated.

;; Doom-emacs setting
(use-package! zetteldesk
  :after org-roam
  :config
  (setq zetteldesk-kb-hydra-prefix (kbd "C-c z"))
  (zetteldesk-mode 1)
  ;; (require 'zetteldesk-kb)
  (require 'zetteldesk-kb-complete)
  (require 'zetteldesk-ref)
  (require 'zetteldesk-info)
  (require 'zetteldesk-remark)
 ...

I personally don't use this so I am not sure if there is something that's wrong with it and I haven't noticed, but when I wrote the code, I tested multiple examples and they all seemed to work and nothing has changed since then. I believe the error here is that the file it tries to find doesn't exist and it can't create it. Its location is stored in the variable zetteldesk-saved-state-file and its in the directory /libs under your emacs directory and in a file named zetteldesk-saves.el. It needs a new file, because the only way I could think of implementing a save feature is storing the list of nodes you want to save in a file and then reading from that file in a new session. You can change the location of that file by setq-ing that variable to a different location. Note that that location needs to be in your load path so that the restore function can read the code in that lisp file. But I am pretty positive that the issue is its trying to write to a file that doesn't exist. I am aware that this solution isn't very elegant, but I couldn't come up with a better one.

Okay, I'll check this out again. :)

You are correct, there is no such function. The function this could mean is zetteldesk-info-insert-contents. Naming it zetteldesk-insert-info-contents would make more sense (and that was indeed its name in the beginning), but after deciding to split the info stuff to a separate package, to upload it to MELPA, it must be prefixed with zetteldesk-info-* so this change was necessary. However, seeing the hydra on my local version of the repo and on the version uploaded here, the function zetteldesk-insert-info-contents is nowhere to be found. The only thing that could be causing this is you having an old version of the hydra, in which case make sure to update it and check again.

Yes, the wiki needs to be udpated.

Yes that is intended behavior. The typical zettelkasten structure wants nodes to be atomic, meaning that if you would split something with headings, each one should probably be a different node. For this reason, I did not find it intuitive for zetteldesk-insert-node-contents to handle headings as it expects a node to have a title (which will become a top level heading) and no other headings. However, because I heavily expect a general org file (or a literature node, which in my case is made with org-noter) to have many headings, this behavior has been implemented for those, so I can easily solve your issue. If you consider this behavior necessary, load this function to your config and use it instead of zetteldesk-insert-node-contents.

I see. My most of permernant notes doesn't have headlines. However my early (permernent) notes have one headline to represent as the atomic note. And I had added the literature notes for test. So the zetteldesk showed duplicated headlines at that time.

@Vidianos-Giannitsis
Copy link
Owner

Vidianos-Giannitsis commented Apr 17, 2023 via email

@Vidianos-Giannitsis
Copy link
Owner

I'm closing the issue now, but if you have any other problems, feel free to re-open it for discussion, or start a new one

@Vidianos-Giannitsis
Copy link
Owner

Hello, I would like to inform you that the feature you asked for

How to switch other topics or projects?
Does zetteldesk-scratch buffer means desktop? Could I switch desktop like change between multiple desks in a room? I think the BUFFER can be a seperate DESKTOP, is this right?

The latest update of the package now has this feature built in and you can check the documentation for it in the README and its wiki section. Thanks for the idea, I believe it was a useful one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants