GNU bug report logs - #23643
25.0.50; Documentation of file-name-sans-extension seems wrong

Previous Next

Package: emacs;

Reported by: Thomas Emile Bourgeat <bthom <at> mit.edu>

Date: Sun, 29 May 2016 02:22:01 UTC

Severity: minor

Found in version 25.0.50

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23643 in the body.
You can then email your comments to 23643 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#23643; Package emacs. (Sun, 29 May 2016 02:22:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thomas Emile Bourgeat <bthom <at> mit.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 29 May 2016 02:22:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thomas Emile Bourgeat <bthom <at> mit.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.50; Documentation of file-name-sans-extension seems wrong
Date: Sat, 28 May 2016 22:04:40 -0400
(file-name-sans-extension "foo.bar") produces "foo" when the
documentation suggests it should produce "foo.":

> Return FILENAME sans final "extension".
> The extension, in a file name, is the part that follows the last ‘.’,
> except that a leading ‘.’, if any, doesn’t count.

In GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.25)
 of 2015-10-30
Repository revision: 9c36df736b89490d14a5b5109c9c00209a0c25f5
Windowing system distributor 'The X.Org Foundation', version 11.0.11604000
System Description:	Debian GNU/Linux 8.4 (jessie)

Configured features:
XPM JPEG TIFF GIF PNG SOUND GSETTINGS NOTIFY LIBXML2 FREETYPE XFT ZLIB
TOOLKIT_SCROLL_BARS GTK2 X11





Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sun, 29 May 2016 15:03:01 GMT) Full text and rfc822 format available.

Notification sent to Thomas Emile Bourgeat <bthom <at> mit.edu>:
bug acknowledged by developer. (Sun, 29 May 2016 15:03:01 GMT) Full text and rfc822 format available.

Message #10 received at 23643-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Thomas Emile Bourgeat <bthom <at> mit.edu>
Cc: 23643-done <at> debbugs.gnu.org
Subject: Re: bug#23643: 25.0.50;
 Documentation of file-name-sans-extension seems wrong
Date: Sun, 29 May 2016 18:02:22 +0300
> From: Thomas Emile Bourgeat <bthom <at> mit.edu>
> Date: Sat, 28 May 2016 22:04:40 -0400
> 
> (file-name-sans-extension "foo.bar") produces "foo" when the
> documentation suggests it should produce "foo.":
> 
> > Return FILENAME sans final "extension".
> > The extension, in a file name, is the part that follows the last ‘.’,
> > except that a leading ‘.’, if any, doesn’t count.

Thanks for the report.  I'm not quite sure which part of the doc
string led you to believe that "foo." should be produced: the
"follows" part or the "leading `.'" part.  So I went ahead and
clarified both for the next release.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23643; Package emacs. (Sat, 04 Jun 2016 07:55:02 GMT) Full text and rfc822 format available.

Message #13 received at 23643-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Thomas Émile Bourgeat <bthom <at> mit.edu>
Cc: 23643-done <at> debbugs.gnu.org
Subject: Re: bug#23643: 25.0.50;
 Documentation of file-name-sans-extension seems wrong
Date: Sat, 04 Jun 2016 10:54:22 +0300
> From: Thomas Émile Bourgeat <bthom <at> mit.edu>
> 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 \"\"."




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 02 Jul 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 353 days ago.

Previous Next


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