diff --git a/lisp/fix-theme-colors.el b/lisp/fix-theme-colors.el index d70da0c..560d027 100644 --- a/lisp/fix-theme-colors.el +++ b/lisp/fix-theme-colors.el @@ -157,6 +157,14 @@ content)) (setq changes (1+ changes))))) + ;; Fix :family inside :box (invalid property) + (when (string-match ":box (\\([^)]+\\):family \"[^\"]+\"\\([^)]*\\))" content) + (setq content (replace-regexp-in-string + ":box (\\([^)]+\\):family \"[^\"]+\"\\([^)]*\\))" + ":box (\\1\\2)" + content)) + (setq changes (1+ changes))) + (with-temp-file filepath (insert content)) (message " Fixed %d issue(s)" changes) @@ -179,16 +187,32 @@ (setq count (1+ count))) (message "Removed %d compiled theme files (.elc)" count))) -;; Main execution -(let* ((themes-dir (expand-file-name "~/.emacs.d/straight/repos/replace-colorthemes/")) - (build-dir (expand-file-name "~/.emacs.d/straight/build/color-theme-modern/"))) - - (if (file-directory-p themes-dir) - (progn - (fix-all-themes themes-dir) - (when (file-directory-p build-dir) - (remove-compiled-themes build-dir)) - (message "\nDone! Restart Emacs to load fixed themes.")) - (error "Themes directory not found: %s" themes-dir))) +;;;###autoload +(defun fix-theme-colors () + "Fix invalid color names and properties in Emacs themes. +This function can be called interactively or from Lisp." + (interactive) + (let* ((themes-dir (expand-file-name "~/.emacs.d/straight/repos/replace-colorthemes/")) + (build-dir (expand-file-name "~/.emacs.d/straight/build/color-theme-modern/"))) + + (if (file-directory-p themes-dir) + (progn + (fix-all-themes themes-dir) + (when (file-directory-p build-dir) + (remove-compiled-themes build-dir)) + (message "\nDone! Restart Emacs to load fixed themes.")) + (error "Themes directory not found: %s" themes-dir)))) +;; When run as a script (--script), execute the function +(when noninteractive + (fix-theme-colors)) + +;;;###autoload +(defun fix-theme-colors-add-to-load-path () + "Add the directory containing this file to load-path." + (interactive) + (add-to-list 'load-path (file-name-directory load-file-name)) + (message "Added %s to load-path" (file-name-directory load-file-name))) + +(provide 'fix-theme-colors) ;;; fix-theme-colors.el ends here diff --git a/lisp/init-kbd.el b/lisp/init-kbd.el index 6e0d85d..a0933ef 100644 --- a/lisp/init-kbd.el +++ b/lisp/init-kbd.el @@ -342,7 +342,6 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog (local-set-key (kbd "") 'emms-previous) (local-set-key (kbd "") 'emms-next))) - (defun switch-to-emms-playlist() "Switch to emms playlist." (interactive) @@ -351,7 +350,6 @@ Disable jinx-mode if it's enable and global-jinx-mode is disable , otherwise tog (global-set-key (kbd "C-c m d") 'my-emms-play-directory) - (provide 'init-kbd) ;;; init-kbd.el ends here