emacs-devel
[Top][All Lists]
Advanced

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

Re: Should mode commands be idempotent?


From: Stefan Monnier
Subject: Re: Should mode commands be idempotent?
Date: Wed, 20 Sep 2017 21:11:59 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

>> I'll return the question: when/why would a major-mode or a minor-mode
>> not want to be idempotent?  Can you cite at least one example?
> I don't need to.  There should be some reasons given for making
> a change, especially a change that attempt to restrict users,
> whether by tooling or convention.

Philip gave the reason in the first email: "it's generally expected that
mode commands (both major and minor) are reasonably idempotent".

Of course, we wouldn't decide on such a rule without weighing the pros
and cons.  But given that he mentioned one pro, we'd need at the very
least one cons before deciding it's a bad idea (no matter how weak the
pro).

Hence my question again (which is already implicitly contained in
Philip's original message):

    When/why would a major-mode or a minor-mode not want to be idempotent?
    Can you cite at least one example?

And of course, no restriction of the sort discussed here would limit
what the end user can do (we can't technically impose such
a restriction, we can only declare it's bad style).  In practice, such
a restriction would probably allow the user to do more things (because
he can now rely on the idempotency in his code): what you take on one
side, allows to give on the other.


        Stefan




reply via email to

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