summaryrefslogtreecommitdiff
path: root/modules/ui-theme.el
diff options
context:
space:
mode:
authorCraig Jennings <craigmartinjennings@gmail.com>2024-04-11 01:39:11 -0500
committerCraig Jennings <craigmartinjennings@gmail.com>2024-04-11 01:39:11 -0500
commit07fd4f1a6930dc62880b0fd7a0496270f4c2efd6 (patch)
tree31c37427859b391dd8dcad9abc2f4f3515f072b5 /modules/ui-theme.el
parenta55a5248bd2dae5f849476d0f7b5dcd8d91cf929 (diff)
more fit and finish work
User Constants - move all file and directory constants into it's own file - create the directories and files if they don't exist - warn the user when not found/created General - remove duplicate dirvish go menu entry - remove xterm color in test code (it's already in eshell) - fixed org-drill not starting - fixing issue with auto-complete not working in eshell - adding playlists location for dirvish - moved all org-drill config into the use-package declaration - added drill-dir to user-constants - default ledger-file location changed; updated tasks - git ignore the persist folder - added more point values in fontaine menu - fix for gptel early key grab in authinfo.gpg - removed localrepo from reset script - remove magit-forge package - don't wait too long to bury-buffers - add setting native compile warnings to 'silent - fixed sdcv errors when looking up a word normally and in nov
Diffstat (limited to 'modules/ui-theme.el')
-rw-r--r--modules/ui-theme.el28
1 files changed, 15 insertions, 13 deletions
diff --git a/modules/ui-theme.el b/modules/ui-theme.el
index 609acab3..8d544f9f 100644
--- a/modules/ui-theme.el
+++ b/modules/ui-theme.el
@@ -60,7 +60,7 @@ If FILENAME isn't readable, return nil."
(with-temp-buffer
(insert-file-contents filename)
(buffer-string))
- 'nil))
+ nil))
(defun cj/write-file-contents (content filename)
"Write CONTENT to FILENAME.
@@ -70,8 +70,8 @@ If FILENAME isn't writeable, return nil. If successful, return t."
(with-temp-buffer
(insert content)
(write-file filename))
- 't)
- 'nil))
+ t)
+ nil))
(defun cj/get-active-theme-name ()
"Return the name of the active UI theme as a string."
@@ -79,7 +79,7 @@ If FILENAME isn't writeable, return nil. If successful, return t."
(defun cj/save-theme-to-file ()
"Save the string representing the current theme to the theme-file."
- (if (equal (cj/write-file-contents (cj/get-active-theme-name) theme-file) 'nil)
+ (if (equal (cj/write-file-contents (cj/get-active-theme-name) theme-file) nil)
(message "Cannot save theme: %s is unwriteable" theme-file)
(message "%s theme saved to %s" (cj/get-active-theme-name) theme-file)))
@@ -94,15 +94,17 @@ Used to handle errors with loading persisted theme."
If the theme is nil, it disables all current themes. If an error occurs
loading the file name, the fallback-theme-name is applied and saved."
(let ((theme-name (cj/read-file-contents theme-file)))
- ;; if theme-name is nil, unload all themes
- (if (string= theme-name "nil")
- (mapcar #'disable-theme custom-enabled-themes)
- ;; apply theme name or if error, load fallback theme
- (progn
- (condition-case err
- (load-theme (intern theme-name) t)
- (error
- (cj/load-fallback-theme (concat "Error loading " theme-name "."))))))))
+ ;; if theme-name is nil, unload all themes and load fallback theme
+ (if (or (string= theme-name "nil") (not theme-name))
+ (progn
+ (mapcar #'disable-theme custom-enabled-themes)
+ (cj/load-fallback-theme "Theme file not found or theme name in it is nil."))
+ ;; apply theme name or if error, load fallback theme
+ (condition-case err
+ (load-theme (intern theme-name) t)
+ (error
+ (cj/load-fallback-theme (concat "Error loading " theme-name
+ ".")))))))
(cj/load-theme-from-file)