emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] Invalid capture datetree capture templates (newly introduced) [9.7-pre (release_9.6.18-1145-g10d286 @ /home/jds6696/.emacs.d/straight/build/org/)]
@ 2024-02-07 14:23 Justin Silverman
  2024-02-07 14:49 ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Justin Silverman @ 2024-02-07 14:23 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1378 bytes --]

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

I have been using the same capture templates for years now without problem. Recently updated org and noticed a new bug.

Example: the following capture template now produces an error:
let: Invalid capture target specification: (file+olp+datetree "~/Dropbox/org/mtx-michelle.org")

("mp" "meeting psu" entry (file+olp+datetree "~/Dropbox/org/meetings_psu.org")
	   "* MEETING %u with %? :MEETING:\n "
	   :jump-to-captured t
	   :tree-type month)

Org no longer allows the third argument in (file+olp+datetree "~/Dropbox/org/meetings_psu.org") to be omitted. Everything works if I embed the datetree under a headline "foo" and make the capture template


("mp" "meeting psu" entry (file+olp+datetree "~/Dropbox/org/meetings_psu.org" "foo")
	   "* MEETING %u with %? :MEETING:\n "
	   :jump-to-captured t
	   :tree-type month)

Thanks!
Justin

Emacs  : GNU Emacs 29.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.40, cairo version 1.18.0)
Package: Org mode version 9.7-pre (release_9.6.18-1145-g10d286 @ /home/jds6696/.emacs.d/straight/build/org/)

[-- Attachment #1.2: Type: text/html, Size: 3331 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] Invalid capture datetree capture templates (newly introduced) [9.7-pre (release_9.6.18-1145-g10d286 @ /home/jds6696/.emacs.d/straight/build/org/)]
  2024-02-07 14:23 [BUG] Invalid capture datetree capture templates (newly introduced) [9.7-pre (release_9.6.18-1145-g10d286 @ /home/jds6696/.emacs.d/straight/build/org/)] Justin Silverman
@ 2024-02-07 14:49 ` Ihor Radchenko
  2024-02-09 19:13   ` Tommy Kelly
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2024-02-07 14:49 UTC (permalink / raw)
  To: Justin Silverman; +Cc: emacs-orgmode

Justin Silverman <jsilve24@gmail.com> writes:

> I have been using the same capture templates for years now without problem. Recently updated org and noticed a new bug.
>
> Example: the following capture template now produces an error:
> let: Invalid capture target specification: (file+olp+datetree "~/Dropbox/org/mtx-michelle.org")
>
> ("mp" "meeting psu" entry (file+olp+datetree "~/Dropbox/org/meetings_psu.org")
> 	   "* MEETING %u with %? :MEETING:\n "
> 	   :jump-to-captured t
> 	   :tree-type month)

> Org no longer allows the third argument in (file+olp+datetree "~/Dropbox/org/meetings_psu.org") to be omitted. Everything works if I embed the datetree under a headline "foo" and make the capture template

Duplicate of https://list.orgmode.org/878r3xfm90.fsf@localhost/T/#t
Canceled.

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] Invalid capture datetree capture templates (newly introduced) [9.7-pre (release_9.6.18-1145-g10d286 @ /home/jds6696/.emacs.d/straight/build/org/)]
  2024-02-07 14:49 ` Ihor Radchenko
@ 2024-02-09 19:13   ` Tommy Kelly
  2024-02-09 20:43     ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Tommy Kelly @ 2024-02-09 19:13 UTC (permalink / raw)
  To: emacs-orgmode

Justin Silverman <jsilve24@gmail.com> writes:
js > Org no longer allows the third argument in (file+olp+datetree ...

And Ihor Radchenko <yantar92@posteo.net> replied:
ir > Duplicate of https://list.orgmode.org/878r3xfm90.fsf@localhost/T/#t
ir > Canceled.

The initial problem has certainly been fixed in that the headline(s)
arguments to file+olp+datetree (f+o+d) are now optional as the doc
implies should be the case.
But I don't think the new behavior is fully correct either, and the
problem affects not just the situation where no headline arguments are
given.
It seems to be connected with how the location of the datetree is
chosen in general.

My expectation (going by prior behaviors as well as current
documentation) is that the location is fully specified by the capture
template. For example, suppose you have the following:

A) entry (file+olp+datetree "test-datetree.org")                   ;;
i.e. filename only
B) entry (file+olp+datetree "test-datetree.org" "H1")           ;;
filename plus heading
C) entry (file+olp+datetree "test-datetree.org" "H1 "H2")    ;;
filename plus heading and sub-heading

Then I'd expect A) to use a datetree rooted at the file top level; B)
to use one underneath heading "* H1"; and C) to use one underneath **
H2" (which itself is underneath "* H1").
And in each case I'd expect it to create a new datetree at the
specified location if one didn't already exist.

