[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TODO: insert-file should warn if the file is modified
From: |
Pavel Janík |
Subject: |
Re: TODO: insert-file should warn if the file is modified |
Date: |
Fri, 19 Apr 2002 17:07:19 +0200 |
User-agent: |
Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2.50 (i386-suse-linux-gnu) |
From: Eli Zaretskii <address@hidden>
Date: Fri, 19 Apr 2002 09:47:06 -0400
Hi ELi,
> 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?
Yes, we certainly want to catch those as well. Thank you for pointing this
out. What about the following version? I'm checking if truename of the
argument is the same as truename of any file visited:
(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)
(true-filename (file-truename filename)))
(dolist (buffer (buffer-list) result)
(if (and (string= true-filename
(file-truename (or (buffer-file-name buffer) "")))
(buffer-modified-p buffer))
(setq result buffer)))))
--
Pavel Janík
I remember when I lost an argument. Boy did that hurt! ;-)
-- Richard Stallman in emacs-devel