From: martin rudalics <rudalics@gmx.at>
To: Sam Steingold <sds@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: rename-file
Date: Wed, 26 Aug 2009 22:42:51 +0200 [thread overview]
Message-ID: <4A959E4B.9060808@gmx.at> (raw)
In-Reply-To: <4A955D32.8030202@gnu.org>
> Why isn't the buffer, which is visiting a file, renamed
> when I rename the underlying file with rename-file?
Personally, I do the following when renaming a file or a directory:
First I do a `bookmark-set-filename' on every involved buffer. Next I
do (the precise reasons I don't remember) for any BUFFER whose filename
is set to NEW
(with-current-buffer buffer
(let ((buffer-modified-p (buffer-modified-p)))
;; make buffer visit new
(set-visited-file-name new nil t)
(clear-visited-file-modtime)
(set-buffer-modified-p buffer-modified-p)))))
`dired-rename-file' does something similar, but I never looked into
that.
Finally, I do a redisplay to assure that modelines and frame titles get
updated correctly. When renaming directories I also set the default
directory, if necessary.
All these are sufficient for my personal needs and have not caused any
problems over the past five years. But I'm afraid there's a number of
more hairy issues involved when a package has stored away some buffers'
names in a local list.
martin
next prev parent reply other threads:[~2009-08-26 20:42 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 ` rename-file Eli Zaretskii
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 ` martin rudalics [this message]
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=4A959E4B.9060808@gmx.at \
--to=rudalics@gmx.at \
--cc=emacs-devel@gnu.org \
--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.