emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* strange behavior of @ in tag searches
@ 2020-12-20 22:52 Victor A. Stoichita
  2020-12-20 23:05 ` Victor A. Stoichita
  0 siblings, 1 reply; 8+ messages in thread
From: Victor A. Stoichita @ 2020-12-20 22:52 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]

Hi,

I’m a bit puzzled by the behavior of the agenda search when tags 
have hierarchical structure and start with @. I attach two 
minimal examples.

In testfiles.org I have:
--8<---------------cut here---------------start------------->8---
#+TAGS: [ @anthro : bib ]

* my anthro 
  task                                               :@anthro:
* my bib 
  task                                                      :bib:
--8<---------------cut here---------------end--------------->8---

I restrict the search to the buffer and search for the tag 
"@anthro".
I would expect to get the two headings "my anthro task" and "my 
bib task".
Instead, I only get "my bib task".

Now in testfiles2.org I have:
--8<---------------cut here---------------start------------->8---
#+TAGS: [ anthro2 : bib2 ]

* my anthro2 
  task                                              :@anthro2:
* my bib2 
  task                                                     :bib2:
--8<---------------cut here---------------end--------------->8---

Notice that here the parent tag set in the header does not start 
with @ while the tag on "my anthro2 task" starts with @.
When I search for "anthro2" (no @), I would expect to get only "my 
bib2 task". But here I get both headings.

Am I missing something? Does @ have a special meaning in tags?

This is with org mode version 9.4.3. 

Regards,
Victor




[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: testfiles_2.org --]
[-- Type: text/x-org, Size: 180 bytes --]

#+TAGS: [ anthro2 : bib2 ]

* my anthro2 task                                              :@anthro2:
* my bib2 task                                                         :bib2:

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: testfiles.org --]
[-- Type: text/x-org, Size: 183 bytes --]

#+TAGS: [ @anthro : bib ]

* my anthro task                                                    :@anthro:
* my bib task                                                           :bib:

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

* Re: strange behavior of @ in tag searches
  2020-12-20 22:52 strange behavior of @ in tag searches Victor A. Stoichita
@ 2020-12-20 23:05 ` Victor A. Stoichita
  2020-12-21  3:38   ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Victor A. Stoichita @ 2020-12-20 23:05 UTC (permalink / raw)
  To: emacs-orgmode


> Hi,
>
> I’m a bit puzzled by the behavior of the agenda search when tags 
> have
> hierarchical structure and start with @. I attach two
> minimal examples.
>
> In testfiles.org I have:
> --8<---------------cut 
> here---------------start------------->8---
> #+TAGS: [ @anthro : bib ]
>
> * my anthro
>   task                                               :@anthro:
> * my bib
>   task                                                      :bib:
> --8<---------------cut 
> here---------------end--------------->8---
>
> I restrict the search to the buffer and search for the tag 
> "@anthro".
> I would expect to get the two headings "my anthro task" and "my 
> bib
> task".
> Instead, I only get "my bib task".
>
> Now in testfiles2.org I have:
> --8<---------------cut 
> here---------------start------------->8---
> #+TAGS: [ anthro2 : bib2 ]
>
> * my anthro2
>   task                                              :@anthro2:
> * my bib2
>   task                                                     :bib2:
> --8<---------------cut 
> here---------------end--------------->8---
>
> Notice that here the parent tag set in the header does not start 
> with
> @ while the tag on "my anthro2 task" starts with @.
> When I search for "anthro2" (no @), I would expect to get only 
> "my
> bib2 task". But here I get both headings.
>
> Am I missing something? Does @ have a special meaning in tags?
>
> This is with org mode version 9.4.3. 
> Regards,
> Victor

I just realized that with "emacs -Q" both searches yield the 
expected results.
I have emacs 27.1 which ships org-mode 9.3.
Could I have set inadvertently something that changes the meaning 
of @ in tag searches? Or was there a change in that respect 
between 9.3 and 9.4.3?



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

