Re: @anchor on @item line (was: emacs-29 889a550ca08: ; Fix Texinfo warnings)

Gavin Smith <[email protected]>
Newsgroups gmane.comp.tex.texinfo.general,gmane.emacs.devel
Message-ID <ZUk+rpOzuT9nrnQB@beigestar>
On Sun, Nov 05, 2023 at 11:30:42AM +0000, Ihor Radchenko wrote:
> However, there is a warning being produced when @anchor is found on the
> same line with an item:
> 
> org.texi:15975: warning: @anchor should not appear on @item line
> 
> The problematic .texi source is
> 
>     @table @asis
>     @item @samp{OrgOdtStyles.xml} @anchor{x-orgodtstyles-xml}
>     This file contributes to the @samp{styles.xml} file of the final ODT
>     document.  This file gets modified for the following purposes:
> 
> Here, the @anchor is referring to OrgOdtStyles.xml file and is not
> necessarily linked to the @item itself.
> 
> May someone please explain the correct usage of @anchor in the above
> example and why the warning is being thrown?

I don't think there's really much wrong with it.  We added more warnings
for nested commands, trying to define which commands should occur in
certain contexts.  We have given the @item command a class of
"contain_basic_inline", which excludes anchor commands, as well as
the cross-reference commands.

I don't remember, or never knew to start with, what the justification
was for giving @item this class.  It was the case for Texinfo 7.0 too,
as seen in tp/Texinfo/XS/parsetexi/command_data.txt in that release:

item_LINE               line,close_paragraph,contain_simple_text    LINE_line   

("contain_simple_text" has now been renamed "contain_basic_inline").

However, for whatever reason, this use of @anchor on an @item line
didn't trigger the warning in earlier releases.

It would be easy, I expect, to remove this warning:

diff --git a/tp/Texinfo/command_data.txt b/tp/Texinfo/command_data.txt
index 7d07b8bd54..df63c6ccd7 100644
--- a/tp/Texinfo/command_data.txt
+++ b/tp/Texinfo/command_data.txt
@@ -254,8 +254,8 @@ printindex              line,formattable_line,close_paragraph,global,contain_pla
 listoffloats            line,formattable_line,close_paragraph,global,contain_basic_inline   LINE_line
 exdent                  line,formatted_line,close_paragraph            LINE_line
 # or nobrace skipspace, depending on the context
-item_LINE               line,formatted_line,close_paragraph,contain_basic_inline    LINE_line
-itemx                   line,formatted_line,close_paragraph,contain_basic_inline    LINE_line
+item_LINE               line,formatted_line,close_paragraph    LINE_line
+itemx                   line,formatted_line,close_paragraph    LINE_line
 nodedescription         line,close_paragraph                               LINE_line
 # in index entries
 subentry                line,in_index,contain_basic_inline          LINE_line
0$ 

However, I would like to wait to see if anybody else has any comments first.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.