aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2022-09-24 12:15:58 +0200
committerLars Ingebrigtsen2022-09-24 12:15:58 +0200
commit6403ede2016d0d16a487d759ef45745c3d4ac24b (patch)
tree6bf274093bad0dcf860a987eb14b0be53c0cc4f4
parent126d5b23cf252ceae537a686e46ba86c0591e658 (diff)
downloademacs-6403ede2016d0d16a487d759ef45745c3d4ac24b.tar.gz
emacs-6403ede2016d0d16a487d759ef45745c3d4ac24b.zip
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.
-rw-r--r--lisp/cus-dep.el5
-rw-r--r--lisp/custom.el7
2 files changed, 8 insertions, 4 deletions
diff --git a/lisp/cus-dep.el b/lisp/cus-dep.el
index 163a2da1f12..3f18202affe 100644
--- a/lisp/cus-dep.el
+++ b/lisp/cus-dep.el
@@ -175,10 +175,7 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS"
175 (prin1 (sort found #'string<)))) 175 (prin1 (sort found #'string<))))
176 alist)))))) 176 alist))))))
177 (dolist (e (sort alist (lambda (e1 e2) (string< (car e1) (car e2))))) 177 (dolist (e (sort alist (lambda (e1 e2) (string< (car e1) (car e2)))))
178 ;; Don't overwrite elements added by packages. 178 (insert "(custom--add-custom-loads '" (car e) " '" (cdr e) ")\n")))
179 (insert "(put '" (car e)
180 " 'custom-loads (append '" (cdr e)
181 " (get '" (car e) " 'custom-loads)))\n")))
182 (insert "\ 179 (insert "\
183 180
184;; The remainder of this file is for handling :version. 181;; The remainder of this file is for handling :version.
diff --git a/lisp/custom.el b/lisp/custom.el
index 352b5b0e160..604b1a3ff48 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -1707,6 +1707,13 @@ If a choice with the same tag already exists, no action is taken."
1707 (put variable 'custom-type 1707 (put variable 'custom-type
1708 (append choices (list choice)))))) 1708 (append choices (list choice))))))
1709 1709
1710(defun custom--add-custom-loads (symbol loads)
1711 ;; Don't overwrite existing `custom-loads'.
1712 (dolist (load (get symbol 'custom-loads))
1713 (unless (memq load loads)
1714 (push load loads)))
1715 (put symbol 'custom-loads loads))
1716
1710(provide 'custom) 1717(provide 'custom)
1711 1718
1712;;; custom.el ends here 1719;;; custom.el ends here