Respect doom-emacs modules conventions
This commit is contained in:
parent
3381cfb6ee
commit
99d60bd2ab
3 changed files with 36 additions and 16 deletions
16
autoload.el
Normal file
16
autoload.el
Normal file
|
@ -0,0 +1,16 @@
|
|||
;;; ui/zen-writer/autoload.el --- Zen Writer -*- lexical-binding: t; -*-
|
||||
|
||||
;; ensure to add custom themes for zen-writer
|
||||
|
||||
;;; Code:
|
||||
(require 'doom-themes)
|
||||
|
||||
;; load all custom themes of this package.
|
||||
|
||||
;;;###autoload
|
||||
(when (and (boundp 'custom-theme-load-path) load-file-name )
|
||||
(let* ((base (file-name-directory load-file-name))
|
||||
(dir (expand-file-name "themes/" base)))
|
||||
(add-to-list 'custom-theme-load-path
|
||||
(or (and (file-directory-p dir) dir)
|
||||
base))))
|
|
@ -1,4 +1,4 @@
|
|||
;;; zen-writer.el --- Zen Writer -*- lexical-binding: t; -*-
|
||||
;;; ui/zen-writer/config.el --- Zen Writer -*- lexical-binding: t; -*-
|
||||
|
||||
;; Copyright (C) 2021 Yann Esposito
|
||||
|
||||
|
@ -37,14 +37,6 @@
|
|||
(defvar doom-theme)
|
||||
(defvar custom-enabled-themes)
|
||||
|
||||
;;;###autoload
|
||||
(when (and (boundp 'custom-theme-load-path) load-file-name )
|
||||
(let* ((base (file-name-directory load-file-name))
|
||||
(dir (expand-file-name "themes/" base)))
|
||||
(add-to-list 'custom-theme-load-path
|
||||
(or (and (file-directory-p dir) dir)
|
||||
base))))
|
||||
|
||||
;; configuration
|
||||
(defvar zen-writer-light-theme 'doom-zen-writer
|
||||
"The theme for Zen Writer in light mode.")
|
||||
|
@ -52,7 +44,13 @@
|
|||
"The theme for Zen Writer in dark mode.")
|
||||
(defvar zen-writer-theme zen-writer-light-theme
|
||||
"The theme for Zen Writer when zen-auto-dark-theme is nil. By default it uses the light theme.")
|
||||
(defvar zen-writer-auto-dark-theme t)
|
||||
(defvar zen-writer-auto-dark-theme t
|
||||
"When true put dark-mode automatically depending on the hour of the day.")
|
||||
|
||||
(defvar zen-writer-morning-hour 7
|
||||
"Hour (24) at which we start using light theme. By default 7.")
|
||||
(defvar zen-writer-evening-hour 18
|
||||
"Hour (24) at which we start using dark theme. By default 18.")
|
||||
|
||||
(defvar zen-writer--pre-zen-doom-theme doom-theme)
|
||||
|
||||
|
@ -85,9 +83,11 @@
|
|||
"Depending on time and configuration use different theme."
|
||||
(if zen-writer-auto-dark-theme
|
||||
(let* ((hour (zen-writer-current-hour))
|
||||
(dark? (or (> hour 17) (< hour 7)))
|
||||
(theme (if dark? zen-writer-dark-theme zen-writer-light-theme)))
|
||||
(when (not (equal doom-theme theme))
|
||||
(day? (<= zen-writer-morning-hour
|
||||
hour
|
||||
zen-writer-evening-hour))
|
||||
(theme (if day? zen-writer-light-theme zen-writer-dark-theme)))
|
||||
(unless (equal doom-theme theme)
|
||||
(setq doom-theme theme)
|
||||
(load-theme doom-theme t))
|
||||
;; run that function again next hour
|
||||
|
@ -97,7 +97,7 @@
|
|||
|
||||
(defun zen-writer-on ()
|
||||
"Activate Zen Writer."
|
||||
(when (not zen-writer--pre-zen-doom-theme)
|
||||
(unless zen-writer--pre-zen-doom-theme
|
||||
;; save theme before enabling ZenWriter
|
||||
(setq zen-writer--pre-zen-doom-theme
|
||||
(or (when (and custom-enabled-themes (listp custom-enabled-themes))
|
||||
|
@ -141,8 +141,8 @@
|
|||
|
||||
(map! :leader
|
||||
(:prefix ("t W" . "Zen Writer")
|
||||
:desc "Full Zen Writer" "W" #'zen-writer-full-mode
|
||||
:desc "Zen Writer" "w" #'zen-writer-mode))
|
||||
:desc "Zen Writer Fullscreen" "W" #'zen-writer-full-mode
|
||||
:desc "Zen Writer Mode" "w" #'zen-writer-mode))
|
||||
|
||||
(provide 'zen-writer)
|
||||
;;; zen-writer.el ends here
|
4
packages.el
Normal file
4
packages.el
Normal file
|
@ -0,0 +1,4 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; ui/zen-writer/packages.el
|
||||
|
||||
(package! hl-sentence :pin "86ae38d3103bd20da5485cbdd59dfbd396c45ee4")
|
Loading…
Reference in a new issue