[Top][All Lists]

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

Re: insert-file-contents and format-decode

From: martin rudalics
Subject: Re: insert-file-contents and format-decode
Date: Tue, 19 Jun 2007 09:50:35 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

>     I test the attached patch for a week now and didn't encounter any
>     problems.  In addition to fixing the bug I described it moves the call
>     of after-change hooks _after_ the call to `after-insert-file-functions'.
> That seems like a mistake to me.  The `after-insert-file-functions'
> are Lisp functions, and if they change the buffer, they will call the
> after change hooks for what they did.  Therefore, the calls to the
> after change hooks for this function's own direct changes in the
> buffer should be done before.

(1) The `format-decode' ("round-trip" as the new Elisp manual entry
calls them) based functions are Lisp functions, may change the buffer,
and may call the after-change functions for what they do.  They precede,
within `insert-file-contents', the after-change-functions call.  If a
distinction between round-trip and "piecemeal" functions with respect to
calling after-change-functions is desired it should be documented.

(2) Calling `after-change-functions' from within `format-decode' or
`after-insert-file-functions' seems to me highly risky.  Personally, I'd
never trust any of them if they don't use `inhibit-modification-hooks'.

(3) Not calling `after-change-functions' after performing all functions
in `after-insert-file-functions' may mean, for example, not executing
`font-lock-after-change-function' after inserting the contents of some
file in the current buffer.

I think the only live and safe place to call `after-change-functions' is
after the entire file contents have been decoded, that means, after all
functions in `after-insert-file-functions' have been called.

reply via email to

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