From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: rename-file Date: Wed, 26 Aug 2009 22:42:51 +0200 Message-ID: <4A959E4B.9060808@gmx.at> References: <4A955D32.8030202@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1251319395 28314 80.91.229.12 (26 Aug 2009 20:43:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 26 Aug 2009 20:43:15 +0000 (UTC) Cc: emacs-devel@gnu.org To: Sam Steingold Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 26 22:43:08 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MgPKk-0001Ri-Go for ged-emacs-devel@m.gmane.org; Wed, 26 Aug 2009 22:43:07 +0200 Original-Received: from localhost ([127.0.0.1]:45157 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgPKj-0005nd-Og for ged-emacs-devel@m.gmane.org; Wed, 26 Aug 2009 16:43:05 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MgPKf-0005nE-8u for emacs-devel@gnu.org; Wed, 26 Aug 2009 16:43:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MgPKa-0005mO-3R for emacs-devel@gnu.org; Wed, 26 Aug 2009 16:43:00 -0400 Original-Received: from [199.232.76.173] (port=41664 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgPKZ-0005mJ-Rl for emacs-devel@gnu.org; Wed, 26 Aug 2009 16:42:55 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]:45847) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1MgPKZ-00013S-4A for emacs-devel@gnu.org; Wed, 26 Aug 2009 16:42:55 -0400 Original-Received: (qmail invoked by alias); 26 Aug 2009 20:42:52 -0000 Original-Received: from 62-47-33-97.adsl.highway.telekom.at (EHLO [62.47.33.97]) [62.47.33.97] by mail.gmx.net (mp068) with SMTP; 26 Aug 2009 22:42:52 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18oLnIrm+Mojumr75p8H95sFR44eebIluTHTvp7yl qCqGGrCK7NgWKG User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) In-Reply-To: <4A955D32.8030202@gnu.org> X-Y-GMX-Trusted: 0 X-FuHaFi: 0.68 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:114637 Archived-At: > 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