[Top][All Lists]

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

Re: Should mode commands be idempotent?

From: Philipp Stephani
Subject: Re: Should mode commands be idempotent?
Date: Sun, 08 Oct 2017 15:28:35 +0000

John Wiegley <address@hidden> schrieb am Di., 26. Sep. 2017 um 20:55 Uhr:
>>>>> 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.

Given that all current and past maintainers seem to agree, how about the following patch for the Lisp manual? 

Attachment: 0001-Document-that-mode-commands-should-be-idempotent.txt
Description: Text document

reply via email to

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