GNU bug report logs - #63291
libxml-parse-{html,xml}-region help page incorrect argument lower bound

Previous Next

Package: emacs;

Reported by: Ruijie Yu <ruijie <at> netyu.xyz>

Date: Fri, 5 May 2023 06:49:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#63291: closed (libxml-parse-{html,xml}-region help page
 incorrect argument lower bound)
Date: Fri, 05 May 2023 07:14:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Fri, 05 May 2023 10:13:51 +0300
with message-id <83y1m3i72o.fsf <at> gnu.org>
and subject line Re: bug#63291: libxml-parse-{html, xml}-region help page incorrect argument lower bound
has caused the debbugs.gnu.org bug report #63291,
regarding libxml-parse-{html,xml}-region help page incorrect argument lower bound
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
63291: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63291
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ruijie Yu <ruijie <at> netyu.xyz>
To: bug-gnu-emacs <at> gnu.org
Subject: libxml-parse-{html,xml}-region help page incorrect argument lower
 bound
Date: Fri, 05 May 2023 14:38:02 +0800
First of all, this is newest Emacs 30 in-source build (pulled and built
a few hours ago).

I'm reading the help page of `libxml-parse-xml-region' and noticed this:

--8<---------------cut here---------------start------------->8---
libxml-parse-xml-region is a built-in function in ‘src/xml.c’.

(libxml-parse-xml-region START END &optional BASE-URL)

Parse the region as an XML document and return the parse tree.
If START is nil, it defaults to ‘point-min’.  If END is nil, it
defaults to ‘point-max’.

...
--8<---------------cut here---------------end--------------->8---

Notice the function signature: it implies that the first two arguments
are mandatory, even though the docstring proceeds to talk about what
happens when these two arguments are nil.  Similarly for
`libxml-parse-html-region'.

However, both the C source code and experiments show that these two
functions do accept 0 arguments.

```emacs-lisp
(with-temp-buffer (insert "<html></html>")
                  (libxml-parse-html-region))
;=> (html nil)
```

I have zero knowledge of dealing with C defuns, so I'll leave fixing
this issue to someone more experienced at that.

-- 
Best,


RY

[Please note that this mail might go to spam due to some
misconfiguration in my mail server -- still investigating.]


[Message part 3 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Ruijie Yu <ruijie <at> netyu.xyz>
Cc: 63291-done <at> debbugs.gnu.org
Subject: Re: bug#63291: libxml-parse-{html,
 xml}-region help page incorrect argument lower bound
Date: Fri, 05 May 2023 10:13:51 +0300
> Date: Fri, 05 May 2023 14:38:02 +0800
> From:  Ruijie Yu via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> I'm reading the help page of `libxml-parse-xml-region' and noticed this:
> 
> --8<---------------cut here---------------start------------->8---
> libxml-parse-xml-region is a built-in function in ‘src/xml.c’.
> 
> (libxml-parse-xml-region START END &optional BASE-URL)
> 
> Parse the region as an XML document and return the parse tree.
> If START is nil, it defaults to ‘point-min’.  If END is nil, it
> defaults to ‘point-max’.
> 
> ...
> --8<---------------cut here---------------end--------------->8---
> 
> Notice the function signature: it implies that the first two arguments
> are mandatory, even though the docstring proceeds to talk about what
> happens when these two arguments are nil.  Similarly for
> `libxml-parse-html-region'.
> 
> However, both the C source code and experiments show that these two
> functions do accept 0 arguments.

This is because a recent change made the first 2 arguments optional,
but advertised-calling-convention of these functions in subr.el was
not adjusted to that change, and was overriding the effect of the
DEFUN macros, which say the truth: up to 4 arguments, with zero
mandatory ones.

Fixed on the emacs-29 branch.


This bug report was last modified 2 years and 75 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.