bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Strange `file-name-sans-extension' behavior


From: Jens Schmidt
Subject: Strange `file-name-sans-extension' behavior
Date: 26 Jul 2002 11:15:05 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English, because the Emacs maintainers do not have
translators to read other languages for them.

Your bug report will be posted to the address@hidden mailing list,
and to the gnu.emacs.bug news group.

In GNU Emacs 21.1.1 (i386-msvc-nt4.0.1381)
 of 2001-10-22 on buffy

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

(file-name-sans-extension "sys/types.h")

-> "c:/home/jschmidt/sys/types"

I would have expected the result "sys/types".

What about the following version of `file-name-sans-extension':

(defun file-name-sans-extension (filename)
  "Return FILENAME sans final \"extension\".
The extension, in a file name, is the part that follows the last `.'."
  (let ((file (file-name-sans-versions (file-name-nondirectory filename)))
          directory)
      (if (string-match "\\.[^.]*\\'" file)
          (if (setq directory (file-name-directory filename))
              (concat (file-name-as-directory directory)
                      (substring file 0 (match-beginning 0)))
            (substring file 0 (match-beginning 0)))
        filename)))

Regards

Jens




reply via email to

[Prev in Thread] Current Thread [Next in Thread]