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

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

Re: How to get current filename and absolute path of the file in emacs?


From: Eli Zaretskii
Subject: Re: How to get current filename and absolute path of the file in emacs?
Date: Mon, 16 Apr 2007 22:36:01 +0300

> From: Eric Hanchrow <offby1@blarg.net>
> Date: Sun, 15 Apr 2007 21:30:19 -0700
> 
> (defun copy-buffer-file-name (use-backslashes)
>   "Puts the file name of the current buffer (or the current directory,
> if the buffer isn't visiting a file) onto the kill ring, so that it
> can be retrieved with \\[yank], or by another program.  With argument,
> uses backslashes instead of forward slashes."
>   (interactive "P")
>   (let ((fn (subst-char-in-string
>              ?/
>              (if use-backslashes ?\\ ?/)

It's easier to use convert-standard-filename to mirror slashes into
backslashes.  The nice side effect is that the code that calls
copy-buffer-file-name will now become 100% portable, because you no
longer need the use-backslashes flag to DTRT.




reply via email to

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