[Top][All Lists]

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

Re: Should mode commands be idempotent?

From: John Wiegley
Subject: Re: Should mode commands be idempotent?
Date: Tue, 26 Sep 2017 11:54:44 -0700
User-agent: Gnus/5.130016 (Ma Gnus v0.16) Emacs/26.0 (darwin)

>>>>> Drew Adams <address@hidden> writes:

> Good luck with such a guideline. The state of an Emacs session is _never_
> exactly the same after each time you turn on a mode - any mode, any session.
> So many things change...

I think we can reduce the scope of what we're saying:

The statement I made only applies if the command is called in immediate
succession. That is, the function is *itself* idempotent; it doesn't guarantee
that intervening effects are somehow negated.

That is, the following should be functionally equivalent:

    (foo-mode 1)
    (progn (foo-mode 1) (foo-mode 1))

I don't see what great difficulty this poses. If a mode author is doing thing
inside `foo-mode' like changing the system or the disk, that's exactly the
sort of thing our guideline seeks to prevent.

John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2

reply via email to

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