From mboxrd@z Thu Jan 1 00:00:00 1970 From: Philip Hudson 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 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gI9r8-0008KM-QB for emacs-orgmode@gnu.org; Thu, 01 Nov 2018 06:05:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gI9r3-0007F5-LX for emacs-orgmode@gnu.org; Thu, 01 Nov 2018 06:05:37 -0400 Received: from mail-pl1-f172.google.com ([209.85.214.172]:39358) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gI9r3-00072d-9R for emacs-orgmode@gnu.org; Thu, 01 Nov 2018 06:05:33 -0400 Received: by mail-pl1-f172.google.com with SMTP id b5-v6so8105378pla.6 for ; Thu, 01 Nov 2018 03:05:11 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs orgmode-mailinglist 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 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