emacs-devel
[Top][All Lists]
Advanced

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

Re: obsolete comment in tool-bar.el


From: Luc Teirlinck
Subject: Re: obsolete comment in tool-bar.el
Date: Thu, 14 Jul 2005 13:30:05 -0500 (CDT)

I have the impression that the offending code in define-minor-mode:

;; 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))))))))

combined with custom-initialize-default, is an ugly kludge to get around
a bug people sometimes make where they use functions or variables in a
:set function that are defined in the same file, but _after_ the defcustom.
That of course does not work and the obvious solution is to define
those functions and variables before the defcustom.

But I believe that define-minor-mode tries to hide this type of user
bug and work around it by delaying the enabling of the minor mode
function until after the file is loaded.

If this is the correct interpretation of the code, then that was a
silly thing to do, but now things may have come to rely on it.

Until we decide what to really do with this, I believe that the
following patch should at least allow Emacs CVS to be built on all
operating systems (but I can not test).  Rather than applying this
patch, I would rather get rid of the `eval-after-load' kludge
altogether, but if the patch works, it at least shows that we have
isolated the only real problem.

===File ~/easy-mmode-diff===================================
*** easy-mmode.el       14 Jul 2005 12:45:27 -0500      1.68
--- easy-mmode.el       14 Jul 2005 12:51:32 -0500      
***************
*** 264,271 ****
  
         ;; 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))))))))
  
  ;;;
  ;;; make global minor mode
--- 264,274 ----
  
         ;; If the mode is global, call the function according to the default.
         ,(if globalp
!           `(and load-file-name
!                 (eq (quote ,initialize)
!                     (quote (:initialize 'custom-initialize-default)))
!                 (not (equal ,init-value ,mode))
!                 (eval-after-load load-file-name '(,mode (if ,mode 1 -1))))))))
  
  ;;;
  ;;; make global minor mode
============================================================




reply via email to

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