emacs-pretest-bug
[Top][All Lists]
Advanced

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

Sorting in custom-set-variables doesn't work for minor modes (was: Custo


From: Luc Van Eycken
Subject: Sorting in custom-set-variables doesn't work for minor modes (was: Customizing recentf-save-file doesn't work properly)
Date: Tue, 9 Aug 2005 11:47:23 +0200

In a previous bug report
<http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-08/msg00016.html>
I wrote:
 > When customizing both recentf-mode and recentf-save-file, the customized
 > value of recentf-save-file is not used for loading the list of recent files.
 > ... options are saved in alphabetic order, so recentf-mode is enabled
 > and the list is loaded before the customized value of recentf-save-file
 > takes effect ...
 > Note: this bug is not present Emacs 21.4.

Further investigation revealed that the actual cause of the bug is the
modification of define-minor-mode in easy-mmode.el dated June 26 by
Stefan Monnier. The reasoning behind this modification is explained in
<http://lists.gnu.org/archive/html/emacs-devel/2005-06/msg00912.html> and
it was approved by Richard Stallman in
<http://lists.gnu.org/archive/html/emacs-devel/2005-06/msg01159.html>. 

The :require was not only used as a side effect in autoload.el, but also in
function custom-theme-set-variables of custom.el. Quoting from it:

        ;; Put symbols with :require last.  The macro
        ;; define-minor-mode generates a defcustom
        ;; with a :require and a :set, where the
        ;; setter function calls the mode function.
        ;; Putting symbols with :require last ensures
        ;; that the mode function will see other
        ;; customized values rather than default
        ;; values.

Since the :require is no longer present by default for minor modes, the
minor mode can be established before its variables get their customized
value, resulting in the bug described in my previous bug report.

A possible solution is given in the patch below. It uses the same reasoning
as used in the patch for autoload.el by Stefan Monnier: test for
custom-set-minor-mode as setter function.

By the way, I think that easy-mmode.el can be simplified by removing the
defintion of and reference to curfile, since its value seems irrelevant
after the June 26 patch.

Best regards,

Luc Van Eycken


*** custom.el.orig      Thu Aug  4 15:17:26 2005
--- custom.el   Tue Aug  9 10:56:14 2005
***************
*** 726,740 ****
                         (error "Circular custom dependency between `%s' and 
`%s'"
                                sym1 sym2))
                        (2-then-1 nil)
!                       ;; Put symbols with :require last.  The macro
!                       ;; define-minor-mode generates a defcustom
!                       ;; with a :require and a :set, where the
!                       ;; setter function calls the mode function.
!                       ;; Putting symbols with :require last ensures
!                       ;; that the mode function will see other
!                       ;; customized values rather than default
!                       ;; values.
!                       (t (nth 3 a2)))))))
    (while args
      (let ((entry (car args)))
        (if (listp entry)
--- 726,738 ----
                         (error "Circular custom dependency between `%s' and 
`%s'"
                                sym1 sym2))
                        (2-then-1 nil)
!                       ;; Put symbols with :set 'custom-set-minor-mode last.
!                       ;; The macro define-minor-mode generates a defcustom
!                       ;; with this :set value. Putting these symbols last
!                       ;; ensures that the mode function will see other
!                       ;; customized values rather than default values.
!                       (t (eq (get sym2 'custom-set)
!                              'custom-set-minor-mode)))))))
    (while args
      (let ((entry (car args)))
        (if (listp entry)




reply via email to

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