emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TODO: insert-file should warn if the file is modified


From: Eli Zaretskii
Subject: Re: TODO: insert-file should warn if the file is modified
Date: Fri, 19 Apr 2002 09:47:06 -0400

> From: address@hidden (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?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]