[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rename-file
From: |
Sam Steingold |
Subject: |
Re: rename-file |
Date: |
Wed, 26 Aug 2009 16:35:31 -0400 |
On Wed, Aug 26, 2009 at 3:21 PM, Stefan Monnier<address@hidden> wrote:
>> Why isn't the buffer, which is visiting a file, renamed
>> when I rename the underlying file with rename-file?
>
> Because rename-file is a low-level function. Maybe we should introduce
> a new command rename-file-buffer which automatically applies to the
> current buffer's file.
OK to commit?
(defun rename-buffer-file (new-name)
"Rename the current buffer and the file it is visiting to NEW-NAME."
(interactive "FRename current file and buffer to: ")
(let ((filename (or buffer-file-name
(error "This buffer is not visiting a file")))
(oldbuf (find-buffer-visiting new-name)))
(when (or (null oldbuf)
(y-or-n-p "Buffer %s is already visiting %s, proceed? "
oldbuf new-name))
(rename-file filename new-name 1)
(set-visited-file-name new-name nil t))))
--
Sam Steingold <http://sds.podval.org>
- Re: rename-file, (continued)
- Re: rename-file, Andreas Schwab, 2009/08/27
- Re: rename-file, Stephen Berman, 2009/08/27
- Re: rename-file, Andreas Schwab, 2009/08/27
- Re: rename-file, Stephen Berman, 2009/08/27
- Re: rename-file, Miles Bader, 2009/08/27
- Re: rename-file, Stephen Berman, 2009/08/27
- Re: rename-file, Andreas Schwab, 2009/08/27
- Re: rename-file, Stefan Monnier, 2009/08/27
Re: rename-file, Stefan Monnier, 2009/08/26
- Re: rename-file, Lennart Borgman, 2009/08/26
- Re: rename-file,
Sam Steingold <=
- Re: rename-file, Eli Zaretskii, 2009/08/26
- Re: rename-file, Richard Stallman, 2009/08/26
- Re: rename-file, Sam Steingold, 2009/08/26
- Re: rename-file, Stefan Monnier, 2009/08/27
- Re: rename-file, Richard Stallman, 2009/08/28
- Re: rename-file, Sam Steingold, 2009/08/31
Re: rename-file, Sam Steingold, 2009/08/27
Re: rename-file, martin rudalics, 2009/08/26
Re: rename-file, Daniel Colascione, 2009/08/27