From: Andreas Schwab <schwab@suse.de>
Cc: Pavel@Janik.cz, emacs-devel@gnu.org
Subject: Re: TODO: insert-file should warn if the file is modified
Date: Fri, 19 Apr 2002 16:33:47 +0200 [thread overview]
Message-ID: <jepu0vep10.fsf@sykes.suse.de> (raw)
In-Reply-To: <E16yYjC-0007yl-00@fencepost.gnu.org> (Eli Zaretskii's message of "Fri, 19 Apr 2002 09:47:06 -0400")
Eli Zaretskii <eliz@fencepost.gnu.org> 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."
next prev parent reply other threads:[~2002-04-19 14:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-19 12:58 TODO: insert-file should warn if the file is modified Pavel Janík
2002-04-19 13:47 ` Eli Zaretskii
2002-04-19 14:33 ` Andreas Schwab [this message]
2002-04-19 15:08 ` Pavel Janík
2002-04-19 15:07 ` Pavel Janík
2002-04-19 14:16 ` Kim F. Storm
2002-04-19 14:53 ` Pavel Janík
2002-04-20 17:26 ` Richard Stallman
2002-04-20 18:12 ` Pavel Janík
2002-04-21 13:29 ` Kim F. Storm
2002-04-22 7:46 ` Richard Stallman
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jepu0vep10.fsf@sykes.suse.de \
--to=schwab@suse.de \
--cc=Pavel@Janik.cz \
--cc=emacs-devel@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).