emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug: inserting capture template [9.3.7 (release_9.3.7-705-gea9463 @ /hom


From: Nick Dokos
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

------------------------------------------------------------------------
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
* APPT 
  [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-set-target-location):
    (org-capture-place-entry):
    (org-capture-place-item):
    (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/item):
    (test-org-capture/table-line): Add tests.
    
    Reported-by: Dominic Surano <sk8ingdom@gmail.com>
    <http://lists.gnu.org/r/emacs-orgmode/2019-07/msg00002.html>

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

HTH


---------------------------------------------------------------------------

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

-- 
Nick

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]