HOWEVER, it looks like that can break if there is already one or more
datetrees anywhere in the file AT A LEVEL BELOW THAT specified by the
template.
In that case, the position specified by the template is simply
ignored. Instead, the captured item is filed at first occurring
datetree of the above kind.
To be clear, that's even if there is also a pre-existing datetree at
the correct, template-specified location but further down the file.

I tested the situation with all three of the above types available as
capture types, and starting with an empty target file (other than the
two headings "* H1" and "** H2").
I first captured to type A) and I got what I expected: a datetree with
the "2004" root entry being at the file top level. That was positioned
(textually, not hierarchically) beneath the two "H" headings I'd
prepared the file with in the first place.
Then I captured to type C), and also got what I expected; a second
datetree, now with the root being "*** 2004", under "** H2".

But from that point on, all captures, of any of the three types all
went to the one created by that type C) capture -- i.e. to "*** 2004",
under "** H2". under "* H1".
I don't think that's expected/correct behavior.

As to my version of Org: I'm doing all this in my own git copy,
refreshed ("pull"ed?) last night, but I'm still very new to that
approach so this may not be what is usually looked for (and I'd
appreciate the correction if needed), but 'org-version' reports:
- Org mode version 9.7-pre (release_N/A-N/A-ee395b @
/home/tommyk/my/git/org-mode/lisp/)

And if it matters, here's emacs-version:
- GNU Emacs 28.2 (build 2, aarch64-unknown-linux-gnu, X toolkit, cairo
version 1.16.0, Xaw3d scroll bars) of 2023-05-13, modified by Debian

--


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] Invalid capture datetree capture templates (newly introduced) [9.7-pre (release_9.6.18-1145-g10d286 @ /home/jds6696/.emacs.d/straight/build/org/)]
  2024-02-09 19:13   ` Tommy Kelly
@ 2024-02-09 20:43     ` Ihor Radchenko
  2024-02-10 19:29       ` Tommy Kelly
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2024-02-09 20:43 UTC (permalink / raw)
  To: Tommy Kelly; +Cc: emacs-orgmode

Tommy Kelly <tommy.kelly@verilab.com> writes:

> C) entry (file+olp+datetree "test-datetree.org" "H1 "H2")    ;;
> filename plus heading and sub-heading
>
> Then I'd expect A) to use a datetree rooted at the file top level; B)
> to use one underneath heading "* H1"; and C) to use one underneath **
> H2" (which itself is underneath "* H1").
> And in each case I'd expect it to create a new datetree at the
> specified location if one didn't already exist.
>
> HOWEVER, it looks like that can break if there is already one or more
> datetrees anywhere in the file AT A LEVEL BELOW THAT specified by the
> template.
> In that case, the position specified by the template is simply
> ignored. Instead, the captured item is filed at first occurring
> datetree of the above kind.
> To be clear, that's even if there is also a pre-existing datetree at
> the correct, template-specified location but further down the file.

Are you sure that what you describe is newly introduced?
I'd expect this exact behavior since forever, judging from how
`org-datetree--find-create' is implemented.
-- 
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>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] Invalid capture datetree capture templates (newly introduced) [9.7-pre (release_9.6.18-1145-g10d286 @ /home/jds6696/.emacs.d/straight/build/org/)]
  2024-02-09 20:43     ` Ihor Radchenko
@ 2024-02-10 19:29       ` Tommy Kelly
  0 siblings, 0 replies; 5+ messages in thread
From: Tommy Kelly @ 2024-02-10 19:29 UTC (permalink / raw)
  To: emacs-orgmode

In response to Tommy Kelly <tommy.kelly@verilab.com> writing:
>> ...if there is already one or more datetrees anywhere in [a] file AT A LEVEL
>> BELOW THAT specified by [a datetree-based capture] template [then] the
>> position specified by the template is simply ignored.

Ihor Radchenko <yantar92@posteo.net> wrote:
> Are you sure that what you describe is newly introduced?
> I'd expect this exact behavior since forever, judging from how
> `org-datetree--find-create' is implemented.

No, I'm not sure. In fact, now you mention it, what you're suggesting
probably is the case. This is the first time I've tried using more
than one datetree in the same file, so I wouldn't before have noticed
the behavior I describe.

That said, had I noticed it in the past, I would have been inclined to
flag it as an issue. At very least it makes the documentation
incorrect, but in fact I'd say that the documentation is fine and the
behavior is wrong.

Nevertheless, it's not connected with the issue you already fixed
(https://list.orgmode.org/878r3xfm90.fsf@localhost/T/#t) so that
should remain closed.

thx.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-10 19:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07 14:23 [BUG] Invalid capture datetree capture templates (newly introduced) [9.7-pre (release_9.6.18-1145-g10d286 @ /home/jds6696/.emacs.d/straight/build/org/)] Justin Silverman
2024-02-07 14:49 ` Ihor Radchenko
2024-02-09 19:13   ` Tommy Kelly
2024-02-09 20:43     ` Ihor Radchenko
2024-02-10 19:29       ` Tommy Kelly

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