emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Fwd: [BUG] Sparse tree does not work on properties with dashes
       [not found] <87v8etfaw3.fsf@protesilaos.com>
@ 2023-07-09 13:58 ` Fabian Kurmann
  2023-07-11 11:39   ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Fabian Kurmann @ 2023-07-09 13:58 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: public


Dear maintainers,

EXPLANATION HERE

I can reproduce it with the sample in the annex, following the steps
below:

- Start Emacs with 'emacs -Q'
- Open a new Org file
- Add the contents of the Annex
- Type 'C-c /' and then 'p' for property.
- Select "TEST-HELLO"
- Select any of the two values

Expected behaviour: produce a sparse tree.

Actual result: no sparse tree.

Best, Fabian


ANNEX

* Test with "one"
:PROPERTIES:
:TEST-HELLO: one
:END:

** Test with "two"
:PROPERTIES:
:TEST-HELLO: two
:END:

* Test with "two"
:PROPERTIES:
:TEST-HELLO: two
:END:

** Test with "one"
:PROPERTIES:
:TEST-HELLO: one
:END:

Emacs  : GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.33, cairo version 1.16.0)
  of 2022-05-31
Package: Org mode version 9.6.1 ( @ /home/fabian/.emacs.d/elpa/org-9.6.1/)


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

* Re: Fwd: [BUG] Sparse tree does not work on properties with dashes
  2023-07-09 13:58 ` Fwd: [BUG] Sparse tree does not work on properties with dashes Fabian Kurmann
@ 2023-07-11 11:39   ` Ihor Radchenko
  2024-01-18 15:44     ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-07-11 11:39 UTC (permalink / raw)
  To: Fabian Kurmann; +Cc: emacs-orgmode, public

Fabian Kurmann <fabian.kurmann@uni-duesseldorf.de> writes:

> I can reproduce it with the sample in the annex, following the steps
> below:
>
> - Start Emacs with 'emacs -Q'
> - Open a new Org file
> - Add the contents of the Annex
> - Type 'C-c /' and then 'p' for property.
> - Select "TEST-HELLO"
> - Select any of the two values
>
> Expected behaviour: produce a sparse tree.
>
> Actual result: no sparse tree.

Thanks for reporting!
Confirmed.

This is because `org-sparse-tree' will produce the following matcher:

     TEST-HELLO="one"

Which is interpreted as: Has tag "TEST" and does not have property
"HELLO" set to "one".

AFAIK, there is currently no mechanism to escape "-" in matcher string.
`org-make-tags-matcher' assumes that property name can only contain
alphanumeric charters and underscore.

-- 
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: Fwd: [BUG] Sparse tree does not work on properties with dashes
  2023-07-11 11:39   ` Ihor Radchenko
@ 2024-01-18 15:44     ` Ihor Radchenko
  2024-03-19 14:03       ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2024-01-18 15:44 UTC (permalink / raw)
  To: Fabian Kurmann, Jens Schmidt; +Cc: emacs-orgmode, public

Ihor Radchenko <yantar92@posteo.net> writes:

>> Expected behaviour: produce a sparse tree.
>>
>> Actual result: no sparse tree.
>
> Thanks for reporting!
> Confirmed.
>
> This is because `org-sparse-tree' will produce the following matcher:
>
>      TEST-HELLO="one"
>
> Which is interpreted as: Has tag "TEST" and does not have property
> "HELLO" set to "one".

`org-make-tags-matcher' is now supposed to handle \-escaped dashes in
properties. However, it does not seem to work:

(org-make-tags-matcher "TEST\-HELLO=\"one\"" t) yields

(progn
   (setq org-cached-props nil)
   (or
    (and
     (not (string= (or (org-cached-entry-get nil \"HELLO\") \"\") \"one\"))
     (member \"TEST\" tags-list))))

Jens, do you have any ideas?

-- 
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: Fwd: [BUG] Sparse tree does not work on properties with dashes
  2024-01-18 15:44     ` Ihor Radchenko
@ 2024-03-19 14:03       ` Ihor Radchenko
  2024-03-20  5:03         ` Protesilaos Stavrou
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2024-03-19 14:03 UTC (permalink / raw)
  To: Fabian Kurmann; +Cc: Jens Schmidt, emacs-orgmode, public

Ihor Radchenko <yantar92@posteo.net> writes:

> `org-make-tags-matcher' is now supposed to handle \-escaped dashes in
> properties. However, it does not seem to work:
>
> (org-make-tags-matcher "TEST\-HELLO=\"one\"" t) yields

... which was as expected - I forgot to quote \ inside "...".

The problem was different - sparse tree should escape "-" in property
names by itself when building the matcher.

Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=63b10621a

-- 
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: Fwd: [BUG] Sparse tree does not work on properties with dashes
  2024-03-19 14:03       ` Ihor Radchenko
@ 2024-03-20  5:03         ` Protesilaos Stavrou
  0 siblings, 0 replies; 5+ messages in thread
From: Protesilaos Stavrou @ 2024-03-20  5:03 UTC (permalink / raw)
  To: Ihor Radchenko, Fabian Kurmann; +Cc: Jens Schmidt, emacs-orgmode

> From: Ihor Radchenko <yantar92@posteo.net>
> Date: Tue, 19 Mar 2024 14:03:23 +0000
>
> Ihor Radchenko <yantar92@posteo.net> writes:
>
>> `org-make-tags-matcher' is now supposed to handle \-escaped dashes in
>> properties. However, it does not seem to work:
>>
>> (org-make-tags-matcher "TEST\-HELLO=\"one\"" t) yields
>
> ... which was as expected - I forgot to quote \ inside "...".
>
> The problem was different - sparse tree should escape "-" in property
> names by itself when building the matcher.
>
> Fixed, on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=63b10621a

Thank you!

-- 
Protesilaos Stavrou
https://protesilaos.com


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

end of thread, other threads:[~2024-03-20  5:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87v8etfaw3.fsf@protesilaos.com>
2023-07-09 13:58 ` Fwd: [BUG] Sparse tree does not work on properties with dashes Fabian Kurmann
2023-07-11 11:39   ` Ihor Radchenko
2024-01-18 15:44     ` Ihor Radchenko
2024-03-19 14:03       ` Ihor Radchenko
2024-03-20  5:03         ` Protesilaos Stavrou

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