emacs-devel
[Top][All Lists]
Advanced

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

Re: problem of define-minor-mode while bootstrapping


From: Kenichi Handa
Subject: Re: problem of define-minor-mode while bootstrapping
Date: Mon, 30 Sep 2002 15:26:02 +0900 (JST)
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/21.1.30 (sparc-sun-solaris2.6) MULE/5.0 (SAKAKI)

In article <address@hidden>, Richard Stallman <address@hidden> writes:
>>  Would you please be more specific?  I have no idea what that refers
>>  to.  The start of this conversation was a week or more ago, and I
>>  don't remember it.  What exactly is the RT that we can't D?

>     What handa's complaining about -- just define the minor mode
>     defaulting to on as far as I understand it.

> That is very sketchy.  It is enough remind someone who already knows
> the issue which issue is meant, but nowhere near enough to explain it
> to a person who doesn't know.

> Could someone explain to me what the issue is?

Ok, I'll repeast.

In RC, if both :global and :init-value of define-minor-mode
is non-nil, define-minor-mode calls eval-after-load as below:

       ;; If the mode is global, call the function according to the default.
       ,(if (and globalp (null init-value))
            `(if (and load-file-name ,mode)
                 (eval-after-load load-file-name '(,mode 1)))))))

And, eval-after-load calls load-symbol-file-load-history,
and load-symbol-file-load-history loads "fns-XX.YY.ZZ.el".
But, at bootstrapping time, as "fns-XX.YY.ZZ.el" is not yet
generated, it signals an error.  It may not be a bug of
define-minor-mode, but a bug of eval-after-load or
load-symbol-file-load-history.  In any case, it should be
fixed at somewhere.

In HEAD instead, define-minor-mode now has this code:

       ;; If the mode is global, call the function according to the default.
       ,(if globalp
            `(if (and load-file-name (not (equal ,init-value ,mode)))
                 (eval-after-load load-file-name '(,mode (if ,mode 1 -1))))))))

As (equal ,init-value ,mode) is t at bootstrapping time,
eval-after-load is not called, thus the above error is not
revealed.  But, as the result, it is now the programmer's
responsibility to make the XXX-minor-mode's status
synchronize to the value of XXX-minor-mode, i.e., we must do:

(define-minor-mode 'XXX-mode "" :global t :init-value t ...)
(XXX-mode 1)

I don't argue that this new behaviour is good or bad.  At
least, it is not a bug if properly described in the
docstring of define-minor-mode.

---
Ken'ichi HANDA
address@hidden





reply via email to

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