branch: externals/gnome-dark-style commit a2e9248ea09776c13966d8181d3f2078e9a1c7ba Author: dimagid <dimagi...@gmail.com> Commit: dimagid <dimagi...@gmail.com>
Simplify .dir-locals.el and format gnome-dark-style.el --- .dir-locals.el | 51 +-------------------------------------------------- gnome-dark-style.el | 32 ++++++++++++++++++++------------ 2 files changed, 21 insertions(+), 62 deletions(-) diff --git a/.dir-locals.el b/.dir-locals.el index af92eac5bb..57b3d58e92 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -4,53 +4,4 @@ ((nil . ((tab-width . 8) (sentence-end-double-space . t) (fill-column . 72) - (emacs-lisp-docstring-fill-column . 72) - (vc-git-annotate-switches . "-w") - (bug-reference-url-format . "https://debbugs.gnu.org/%s") - (diff-add-log-use-relative-names . t) - (etags-regen-regexp-alist - . - ((("c" "objc") . - ("/[ \t]*DEFVAR_[A-Z_ \t(]+\"\\([^\"]+\\)\"/\\1/" - "/[ \t]*DEFVAR_[A-Z_ \t(]+\"[^\"]+\",[ \t]\\([A-Za-z0-9_]+\\)/\\1/")))) - (etags-regen-ignores . ("test/manual/etags/")) - (vc-prepare-patches-separately . nil) - (vc-default-patch-addressee . "bug-gnu-em...@gnu.org"))) - (c-mode . ((c-file-style . "GNU") - (c-noise-macro-names . ("INLINE" "NO_INLINE" "ATTRIBUTE_NO_SANITIZE_UNDEFINED" - "ATTRIBUTE_NO_SANITIZE_ADDRESS" - "UNINIT" "CALLBACK" "ALIGN_STACK" "ATTRIBUTE_MALLOC" - "ATTRIBUTE_DEALLOC_FREE" "ANDROID_EXPORT" "TEST_STATIC" - "INLINE_HEADER_BEGIN" "INLINE_HEADER_END")) - (electric-quote-comment . nil) - (electric-quote-string . nil) - (indent-tabs-mode . t) - (mode . bug-reference-prog))) - (java-mode . ((c-file-style . "GNU") - (electric-quote-comment . nil) - (electric-quote-string . nil) - (indent-tabs-mode . t) - (mode . bug-reference-prog))) - (objc-mode . ((c-file-style . "GNU") - (electric-quote-comment . nil) - (electric-quote-string . nil) - (indent-tabs-mode . t) - (mode . bug-reference-prog))) - (c-ts-mode . ((c-ts-mode-indent-style . gnu))) ;Inherits `c-mode' settings. - (log-edit-mode . ((log-edit-font-lock-gnu-style . t) - (log-edit-setup-add-author . t) - (vc-git-log-edit-summary-target-len . 50) - (fill-column . 64))) - (change-log-mode . ((add-log-time-zone-rule . t) - (fill-column . 74) - (mode . bug-reference))) - (diff-mode . ((mode . whitespace))) - (emacs-lisp-mode . ((indent-tabs-mode . nil) - (electric-quote-comment . nil) - (electric-quote-string . nil) - (mode . bug-reference-prog))) - (lisp-data-mode . ((indent-tabs-mode . nil))) - (texinfo-mode . ((electric-quote-comment . nil) - (electric-quote-string . nil) - (mode . bug-reference-prog))) - (outline-mode . ((mode . bug-reference)))) + (emacs-lisp-docstring-fill-column . 72)))) diff --git a/gnome-dark-style.el b/gnome-dark-style.el index d618854e63..13a95583b8 100644 --- a/gnome-dark-style.el +++ b/gnome-dark-style.el @@ -1,11 +1,11 @@ -;;; gnome-dark-style.el --- Sync theme with GNOME color-scheme -*- lexical-binding: t; -*- +;;; gnome-dark-style.el --- Sync theme with GNOME color-scheme -*- lexical-binding: t; -*- ;; Copyright (C) 2025 Free Software Foundation, Inc. ;; Author: David Dimagid <davidima...@gmail.com> ;; Maintainer: David Dimagid <davidima...@gmail.com> -;; Version: 0.2.2 -;; Package-Version: 0.2.2 +;; Version: 0.2.3 +;; Package-Version: 0.2.3 ;; URL: https://github.com/dimagid/gnome-dark-style ;; Package-Requires: ((emacs "30.1")) ;; Keywords: themes, gnome, sync, dark, light, color-scheme @@ -68,19 +68,22 @@ If `gsettings' is not available, warn the user and return nil." (interactive) (let* ((gnome-color-scheme (get-gnome-color-scheme)) (target-theme (cond - ((string-match-p "default" gnome-color-scheme) + ((string-match-p "default" + gnome-color-scheme) gnome-light-theme) - ((string-match-p "prefer-light" gnome-color-scheme) + ((string-match-p "prefer-light" + gnome-color-scheme) gnome-light-theme) (t gnome-dark-theme)))) (mapc #'disable-theme custom-enabled-themes) (setq custom-enabled-themes nil) ;; Load the target theme (if not nil) (when target-theme - (condition-case err + (condition-case _ (load-theme target-theme t) (error - (message "Warning: Theme `%s' not found. Using default." target-theme)))))) + (message "Warning: Theme `%s' not found. Using default." + target-theme)))))) ;;;###autoload (defun gnome-start-color-scheme-monitor () @@ -89,8 +92,10 @@ If `gsettings' is not available, warn the user and return nil." (gnome-stop-color-scheme-monitor) (let ((process (make-process :name "gsettings-monitor" - :command '("gsettings" "monitor" "org.gnome.desktop.interface" "color-scheme") - :filter (lambda (process output) + :command '("gsettings" "monitor" + "org.gnome.desktop.interface" + "color-scheme") + :filter (lambda (_ output) (when (string-match-p "color-scheme" output) (gnome-set-theme-based-on-color-scheme)))))) ;; Mark the process as non-queryable on exit @@ -116,16 +121,19 @@ Manages a hook to stop monitoring on Emacs exit." ;; Only set the theme if it's different from the current one (let* ((gnome-color-scheme (get-gnome-color-scheme)) (target-theme (cond - ((string-match-p "default" gnome-color-scheme) + ((string-match-p "default" + gnome-color-scheme) gnome-light-theme) - ((string-match-p "prefer-light" gnome-color-scheme) + ((string-match-p "prefer-light" + gnome-color-scheme) gnome-light-theme) (t gnome-dark-theme)))) (unless (member target-theme custom-enabled-themes) (gnome-set-theme-based-on-color-scheme)))) (when current-state (gnome-stop-color-scheme-monitor) - (remove-hook 'kill-emacs-hook #'gnome-stop-color-scheme-monitor))))) + (remove-hook 'kill-emacs-hook + #'gnome-stop-color-scheme-monitor))))) ;;;###autoload (defcustom gnome-dark-style-sync t