* Re: strange behavior of @ in tag searches
  2020-12-20 23:05 ` Victor A. Stoichita
@ 2020-12-21  3:38   ` Ihor Radchenko
  2020-12-22 22:18     ` Kyle Meyer
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2020-12-21  3:38 UTC (permalink / raw)
  To: Victor A. Stoichita, emacs-orgmode

"Victor A. Stoichita" <victor@svictor.net> writes:
> I just realized that with "emacs -Q" both searches yield the 
> expected results.
> I have emacs 27.1 which ships org-mode 9.3.
> Could I have set inadvertently something that changes the meaning 
> of @ in tag searches? Or was there a change in that respect 
> between 9.3 and 9.4.3?

I can reproduce your first recipe on master. However, I simply get no
results on the second recipe (which also should not happen).

For future, to test with custom Org version, you can run emacs like
emacs -Q -L /path/to/your/org-mode/folder/lisp -l org

Best,
Ihor





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

* Re: strange behavior of @ in tag searches
  2020-12-21  3:38   ` Ihor Radchenko
@ 2020-12-22 22:18     ` Kyle Meyer
  2020-12-22 23:34       ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Kyle Meyer @ 2020-12-22 22:18 UTC (permalink / raw)
  To: Ihor Radchenko, Victor A. Stoichita; +Cc: emacs-orgmode

Ihor Radchenko writes:

> "Victor A. Stoichita" <victor@svictor.net> writes:
>> I just realized that with "emacs -Q" both searches yield the 
>> expected results.
>> I have emacs 27.1 which ships org-mode 9.3.
>> Could I have set inadvertently something that changes the meaning 
>> of @ in tag searches? Or was there a change in that respect 
>> between 9.3 and 9.4.3?
>
> I can reproduce your first recipe on master. However, I simply get no
> results on the second recipe (which also should not happen).

Hmm, I tried on master (9140a712f) and maint (97f1d8e34) and can't
trigger the issue.

[recipe 1] With the default configuration, I load testfiles.org and,
hopefully following the recipe, run `M-x org-agenda < m @anthro'.  I see

  Headlines with TAGS match: @anthro
  Press ‘C-u r’ to search again
    testfiles:  my anthro task                                                           :@anthro:
    testfiles:  my bib task                                                                  :bib:

[recipe 2] I load testfiles_2.org and run `M-x org-agenda < m anthro2'.
I see

  Headlines with TAGS match: anthro2
  Press ‘C-u r’ to search again
    testfiles_2:my bib2 task                                                                :bib2:

Am I overlooking some detail?


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

* Re: strange behavior of @ in tag searches
  2020-12-22 22:18     ` Kyle Meyer
@ 2020-12-22 23:34       ` Ihor Radchenko
  2020-12-23 10:26         ` Victor A. Stoichita
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2020-12-22 23:34 UTC (permalink / raw)
  To: Kyle Meyer, Victor A. Stoichita; +Cc: emacs-orgmode

Kyle Meyer <kyle@kyleam.com> writes:

> Hmm, I tried on master (9140a712f) and maint (97f1d8e34) and can't
> trigger the issue.
>
> Am I overlooking some detail?

Curious. I tried again and I cannot reproduce both on master and on
master with my config. Sorry for the noise.

Best,
Ihor



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

* Re: strange behavior of @ in tag searches
  2020-12-22 23:34       ` Ihor Radchenko
@ 2020-12-23 10:26         ` Victor A. Stoichita
  2020-12-24  2:56           ` Ihor Radchenko
  0 siblings, 1 reply; 8+ messages in thread
From: Victor A. Stoichita @ 2020-12-23 10:26 UTC (permalink / raw)
  To: emacs-orgmode


>> Hmm, I tried on master (9140a712f) and maint (97f1d8e34) and 
>> can't
>> trigger the issue.
>>
>> Am I overlooking some detail?

Ok, I managed to narrow it down to a particular aspect of my 
init file.
I modify the syntax table for text modes to handle the meaning of 
some characters in French. In fact, te actual modification doesn’t 
seem to matter. The following is enough to trigger the described 
behavior:

--8<---------------cut here---------------start------------->8---
(add-hook 'text-mode-hook (lambda ()
   (set-syntax-table (make-syntax-table))))
--8<---------------cut here---------------end--------------->8---

After this, org-agenda starts behaving weirdly for tags that start 
with @ and use inheritance (behavior described in my first email).

For now, I changed my tags to not use @ any more.
Are there other aspects that I might miss if I alter the syntax 
table on ’text-mode-hook?

Victor


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

* Re: strange behavior of @ in tag searches
  2020-12-23 10:26         ` Victor A. Stoichita
