emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Philip Hudson <phil.hudson@iname.com>
To: emacs orgmode-mailinglist <emacs-orgmode@gnu.org>
Subject: Re: Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)]
Date: Thu, 1 Nov 2018 10:04:53 +0000	[thread overview]
Message-ID: <CAJ1MqVGtn4TYKbHKYrk7X3c8iHoeEeV7Tmfe03hCp6S5BwE6Hg@mail.gmail.com> (raw)
In-Reply-To: <CAJ1MqVFQhSTMTVJDuvQBgMBdxDX2_Lypbv19Y4LwqWO6GO1NFw@mail.gmail.com>

Two further thoughts:

1. That regexp works but it should really start with "^":

  (org-capture-verify-tree (replace-regexp-in-string "^#\+[^\n]*\n" ""
template))

2. The fix I propose is a kludge. The real problem is the semantics of
function `org-capture-insert-template-here'. My assertion: there is no
reason to believe that a completed template of type 'entry must be a
subtree in the sense of the contract of function
`org-kill-is-subtree-p'. In other words, function
`org-kill-is-subtree-p' is meant for something else. We either need a
similar-but-different special-purpose entry-template verification
function, defined in 'org-capture.el' itself, or, if we can do so
without introducing other regressions, we need to modify function
`org-kill-is-subtree-p' to accept "#+KEYWORD" in-buffer settings.
On Mon, 29 Oct 2018 at 22:47, Philip Hudson <phil.hudson@iname.com> wrote:
>
> Remember to cover the basics, that is, what you expected to happen and
> what in fact did happen.  You don't know how to make a good report?  See
>
>     https://orgmode.org/manual/Feedback.html#Feedback
>
> Your bug report will be posted to the Org mailing list.
> ------------------------------------------------------------------------
>
> Regression in org-capture template handling.
>
> I expected my (previously working) org-capture template to be
> inserted into a newly-created empty Org file. The file name and
> location are the output of a function specified in the template
> (sequentially numbered filename).
>
> Function `org-capture-insert-template-here' in file org-capture.el
> now errors if the template specifies that its type is 'entry and it
> begins with one or more lines of the general form "#+KEY value".
> The error traces to a call to `org-kill-is-subtree-p', defined in file
> org.el.
>
> Fix (sorry it's not a proper patch):
>
> Change line 1399 of org-capture.el from:
>
>    (org-capture-verify-tree (org-capture-get :template))
>
> to:
>
>    (org-capture-verify-tree (replace-regexp-in-string "#\+[^\n]*\n" ""
> template))
>
> (This includes a refactoring-out of that redundant call to `org-capture-get').
>
> NOTE: I have signed the FSF papers. In fact I've made small
> contributions to Org-mode previously.
>
> Emacs  : GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
> of 2017-09-12 on hullmann, modified by Debian
> Package: Org mode version 9.1.14 (9.1.14-1-g4931fc-elpa @
> /home/phil/.emacs.d/elpa/org-9.1.14/)
>
> --
> Phil Hudson                  http://hudson-it.ddns.net
> Pretty Good Privacy (PGP) ID: 0x4E482F85



-- 
Phil Hudson                  http://hudson-it.ddns.net
Pretty Good Privacy (PGP) ID: 0x4E482F85

  reply	other threads:[~2018-11-01 10:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-29 22:47 Bug: Capture template insertion fails with #+FOO [9.1.14 (9.1.14-1-g4931fc-elpa @ /home/phil/.emacs.d/elpa/org-9.1.14/)] Philip Hudson
2018-11-01 10:04 ` Philip Hudson [this message]
2018-11-01 21:34 ` Nicolas Goaziou
2018-11-02  0:24   ` Philip Hudson
2018-11-02  1:35     ` Nicolas Goaziou
2018-11-02  9:22       ` Philip Hudson
2018-11-03  8:34         ` Nicolas Goaziou
2018-11-03  9:09           ` Philip Hudson
2018-11-04 14:03             ` Nicolas Goaziou
2018-11-04 16:31               ` Philip Hudson
2018-11-05 21:46                 ` Nicolas Goaziou
2018-11-06 19:24                   ` Philip Hudson
2018-11-10 10:39                     ` Nicolas Goaziou
2018-11-10 15:06                       ` Philip Hudson

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=CAJ1MqVGtn4TYKbHKYrk7X3c8iHoeEeV7Tmfe03hCp6S5BwE6Hg@mail.gmail.com \
    --to=phil.hudson@iname.com \
    --cc=emacs-orgmode@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).