Ensure that cus-load doesn't add things twice

* lisp/cus-dep.el (custom-make-dependencies): Use it.

* lisp/custom.el (custom--add-custom-loads): New function.
This commit is contained in:
Lars Ingebrigtsen 2022-09-24 12:15:58 +02:00
parent 126d5b23cf
commit 6403ede201
2 changed files with 8 additions and 4 deletions

View file

@ -175,10 +175,7 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS"
(prin1 (sort found #'string<))))
alist))))))
(dolist (e (sort alist (lambda (e1 e2) (string< (car e1) (car e2)))))
;; Don't overwrite elements added by packages.
(insert "(put '" (car e)
" 'custom-loads (append '" (cdr e)
" (get '" (car e) " 'custom-loads)))\n")))
(insert "(custom--add-custom-loads '" (car e) " '" (cdr e) ")\n")))
(insert "\
;; The remainder of this file is for handling :version.

View file

@ -1707,6 +1707,13 @@ If a choice with the same tag already exists, no action is taken."
(put variable 'custom-type
(append choices (list choice))))))
(defun custom--add-custom-loads (symbol loads)
;; Don't overwrite existing `custom-loads'.
(dolist (load (get symbol 'custom-loads))
(unless (memq load loads)
(push load loads)))
(put symbol 'custom-loads loads))
(provide 'custom)
;;; custom.el ends here