emacs-devel
[Top][All Lists]
Advanced

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

Re: Strange `file-name-sans-extension' behavior


From: Stefan Monnier
Subject: Re: Strange `file-name-sans-extension' behavior
Date: Fri, 09 Aug 2002 03:38:45 -0400

> Does this fix it?
> 
> *** files.el.~1.598.~ Fri Jul 26 11:47:31 2002
> --- files.el  Sat Jul 27 14:16:42 2002
> ***************
> *** 2468,2475 ****
>         (if (and (string-match "\\.[^.]*\\'" file)
>              (not (eq 0 (match-beginning 0))))
>         (if (setq directory (file-name-directory filename))
> !           (expand-file-name (substring file 0 (match-beginning 0))
> !                             directory)
>           (substring file 0 (match-beginning 0)))
>       filename))))
>   
> --- 2468,2476 ----
>         (if (and (string-match "\\.[^.]*\\'" file)
>              (not (eq 0 (match-beginning 0))))
>         (if (setq directory (file-name-directory filename))
> !           ;; Don't use expand-file-name here; if DIRECTORY is relative,
> !           ;; we don't want to expand it.
> !           (concat directory (substring file 0 (match-beginning 0)))
>           (substring file 0 (match-beginning 0)))
>       filename))))

Could we introduce a new function for that or some way to tell
`expand-file-name' not to do the expansion if the dir is relative ?
The current elisp primitives make it very difficult to reconstruct
a file name that was just taken apart.  The missing piece is
indeed this "concat a (potentially relative) directory name
and a file name but without making it absolute and without
adding "./" in front".


        Stefan




reply via email to

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