[Top][All Lists]

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

Re: cc-mode adds newlines

From: Richard Stallman
Subject: Re: cc-mode adds newlines
Date: Sun, 02 Jan 2005 11:05:56 -0500

    Maybe I would be tempted to invent a prepare-write-file-hook
    (if there is none already) that would do any required transformations
    before the file is actually written.

    Both save-buffer and write-file could call this hook.

    This hook could set file-changed in case it adds a final newline.

    Now if save-buffer only tests file-changed after calling
    prepare-write-file-hook it notices the change.

Actually, save-buffer doesn't add a newline, or do much of anything,
unless the buffer is already marked "modified".  The present problem,
or at least you've considered it one, is that write-file adds the
newline unconditionally.  That is because write-file marks the buffer
modified before it calls save-buffer.

I don't think your proposal would alter what happens in this case.

reply via email to

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