[-- 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:
> 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?
"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
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?
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
>> 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
"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
Le 24 Dec 2020, Ihor Radchenko <yantar92@gmail.com> a écrit :
> I hope the above helps.
It does indeed. Thank you!
Victor