From 5bee76514def9ca54c1bd52fb1a9c89ddfdab2ac Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 11 Jul 2026 12:24:01 -0500 Subject: fix(ui-theme): create persist/ before writing the saved theme cj/theme-write-file-contents guarded on file-writable-p, which returns nil when the target's directory doesn't exist. On a fresh machine persist/ isn't there yet, so the theme write failed silently and the choice never persisted. Create the parent directory first, and still return nil if the path isn't writable. --- modules/ui-theme.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/ui-theme.el b/modules/ui-theme.el index 499e71a4..b3cdc634 100644 --- a/modules/ui-theme.el +++ b/modules/ui-theme.el @@ -88,8 +88,14 @@ If FILENAME isn't readable, return nil." (string-trim (buffer-string))))) (defun cj/theme-write-file-contents (content filename) - "Write CONTENT to FILENAME. -If FILENAME isn't writeable, return nil. If successful, return t." + "Write CONTENT to FILENAME, creating its parent directory if absent. +On a fresh machine the `persist/' directory doesn't exist yet, and +`file-writable-p' returns nil for a file inside a missing directory, so the +write would silently fail. If FILENAME still isn't writeable, return nil. +If successful, return t." + (let ((dir (file-name-directory filename))) + (when (and dir (not (file-directory-p dir))) + (ignore-errors (make-directory dir t)))) (when (file-writable-p filename) (condition-case err (progn -- cgit v1.2.3