From b1c9b3cd9f079b5323dfb2fce4ca8d5f1d7e2590 Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Tue, 9 Nov 2021 12:03:47 +0100 Subject: [PATCH] follow doom convention --- README.org | 13 +------------ config.el | 38 +++++++++++--------------------------- 2 files changed, 12 insertions(+), 39 deletions(-) diff --git a/README.org b/README.org index 4881a64..9ded6ec 100644 --- a/README.org +++ b/README.org @@ -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. diff --git a/config.el b/config.el index 135f626..fc800f0 100644 --- a/config.el +++ b/config.el @@ -1,27 +1,11 @@ ;;; ui/zen-writer/config.el --- Zen Writer -*- lexical-binding: t; -*- -;; Copyright (C) 2021 Yann Esposito - ;; Author: Yann Esposito ;; 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 . ;;; 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 ()