Subject: Re: bug#23643: 25.0.50; Documentation of file-name-sans-extension seems wrong

From: Eli Zaretskii <[email-masked]>
Date: Sat, 04 Jun 2016 10:54:22 +0300

> From: Thomas Émile Bourgeat <[email-masked]>
> Date: Mon, 30 May 2016 13:40:16 -0400
> 
> Just for information, the "follows" part confused me (I thought that the part
> that follows "a" in "abc" is "bc" and not "abc"). Although, even if we assume
> that follows is "non-strict", and that the extension contains also the dot,
> then the documentation of file-name-extension is incorrect. In the two
> documentations functions "extension" is defined the same way

The extension is clearly not defined the same way in these two
functions.  But I've seen a similar issue with file-name-extension,
and fixed that as well.  The doc strings now say

  (defun file-name-sans-extension (filename)
    "Return FILENAME sans final \"extension\".
  The extension, in a file name, is the part that begins with the last `.',
  except that a leading `.' of the file name, if there is one, doesn't count."

  (defun file-name-extension (filename &optional period)
    "Return FILENAME's final \"extension\".
  The extension, in a file name, is the part that begins with the last `.',
  excluding version numbers and backup suffixes, except that a leading `.'
  of the file name, if there is one, doesn't count.
  Return nil for extensionless file names such as `foo'.
  Return the empty string for file names such as `foo.'.

  By default, the returned value excludes the period that starts the
  extension, but if the optional argument PERIOD is non-nil, the period
  is included in the value, and in that case, if FILENAME has no
  extension, the value is \"\"."