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

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

vedang
Copy link

@vedang vedang commented Mar 29, 2020

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 vedang force-pushed the feature/org-brain-vis-notes-and-todos branch from de15d17 to a67b523 Compare April 2, 2020 16:14
@Kungsgeten
Copy link
Owner

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.

@vedang
Copy link
Author

vedang commented Apr 12, 2020

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?

@Kungsgeten
Copy link
Owner

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
Copy link
Owner

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?

@vedang
Copy link
Author

vedang commented Jun 5, 2020 via email

@vedang vedang force-pushed the feature/org-brain-vis-notes-and-todos branch from a67b523 to c53b421 Compare October 14, 2020 02:51
@vedang
Copy link
Author

vedang commented Oct 14, 2020

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 vedang force-pushed the feature/org-brain-vis-notes-and-todos branch from c53b421 to bad2534 Compare January 9, 2021 08:48
@vedang vedang force-pushed the feature/org-brain-vis-notes-and-todos branch from bad2534 to 7f4fe89 Compare January 27, 2021 03:43
I plan to use these templates to implement functionality
`org-brain-add-todo` in a future commit. The summary of changes in
this commit are as follows:

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.

2. `org-brain-visualize--register-capture-templates`

This is a helper function to ensure that we set up the capture
templates only once. It's internal and invisible to the user.
Add a key-binding (`C-c t`) 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.

This change depends on the capture templates introduced in the commit
before it and adds `org-brain-visualize-add-todo` and
`org-brain-add-todo` functions to enable adding tasks under a brain
entry.
Add a key-binding (`C-c z`) 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 `C-c z`
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.
@vedang vedang force-pushed the feature/org-brain-vis-notes-and-todos branch from 7f4fe89 to c8d5a71 Compare May 28, 2021 15:09
The * causes a new heading to be created, under the heading that we
are already creating / accessing. The intention of the capture
template is to add content to an existing entry, or create a new entry
and add content to it. Both of these are done by the fixed template
now.
Earlier, these were only enabled in the `org-brain-visualize-mode`,
but it makes sense to add these everywhere, since we mostly work
ourside the *org-brain* view.

Add capture template related information to the README file as well.
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

Successfully merging this pull request may close these issues.

None yet

2 participants