diff options
Diffstat (limited to 'lisp/custom.el')
| -rw-r--r-- | lisp/custom.el | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/custom.el b/lisp/custom.el index 885c486c5e4..db7f6a056d4 100644 --- a/lisp/custom.el +++ b/lisp/custom.el | |||
| @@ -1541,6 +1541,20 @@ Each of the arguments ARGS has this form: | |||
| 1541 | This means reset VARIABLE. (The argument IGNORED is ignored)." | 1541 | This means reset VARIABLE. (The argument IGNORED is ignored)." |
| 1542 | (apply #'custom-theme-reset-variables 'user args)) | 1542 | (apply #'custom-theme-reset-variables 'user args)) |
| 1543 | 1543 | ||
| 1544 | (defun custom-add-choice (variable choice) | ||
| 1545 | "Add CHOICE to the custom type of VARIABLE. | ||
| 1546 | If a choice with the same tag already exists, no action is taken." | ||
| 1547 | (let ((choices (get variable 'custom-type))) | ||
| 1548 | (unless (eq (car choices) 'choice) | ||
| 1549 | (error "Not a choice type: %s" choices)) | ||
| 1550 | (unless (seq-find (lambda (elem) | ||
| 1551 | (equal (caddr (member :tag elem)) | ||
| 1552 | (caddr (member :tag choice)))) | ||
| 1553 | (cdr choices)) | ||
| 1554 | ;; Put the new choice at the end. | ||
| 1555 | (put variable 'custom-type | ||
| 1556 | (append choices (list choice)))))) | ||
| 1557 | |||
| 1544 | ;;; The End. | 1558 | ;;; The End. |
| 1545 | 1559 | ||
| 1546 | (provide 'custom) | 1560 | (provide 'custom) |