emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ignacio Casso <ignaciocasso@hotmail.com>
To: emacs-orgmode@gnu.org
Subject: [BUG] org-complex-heading-regexp should consider COMMENT keywords [9.5.2 (release_9.5.2-25-gaf6f12 @ /home/ignacio/repos/emacs/lisp/org/)]
Date: Tue, 22 Mar 2022 12:41:56 +0100	[thread overview]
Message-ID: <PAXPR06MB7760098A2D438F2129D86615C6179@PAXPR06MB7760.eurprd06.prod.outlook.com> (raw)


I think `org-complex-heading-regexp' and
`org-complex-heading-regexp-format' should consider COMMENT keywords, as
they do with TODO keywords, priorities, and tags.

Firstly, with things as they are, different methods for accessing the
headline text are inconsistent. For example, for the headline below,
(org-entry-get (point) "ITEM"), which uses `org-complex-heading-regexp',
returns "COMMENT My headline", while (org-element-property :title
(org-element-context)), which doesn't, returns "My headline".

*** TODO [#A] COMMENT My headline   :my_tag:

But more importantly for me, this is a problem in particular with
org-capture, where I would like capture targets to be found regardless
of whether they are commented or not. But right now commented headlines
are only found if the COMMENT keyword also appears in the capture
template, and in that case if the headlines are later uncommented they
are no longer found. You can copy the entry below into an org file and
play around with it to reproduce this described behavior.

* COMMENT My Target
  #+begin_src emacs-lisp
    (let ((org-capture-templates
           `(("d" "My capture template" entry
              (file+headline ,buffer-file-name "My target")
              "* My content"
              :immediate-finish t))))
      (org-capture nil "d"))

The cause of this is the use of `org-complex-heading-regexp-format' in

This is the bug I originally wanted to report, but after
exploring the cause I thought that the problem was really in
`org-complex-heading-regexp' and not org-capture's code.

What do you think? Do you know of any other uses of those variables and
how considering COMMENT keywords or not affects them?

If you agree I can send a patch that changes the default value of those
regexp variables. Otherwise, I can send a patch that just modifies the
code of `org-capture-set-target-location' to fix this only for the
org-capture use case.



Emacs  : GNU Emacs 29.0.50 (build 13, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
 of 2022-03-21
Package: Org mode version 9.5.2 (release_9.5.2-25-gaf6f12 @ /home/ignacio/repos/emacs/lisp/org/)

             reply	other threads:[~2022-03-22 12:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 11:41 Ignacio Casso [this message]
2022-05-05 10:27 Ignacio Casso
2022-05-06 10:52 ` Ihor Radchenko
2022-05-06 12:14   ` Ignacio Casso
2022-05-07  5:27     ` Ihor Radchenko
2022-05-07 16:54       ` Ignacio Casso
2022-05-08 10:23         ` Ihor Radchenko
2022-05-08 11:15           ` Ignacio Casso
2022-05-08 11:51             ` Ihor Radchenko
2022-05-22  8:52               ` Bastien Guerry

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=PAXPR06MB7760098A2D438F2129D86615C6179@PAXPR06MB7760.eurprd06.prod.outlook.com \
    --to=ignaciocasso@hotmail.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).