@ 2020-12-24  2:56           ` Ihor Radchenko
  2020-12-24  8:21             ` Victor A. Stoichita
  0 siblings, 1 reply; 8+ messages in thread
From: Ihor Radchenko @ 2020-12-24  2:56 UTC (permalink / raw)
  To: Victor A. Stoichita, emacs-orgmode

"Victor A. Stoichita" <victor@svictor.net> writes:

> I modify the syntax table for text modes to handle the meaning of 
> some characters in French. In fact, te actual modification doesn’t 
> seem to matter. The following is enough to trigger the described 
> behavior:
>
> --8<---------------cut here---------------start------------->8---
> (add-hook 'text-mode-hook (lambda ()
>    (set-syntax-table (make-syntax-table))))
> --8<---------------cut here---------------end--------------->8---

That basically clears _all_ syntax settings in org-mode. It would
interfere with pretty much any major mode that modifies syntax tables...
A better way to modify syntax table is using modify-syntax-entry or you
need to make sure that your code inherits org-mode-syntax-table instead
of creating an empty table.

I just searched through org code and the following syntax table elements
are being used by org:

-*- mode: helm-grep -*-

AG Results for `modify-syntax-entry':

org-element.el:380:    (modify-syntax-entry ?\( "()" table)
org-element.el:381:    (modify-syntax-entry ?\) ")(" table)
org-element.el:383:      (modify-syntax-entry char " " table)))
org-element.el:389:    (modify-syntax-entry ?\[ "(]" table)
org-element.el:390:    (modify-syntax-entry ?\] ")[" table)
org-element.el:392:      (modify-syntax-entry char " " table)))
org-element.el:398:    (modify-syntax-entry ?\{ "(}" table)
org-element.el:399:    (modify-syntax-entry ?\} "){" table)
org-element.el:401:      (modify-syntax-entry char " " table)))
ox.el:6870:	(modify-syntax-entry ?\[ "w"))
org.el:4719:  (modify-syntax-entry ?\" "\"")
org.el:4720:  (modify-syntax-entry ?\\ "_")
org.el:4721:  (modify-syntax-entry ?~ "_")
org.el:4722:  (modify-syntax-entry ?< "(>")
org.el:4723:  (modify-syntax-entry ?> ")<")
org.el:4838:      (modify-syntax-entry (string-to-char (car c)) "w p" st))))
org.el:10927:	(modify-syntax-entry ?@ "w" tag-syntax)
org.el:10928:	(modify-syntax-entry ?_ "w" tag-syntax)

The last two refer to tag groups.

> For now, I changed my tags to not use @ any more.
> Are there other aspects that I might miss if I alter the syntax 
> table on ’text-mode-hook?

I hope the above helps.

Best,
Ihor


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

* Re: strange behavior of @ in tag searches
  2020-12-24  2:56           ` Ihor Radchenko
@ 2020-12-24  8:21             ` Victor A. Stoichita
  0 siblings, 0 replies; 8+ messages in thread
From: Victor A. Stoichita @ 2020-12-24  8:21 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode


Le 24 Dec 2020, Ihor Radchenko <yantar92@gmail.com> a écrit :
> I hope the above helps.

It does indeed. Thank you!

Victor


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

end of thread, other threads:[~2020-12-24  8:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-20 22:52 strange behavior of @ in tag searches Victor A. Stoichita
2020-12-20 23:05 ` Victor A. Stoichita
2020-12-21  3:38   ` Ihor Radchenko
2020-12-22 22:18     ` Kyle Meyer
2020-12-22 23:34       ` Ihor Radchenko
2020-12-23 10:26         ` Victor A. Stoichita
2020-12-24  2:56           ` Ihor Radchenko
2020-12-24  8:21             ` Victor A. Stoichita

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