From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Andreas Schwab Newsgroups: gmane.emacs.devel Subject: Re: TODO: insert-file should warn if the file is modified Date: Fri, 19 Apr 2002 16:33:47 +0200 Sender: emacs-devel-admin@gnu.org Message-ID: References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1019227006 2623 127.0.0.1 (19 Apr 2002 14:36:46 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 19 Apr 2002 14:36:46 +0000 (UTC) Cc: Pavel@Janik.cz, emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16yZVG-0000gC-00 for ; Fri, 19 Apr 2002 16:36:46 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 16yZof-0001ND-00 for ; Fri, 19 Apr 2002 16:56:49 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 16yZUd-0004uy-00; Fri, 19 Apr 2002 10:36:07 -0400 Original-Received: from ns.suse.de ([213.95.15.193] helo=Cantor.suse.de) by fencepost.gnu.org with smtp (Exim 3.34 #1 (Debian)) id 16yZSS-0004oR-00 for ; Fri, 19 Apr 2002 10:33:52 -0400 Original-Received: from Hermes.suse.de (Charybdis.suse.de [213.95.15.201]) by Cantor.suse.de (Postfix) with ESMTP id BA0CD1E66B; Fri, 19 Apr 2002 16:33:51 +0200 (MEST) X-Authentication-Warning: sykes.suse.de: schwab set sender to schwab@suse.de using -f Original-To: Eli Zaretskii X-Yow: Loni Anderson's hair should be LEGALIZED!! In-Reply-To: (Eli Zaretskii's message of "Fri, 19 Apr 2002 09:47:06 -0400") Original-Lines: 37 User-Agent: Gnus/5.090005 (Oort Gnus v0.05) Emacs/21.2.50 (ia64-suse-linux) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:2785 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:2785 Eli Zaretskii writes: |> > From: Pavel@Janik.cz (Pavel =?iso-8859-2?q?Jan=EDk?=) |> > Date: Fri, 19 Apr 2002 14:58:37 +0200 |> > |> > * If you do an insert-file and that file is currently modified in |> > another buffer but not written yet, print a warning. |> > |> > I think that it is pretty simple: |> > |> > (defun file-is-modified-somewhere (filename) |> > "Check if the file FILENAME is modified inside Emacs. |> > |> > Return buffer visiting the file FILENAME marked as modified. |> > Otherwise, return nil." |> > (let ((result)) |> > (dolist (buffer (buffer-list) result) |> > (if (and (string= filename (buffer-file-name buffer)) |> > (buffer-modified-p buffer)) |> > (setq result buffer))))) |> |> What about buffer that visit the same file under a different name |> (e.g., symlinks on Posix systems)? Don't we want to catch those as |> well? |> |> In other words, perhaps you should base the search on file's |> attributes, not just the name? You can use the buffer-file-truename for that. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."