[Top][All Lists]

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

[BUG] org-complex-heading-regexp should consider COMMENT keywords [9.5.2

From: Ignacio Casso
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
User-agent: mu4e 1.6.10; emacs 29.0.50


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 @ 

reply via email to

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