emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] Can't export variable named "nil" to Texinfo
@ 2024-09-28 15:08 8dcc
  2024-10-09 16:01 ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: 8dcc @ 2024-09-28 15:08 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello,

I can export the following "Variable" to Texinfo with
`org-texinfo-export-to-texinfo':

  - Variable: my-name ::

    Content...

Results in the following .texi:

  @defvar my-name
  Content@dots{}
  @end defvar

However, if the variable is named "nil" (without the quotes), the
variable name is not exported, and a warning is generated when
processing the .texi file:

  - Variable: nil ::

    Content...

Results in:

  @defvar
  Content@dots{}
  @end defvar

When running `makeinfo --pdf file.texi':

  file.texi:50: warning: missing category for @defvar

I saw the "Variable" to "@defvar" conversion is made with
`org-texinfo--definition-command-alist' in `ox-texinfo.el', which then
gets used in `org-texinfo--match-definition' through the
regexp. However, I was not able to see why a "nil" string isn't
processed.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

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

* Re: [BUG] Can't export variable named "nil" to Texinfo
  2024-09-28 15:08 [BUG] Can't export variable named "nil" to Texinfo 8dcc
@ 2024-10-09 16:01 ` Ihor Radchenko
  2024-10-09 17:19   ` 8dcc
  0 siblings, 1 reply; 4+ messages in thread
From: Ihor Radchenko @ 2024-10-09 16:01 UTC (permalink / raw)
  To: 8dcc; +Cc: emacs-orgmode

8dcc <8dcc.git@gmail.com> writes:

> However, if the variable is named "nil" (without the quotes), the
> variable name is not exported, and a warning is generated when
> processing the .texi file:
>
>   - Variable: nil ::
>
>     Content...
>
> Results in:
>
>   @defvar
>   Content@dots{}
>   @end defvar

Confirmed.
Although, I am not sure if this is worth fixing.

The reason why you observe this behavior is in implementation detail in
ox-texinfo - `org-texinfo--split-definition' parses description lists,
replacing them with

#+attr_texinfo: :options name
#+begin_defvar
...
#+end_defvar

block, and it happens to be that :options nil is treated specially by
Org export (See `org-texinfo-special-block' calling
`org-export-read-attribute')). "nil" is not read literally, but is
instead interpreted as removing the option value - when one needs to
combine multiple attributes and override previous setting.

In theory, we may fix this edge case just for ox-texinfo. But is it
worth it? Do you _really_ have variable name "nil"?

-- 
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] 4+ messages in thread

* Re: [BUG] Can't export variable named "nil" to Texinfo
  2024-10-09 16:01 ` Ihor Radchenko
@ 2024-10-09 17:19   ` 8dcc
  2024-10-14 18:43     ` Ihor Radchenko
  0 siblings, 1 reply; 4+ messages in thread
From: 8dcc @ 2024-10-09 17:19 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

Ihor Radchenko <yantar92@posteo.net> writes:

> It happens to be that :options nil is treated specially by Org
> export. "nil" is not read literally, but is instead interpreted as
> removing the option value - when one needs to combine multiple
> attributes and override previous setting.

I see. I didn't know about "combining attributes", but I guess that
makes sense.

> In theory, we may fix this edge case just for ox-texinfo. But is it
> worth it?

I am not sure if it's worth fixing, specially since I don't know any
possible alternatives apart from using another keyword for specifying
this "attribute combination" (again, not sure how that works). Either
way, modifying existing behavior doesn't sound too good to me, specially
considering the amount of "nil" variables :)

> Do you _really_ have variable name "nil"?

Yes, I was not looking for this error, I didn't even know why it
happened before you told me. I am using Org to write the manual for my
Lisp interpreter, and I am exporting it to Texinfo. I wanted to explain
how `nil' works, and when it's used.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

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

* Re: [BUG] Can't export variable named "nil" to Texinfo
  2024-10-09 17:19   ` 8dcc
@ 2024-10-14 18:43     ` Ihor Radchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Ihor Radchenko @ 2024-10-14 18:43 UTC (permalink / raw)
  To: 8dcc; +Cc: emacs-orgmode

8dcc <8dcc.git@gmail.com> writes:

>> Do you _really_ have variable name "nil"?
>
> Yes, I was not looking for this error, I didn't even know why it
> happened before you told me. I am using Org to write the manual for my
> Lisp interpreter, and I am exporting it to Texinfo. I wanted to explain
> how `nil' works, and when it's used.

Fixed, on main.
I made it so that ox-texinfo can handle nil values normally by working
around `org-export-read-attribute'.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=da0f6eff75

It will still be impossible to do something like
#+begin_defvar :options nil
...
#+end_defvar

-- 
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] 4+ messages in thread

end of thread, other threads:[~2024-10-14 18:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-28 15:08 [BUG] Can't export variable named "nil" to Texinfo 8dcc
2024-10-09 16:01 ` Ihor Radchenko
2024-10-09 17:19   ` 8dcc
2024-10-14 18:43     ` Ihor Radchenko

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