Subject: 23.0.60; Bug in custom-set-variables sorting
From: "Lennart Borgman" <[email-masked]>
To: [email-masked]
Date: Fri, 9 Jan 2009 21:55:55 +0100

I believe there is a bug the sorting routine in
custom-theme-set-variables. The comparision of two symbols does not
take the dependency list in account if the symbols compared are not
mentioned in their dependency list. However that breaks, eh, what do
you call it ..., transity.

In other words if one of the two symbols compared has a dependency
list and the other not then the first symbols must be sorted after the
second. It should look something like this:

  ;; Move minor modes and variables with explicit requires to the end.
  (setq args
	(sort args
	      (lambda (a1 a2)
		(let* ((sym1 (car a1))
		       (sym2 (car a2))
		       (dep1 (get sym1 'custom-dependencies))
		       (dep2 (get sym2 'custom-dependencies))
		       (1-then-2 (memq sym1 dep2))
		       (2-then-1 (memq sym2 dep1)))
		  (cond ((and 1-then-2 2-then-1)
			 (error "Circular custom dependency between `%s' and `%s'"
				sym1 sym2))
			(2-then-1 nil)
			;; 1 is a dependency of 2, so needs to be set first.
			1-then-2
			;; Put minor modes and symbols with :require last.
			;; Putting minor modes last ensures that the mode
			;; function will see other customized values rather
			;; than default values.
			(t (or (and dep2 (not dep1))
                               (nth 3 a2)
                               (eq (get sym2 'custom-set)
                                   'custom-set-minor-mode))))))))

In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
 of 2009-01-04
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags
-Ic:/g/include -fno-crossjumping'