all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Sam Steingold <sds@gnu.org>
Cc: monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: rename-file
Date: Thu, 27 Aug 2009 06:15:13 +0300	[thread overview]
Message-ID: <83ocq2c5ha.fsf@gnu.org> (raw)
In-Reply-To: <1f77704b0908261335y799ec0a4r74c69d9c36a82234@mail.gmail.com>

> Date: Wed, 26 Aug 2009 16:35:31 -0400
> From: Sam Steingold <sds@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> > 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))))

Will this work in a Dired buffer, especially if there are files in
that directory visited by other buffers?

What about other buffers visiting the same file?





  reply	other threads:[~2009-08-27  3:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-26 16:05 rename-file Sam Steingold
2009-08-26 18:58 ` rename-file Stephen Berman
2009-08-27  3:16   ` rename-file Stefan Monnier
2009-08-27  8:38     ` rename-file Stephen Berman
2009-08-27  9:09       ` rename-file Andreas Schwab
2009-08-27 10:01         ` rename-file Stephen Berman
2009-08-27 10:21           ` rename-file Andreas Schwab
2009-08-27 11:28             ` rename-file Stephen Berman
2009-08-27 11:50               ` rename-file Miles Bader
2009-08-27 14:59                 ` rename-file Stephen Berman
2009-08-27 12:18               ` rename-file Andreas Schwab
2009-08-27 17:08       ` rename-file Stefan Monnier
2009-08-26 19:21 ` rename-file Stefan Monnier
2009-08-26 20:20   ` rename-file Lennart Borgman
2009-08-26 20:35   ` rename-file Sam Steingold
2009-08-27  3:15     ` Eli Zaretskii [this message]
2009-08-27  3:25     ` rename-file Richard Stallman
2009-08-27  3:41       ` rename-file Sam Steingold
2009-08-27 17:11         ` rename-file Stefan Monnier
2009-08-29  0:46         ` rename-file Richard Stallman
2009-08-31 22:09           ` rename-file Sam Steingold
2009-08-27 14:47     ` rename-file Sam Steingold
2009-08-26 20:42 ` rename-file martin rudalics
2009-08-27 13:49 ` rename-file Daniel Colascione

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83ocq2c5ha.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=sds@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.