follow doom convention

This commit is contained in:
Yann Esposito (Yogsototh) 2021-11-09 12:03:47 +01:00
parent 99d60bd2ab
commit b1c9b3cd9f
Signed by untrusted user who does not match committer: yogsototh
GPG Key ID: 7B19A4C650D59646
2 changed files with 12 additions and 39 deletions

View File

@ -4,18 +4,7 @@
* Zen Writer for emacs
A minor mode trying to achieve an enjoyable, focused writing experience.
See my article about what I am trying to achieve:
You can have an example about how it looks here:
[[https://her.esy.fun/posts/0021-ia-writer-clone-within-doom-emacs/index.html][iAWriter clone within doom-emacs]]
There is a nice video.
In the article I explain how I found it difficult to export just this
behavior.
I think this package achieved to do that.
To achieve the expected effect, I needed to create a specific theme.
To make the effect temporary, I need to keep track of the theme before
using this mode.
There are still inconsistency.
As the theme is global, and I would prefer to makes this mode minor.
Still this is not far away for the expected result.

View File

@ -1,27 +1,11 @@
;;; ui/zen-writer/config.el --- Zen Writer -*- lexical-binding: t; -*-
;; Copyright (C) 2021 Yann Esposito
;; Author: Yann Esposito <https://github.com/yogsototh>
;; Version: 0.0.1
;; Created: November 7, 2021
;; Keywords: custom themes, faces
;; Homepage: https://github.com/hlissner/emacs-doom-themes
;; Package-Requires: ((emacs "25.1") (cl-lib "0.5") (doom-themes "2.2.1") (hl-sentence "3"))
;; License: GPL v3.0
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
@ -38,18 +22,18 @@
(defvar custom-enabled-themes)
;; configuration
(defvar zen-writer-light-theme 'doom-zen-writer
(defvar +zen-writer-light-theme 'doom-zen-writer
"The theme for Zen Writer in light mode.")
(defvar zen-writer-dark-theme 'doom-zen-writer-dark
(defvar +zen-writer-dark-theme 'doom-zen-writer-dark
"The theme for Zen Writer in dark mode.")
(defvar zen-writer-theme zen-writer-light-theme
(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
(defvar +zen-writer-morning-hour 7
"Hour (24) at which we start using light theme. By default 7.")
(defvar zen-writer-evening-hour 18
(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)
@ -81,18 +65,18 @@
(defun zen-writer-select-theme ()
"Depending on time and configuration use different theme."
(if zen-writer-auto-dark-theme
(if +zen-writer-auto-dark-theme
(let* ((hour (zen-writer-current-hour))
(day? (<= zen-writer-morning-hour
(day? (<= +zen-writer-morning-hour
hour
zen-writer-evening-hour))
(theme (if day? zen-writer-light-theme zen-writer-dark-theme)))
+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
(run-at-time (format "%02d:%02d" (+ hour 1) 0) nil 'zen-writer-select-theme))
(setq doom-theme zen-writer-theme)
(setq doom-theme +zen-writer-theme)
(load-theme doom-theme t)))
(defun zen-writer-on ()