emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Bug: inserting capture template [9.3.7 (release_9.3.7-705-gea9463 @ /home/nick/elisp/org-mode/lisp/)]
Date: Tue, 04 Aug 2020 13:25:57 -0400	[thread overview]
Message-ID: <87lfiuxqze.fsf@alphaville.usersys.redhat.com> (raw)

This was reported in https://emacs.stackexchange.com/questions/59928/org-capture-at-point-as-sibling-of-heading

I was able to reproduce it starting from emacs -q with the following ECM:

   emacs -q -l min.el foo.org

where min.el  looks like this (adjust load-path to taste):
--8<---------------cut here---------------start------------->8---

(add-to-list 'load-path "~/src/org-mode/org-mode/lisp")

(require 'org-loaddefs)

(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))

(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-ca" 'org-agenda)

(setq org-capture-templates
      '(("a" "Appointment or call" entry (file+headline "~/todo.org" "Tasks")
         "* APPT %?\n %u")))
--8<---------------cut here---------------end--------------->8---

and foo.org looks like this (| is the position of the cursor):

--8<---------------cut here---------------start------------->8---
* foo

** one

*** two

**** three
**** four
--8<---------------cut here---------------end--------------->8---

In current Org mode, doing `C-0 M-x org-capture RET a' (where "a"
gets me an APPT template - see below), I get:
--8<---------------cut here---------------start------------->8---
* foo
** one

*** two

**** three
  [2020-08-04 Tue 12:58]
**** four
--8<---------------cut here---------------end--------------->8---

with the template at top level.

In 9.2, the same operation inserted a template as a sibling of the headline:

--8<---------------cut here---------------start------------->8---
* foo
** one
*** two

**** three
**** APPT 
     [2020-08-04 Tue 12:58]
**** four
--8<---------------cut here---------------end--------------->8---

The current behavior looks like a bug to me, so I bisected it to the following commit:

--8<---------------cut here---------------start------------->8---
0201d1c0cc367fea0e561ba113f02f263b0ed501 is the first bad commit
commit 0201d1c0cc367fea0e561ba113f02f263b0ed501
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Date:   Sat Jul 6 15:59:12 2019 +0200

    Fix inserting capture templates at point
    * lisp/org-capture.el (org-capture):
    (org-capture-place-table-line): Fix inserting capture templates at
    point.  Insert a new internal property for capture
    template: :insert-here.
    (org-capture-insert-template-here): Remove function.
    * testing/lisp/test-org-capture.el (test-org-caputre/entry):
    (test-org-capture/table-line): Add tests.
    Reported-by: Dominic Surano <sk8ingdom@gmail.com>

 etc/ORG-NEWS                     |   4 +-
 lisp/org-capture.el              | 126 +++++++++++++++------------------------
 testing/lisp/test-org-capture.el |  58 +++++++++++++++++-
 3 files changed, 104 insertions(+), 84 deletions(-)
--8<---------------cut here---------------end--------------->8---



Emacs  : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.32, cairo version 1.16.0)
 of 2020-06-15
Package: Org mode version 9.3.7 (release_9.3.7-705-gea9463 @ /home/nick/elisp/org-mode/lisp/)


"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler

             reply	other threads:[~2020-08-04 17:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-04 17:25 Nick Dokos [this message]
2020-09-05 14:33 ` Bug: inserting capture template [9.3.7 (release_9.3.7-705-gea9463 @ /home/nick/elisp/org-mode/lisp/)] Bastien
2020-09-09  9:36 ` Bastien

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:

  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=87lfiuxqze.fsf@alphaville.usersys.redhat.com \
    --to=ndokos@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* 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


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).