emacs-devel
[Top][All Lists]
Advanced

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

Re: Apropos 54f297904e0c: Temporarily comment out CC Mode from tests whi


From: João Távora
Subject: Re: Apropos 54f297904e0c: Temporarily comment out CC Mode from tests which are incompatible with it.
Date: Mon, 21 Jan 2019 22:41:07 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Stefan Monnier <address@hidden> writes:
>>> If you use electric-layout-mode and electric-pair-mode, then all that's
>>> left for c-electric-brace is to call self-insert-command.
>> No.  There's more to it than that.
> You mean the c-cleanup-list, I guess.  Indeed, before c-electric-brace
> can be turned into an alias for self-insert-command, we'd need to add
> another post-self-insert-hook which implements the
> c-cleanup-list feature.

According to its docstring, c-cleanup-list only takes effect when
c-auto-newline is on.  So, in the interim we could consider doing either
this:

  (let ((post-self-insert-hook (unless c-auto-newline post-self-insert-hook)))
    (self-insert-command arg))

Or maybe just

  (let ((electric-layout-mode (not c-auto-newline))
        (electric-pair-mode (not c-auto-newline)))
     (self-insert-command arg))

As fair as I read the code, it is only when c-auto-newline is turned on
that any problems stated thus far exist.  My proposal is that e-l-m and
e-p-m defer to c-auto-newline, if is turned on.

This buys us time while we develop a potentially better alternative that
could, if Alan accepts it, effectively _become_ c-auto-newline.  Or, if
Alan chooses not to, become just an alternative way to do the same.
It's not optimal, but I could live with that.

But during that time (and notably if i.e. Emacs 27 is frozen), then
users that _don't_ use c-auto-newline can enjoy an electric-pair-mode,
electric-layout-mode, or any other global minor-mode that uses on
post-self-insert-hook without any regressions in behaviour.

As the code stands now, if we don't do anything, there's a good chance
that users will complain (I remind everyone that CC-mode is used for the
C++/C/Java modes).

Users that _do_ use c-auto-newline see improved behaviour in some
cc-mode areas, such as partial e-p-m support, and perhaps degraded
behaviour in others, namely if they use other global minor-modes.

João







reply via email to

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