unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#23643: 25.0.50; Documentation of file-name-sans-extension seems wrong
@ 2016-05-29  2:04 Thomas Emile Bourgeat
  2016-05-29 15:02 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Emile Bourgeat @ 2016-05-29  2:04 UTC (permalink / raw)
  To: 23643

(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






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

* bug#23643: 25.0.50; Documentation of file-name-sans-extension seems wrong
  2016-05-29  2:04 bug#23643: 25.0.50; Documentation of file-name-sans-extension seems wrong Thomas Emile Bourgeat
@ 2016-05-29 15:02 ` Eli Zaretskii
       [not found]   ` <1464629243-sup-9961@wolff.csail.mit.edu>
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2016-05-29 15:02 UTC (permalink / raw)
  To: Thomas Emile Bourgeat; +Cc: 23643-done

> From: Thomas Emile Bourgeat <bthom@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.





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

* bug#23643: 25.0.50; Documentation of file-name-sans-extension seems wrong
       [not found]   ` <1464629243-sup-9961@wolff.csail.mit.edu>
@ 2016-06-04  7:54     ` Eli Zaretskii
  0 siblings, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2016-06-04  7:54 UTC (permalink / raw)
  To: Thomas Émile Bourgeat; +Cc: 23643-done

> From: Thomas Émile Bourgeat <bthom@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 \"\"."





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

end of thread, other threads:[~2016-06-04  7:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-29  2:04 bug#23643: 25.0.50; Documentation of file-name-sans-extension seems wrong Thomas Emile Bourgeat
2016-05-29 15:02 ` Eli Zaretskii
     [not found]   ` <1464629243-sup-9961@wolff.csail.mit.edu>
2016-06-04  7:54     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).