Skip to content

Create headline if it doesn't already exist in target #957

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

Open
zdcthomas opened this issue Apr 3, 2025 · 1 comment
Open

Create headline if it doesn't already exist in target #957

zdcthomas opened this issue Apr 3, 2025 · 1 comment
Labels
enhancement Enhancement, not necessarily available in emacs

Comments

@zdcthomas
Copy link

Does this feature exist in Emacs orgmode core?

No

Orgmode link

I'm not sure if this is the current behavior in emacs, but I think it would be pretty cool if the capture window offered to create a headline that doesn't yet exist in the target file.
An example:

						f = {
							description = "repo heading",
							template = "* %?",
							headline = vim.fn.fnamemodify(vim.fn.getcwd(), ":t"),
							target = org_agenda_path("repos.org"),
						},

on a new repo, currently won't let me confirm the capture since the repo headline doesn't exist in the file.

The relevant section in the code that I found was here.

Feature value

No response

Additional context

No response

@zdcthomas zdcthomas added the enhancement Enhancement, not necessarily available in emacs label Apr 3, 2025
@seflue
Copy link
Contributor

seflue commented Apr 11, 2025

I ran frequently into this problem and it is one of the reasons, why I don't use captions as often as I would like - because it needs a very hard-wired ecosystem of existing files and headlines. So I would appreciate, if we could implement this.

Since it doesn't exist in Emacs Orgmode, @kristijanhusak would you be open having an implementation directly in the plugin or should we extend the API to allow implementing this as an extension by the user or another plugin.

For the latter we would need to have some kind of hook for a callback, which by default does the error handling for a missing headline and then could be overridden via config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement, not necessarily available in emacs
Projects
None yet
Development

No branches or pull requests

2 participants