Add optional argument to silence message in ef-themes-rotate

This commit is contained in:
Sean Devlin 2025-08-05 10:33:05 -05:00
parent 519972131e
commit 137147a257

View file

@ -739,20 +739,24 @@ symbol."
(error "Cannot determine a theme among `%s'" themes)))
;;;###autoload
(defun ef-themes-rotate (themes)
(defun ef-themes-rotate (themes &optional silent)
"Rotate to the next theme among THEMES.
When called interactively THEMES is the value of `ef-themes-to-rotate'.
If the current theme is already the next in line, then move to the one
after. Perform the rotation rightwards, such that the first element in
the list becomes the last. Do not modify THEMES in the process."
the list becomes the last. Do not modify THEMES in the process.
Print the name of the new theme, unless optional argument SILENT is
non-nil."
(interactive (list ef-themes-to-rotate))
(unless (proper-list-p themes)
"This is not a list of themes: `%s'" themes)
(let ((candidate (ef-themes--rotate-p themes)))
(if (ef-themes--ef-p candidate)
(progn
(message "Rotating to `%s'" (propertize (symbol-name candidate) 'face 'success))
(unless silent
(message "Rotating to `%s'" (propertize (symbol-name candidate) 'face 'success)))
(ef-themes-load-theme candidate))
(user-error "`%s' is not part of the Ef collection" candidate))))