org-brain icon indicating copy to clipboard operation
org-brain copied to clipboard

Add ways to add notes and todo items to the org-brain entry in visualize mode

Open vedang opened this issue 4 years ago • 6 comments

Copying my commit messages here:

Add a note to an org-brain entry

Add a key-binding to directly trigger adding notes to the current entry in org-brain. This makes it possible to capture thoughts about the current entry without leaving the org-brain-visualization window.

The commit provides two functions:

  • org-brain-visualize-add-note : This function is bound to N in org-brain-visualize-mode-map and is the expected way to use this functionality. Adds a note to the current entry.

  • org-brain-add-note: This is a generic function that can be called from within org-mode.

Add a TODO item under the current org-brain entry

Add a key-binding to directly add a TODO entry to the current entry in org-brain. This makes it possible to capture action items about the current entry without leaving the org-brain-visualization window.

I use org-capture to implement this functionality and have made changes that I don't have too much experience with. I'd love feedback / different ways to do this.

Summary of changes:

  1. Set up capture templates for brain.

I'm using "b" as a template prefix key for capture templates related to org-brain. Since people may already be using this key in their own capture templates, this functionality is turned off by default (via org-brain-visualize-use-capture-templates var) and the user can select a different prefix key (via org-brain-visualize-capture-prefix-key var)

Since I was setting up capture templates, I also moved the capture template described in the README to this code.

Finally, these templates only work in the context of org-brain-visualize, to avoid clutter in other modes.

  1. Add org-brain-visualize-add-todo and org-brain-add-todo

Once the user configures the variables above, they can use the 'y' key-binding in org-brain to create a TODO for the current brain entry.

  1. org-brain-visualize--register-capture-templates

This is a helper function to ensure that we set up the capture templates only once. I'm not sure what the idiomatic way to do this is, feedback welcome.

This is the first cut of this functionality. If you think this is okay, I'll make changes in the README file (and any other changes you require). I am also not sure if I've created the vars and functions in the correct place in the org-brain.el. I'll move them to the correct places based on your feedback.

vedang avatar Mar 29 '20 07:03 vedang

Hi! This looks like good ideas. There's some conflicts currently, which need to be resolved. I also think that the commands and the templates should be separate PRs, id that's okay.

To me it isn't necessary to have two commands for the note and todo actions. Perhaps one is okay which uses org-entry-at-pt and fallbacks to letting the user choose if there isn't one, and the universal-argument could be used if the user doesn't want the entry at point.

Kungsgeten avatar Apr 11 '20 11:04 Kungsgeten

Thanks for the feedback.

I'll make the changes to the functions and resubmit the PR

Re: the capture templates being a separate PR, the function to create a TODO item depends on the capture templates being defined. So I'm not sure how to break them into two PRs. If you want, I'll create a separate commit with just the templates first, and then will create a second commit on top where the org-brain-visualize-add-todo function is defined. Would that be okay?

vedang avatar Apr 12 '20 15:04 vedang

Sorry for putting this PR on hold for so long. I'm thinking about adding a feature which would make it easier to manipulate text directly from the visualize buffer. My guess is that it may make this PR redundant. I'm leaving it open for now though.

Kungsgeten avatar May 10 '20 13:05 Kungsgeten

Hi! I've now added support for polymode which makes it easy to edit directly from the org-brain-visualize buffer. I wouldn't say that it makes this PR redundant, but I feel that it might solve the problems this PR address?

Kungsgeten avatar Jun 03 '20 12:06 Kungsgeten

Let me try out the new features over the weekend and get back to you. Thanks!

On Wed, Jun 3, 2020, 6:22 PM Erik Sjöstrand [email protected] wrote:

Hi! I've now added support for polymode which makes it easy to edit directly from the org-brain-visualize buffer. I wouldn't say that it makes this PR redundant, but I feel that it might solve the problems this PR address?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Kungsgeten/org-brain/pull/281#issuecomment-638176641, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAUUHU27D5OQWHBPFORLW3RUZBQ3ANCNFSM4LV3ZONQ .

vedang avatar Jun 05 '20 19:06 vedang

Somehow, polymode is not working for me, and I didn't want to spend too much time debugging it.

My current setup works great for me, so I'm just updating this PR to reset the branch to master and apply my commits on top of the latest version of the code, in case someone else wants to try it out.

I've pulled the capture templates out into a separate commit as per review comments, but I have not unified the functions (have only one function that does the right thing based on whether it is in visualize mode / whether universal arg is supplied). I'll make that change to the code as and when time permits. This does the job for me right now :)

Thank you for this library @Kungsgeten , it's incredible and has completely changed the way I use org-mode.

vedang avatar Oct 14 '20 02:10 vedang