all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Rens Oliemans <hallo@rensoliemans.nl>
Cc: emacs-orgmode@gnu.org
Subject: Re: "Bad template" when creating org-capture for table-line without '|'
Date: Wed, 27 Mar 2024 12:37:04 +0000	[thread overview]
Message-ID: <877chnc0lr.fsf@localhost> (raw)
In-Reply-To: <87cyrg3qaa.fsf@rensoliemans.nl>

Rens Oliemans <hallo@rensoliemans.nl> writes:

> ...
> However, I did not know that the _template_ also has to start with '|', and org-capture
> still inserts the string "| Bad template |", which does not suggest in any way that the
> lacking '|' would be the problem (after all, it is smart enough to prepend a '|').
> ...
> however, is this also what's ideal? I would suggest one of the following alternatives:
>
> - An error is signalled to the user with the root cause of the error: no '|' at start of
>   template. In addition, the org-capture-templates variable documentation string and the
>   manual would be updated. I am happy to create a patch for this.
>
> - org-capture could pre- and suffix a '|' if the user did not supply it in their template.
>
> What are your thoughts on this?

Org mode is inconsistent here.

`org-capture-place-entry' uses `org-capture-verify-tree' and throws an
error when the template does not start from a headline or contains
headings with lower level after higher level.

Yet, `org-capture-place-item' prepends "-" when the template does not
start from a list item.

And, as you noticed, `org-capture-place-table-line' replaces the
template with "Bad template".

I think that the best course of action would be automatically fixing the
templates, as you propose in option (2), changing
`org-capture-place-entry' to automatically prepend "* " if necessary
(still leaving the subtree check though).

>   I am also happy to create a patch for this, however that would be my first so such a
>   patch would perhaps have a few iterations ;)

That would be welcome. We can take as many iterations as necessary.
You may refer to
https://orgmode.org/worg/org-contribute.html#first-patch for instructions.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


  reply	other threads:[~2024-03-27 12:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 10:47 "Bad template" when creating org-capture for table-line without '|' Rens Oliemans
2024-03-27 12:37 ` Ihor Radchenko [this message]
2024-04-14 11:24   ` [PATCH 1/2] org-capture: Allow entry template to start without heading Rens Oliemans
2024-04-14 13:41     ` Ihor Radchenko
2024-04-14 18:39       ` Rens Oliemans
2024-05-14  8:48         ` Ihor Radchenko
2024-05-14  9:49           ` Rens Oliemans
2024-05-27  7:54           ` Rens Oliemans
2024-05-27  8:29             ` Ihor Radchenko
2024-05-27  8:50               ` Bastien Guerry
2024-06-04 13:21       ` Ihor Radchenko
2024-06-05 10:25         ` Rens Oliemans
2024-04-14 11:24   ` [PATCH 2/2] org-capture: Allow table-line entry to start without | Rens Oliemans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877chnc0lr.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=hallo@rensoliemans.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.