[Top][All Lists]

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

bug#35316: 26.2; Emacs lags in c++-mode buffer when editing with iedit-m

From: Zhang Haijun
Subject: bug#35316: 26.2; Emacs lags in c++-mode buffer when editing with iedit-mode on
Date: Thu, 16 May 2019 15:46:33 +0000

> 在 2019年5月16日,下午11:04,Alan Mackenzie <address@hidden> 写道:
> The problem is in the function iedit-update-occurrences-2.  There,
> inhibit-modification-hooks is bound to t, and the many changes are made.
> The hook after-change-functions is called explicitly after each change.
> But before-change-functions is not called in this loop.  This is a very
> bad idea.  Unlike many modes, CC Mode has critical parts of its
> functionality in the before-change-functions hook, and depends on this
> hook and after-change-functions both being called for each change.
> When CC Mode detects after-change-functions being called without
> before-..., it enlarges the region to the whole buffer, calls
> c-before-change with this enlarged region, finally proceding with the
> rest of c-after-change.  It does this to protect its buffer's integrity.

It seems that this leads too much redundant work.

> So, the lag with the multiple cursors is being caused by processing the
> entire buffer for each cursor, rather than just part of the buffer
> involved.
> So, why are you binding inhibit-modification-hooks to t and calling
> after-change-functions this way?  Why not just let the modification hooks
> run in the normal fashion?  What is it about before-change-functions
> which is bad in iedit-mode?

I’m not the developer of iedit. I find a comment in the function 

                ;; todo: reconsider this change Quick fix for
                ;; multi-occur occur-edit-mode: multi-occur depend on
                ;; after-change-functions to update original
                ;; buffer. Since inhibit-modification-hooks is set to
                ;; non-nil, after-change-functions hooks are not going
                ;; to be called for the changes of other occurrences.
                ;; So run the hook here.

reply via email to

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