From 61e4250ae32744e5434c8faef7d059c7b157f81a Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 1 Aug 2023 10:41:16 -0700 Subject: [PATCH] =?UTF-8?q?Add=20=E2=80=98yoshi-mode-line=E2=80=99=20modul?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is an experiment to see if I can customize the mode-line in a nice way. --- CHANGELOG.org | 4 ++ README.org | 4 ++ icons/file-circle-minus-solid.svg | 1 + icons/file-code-solid.svg | 1 + icons/file-lines-solid.svg | 1 + icons/file-pen-solid.svg | 1 + icons/file-shield-solid.svg | 1 + icons/file-solid.svg | 1 + icons/folder-open-solid.svg | 1 + icons/folder-solid.svg | 1 + icons/terminal-solid.svg | 1 + yoshi-mode-line.el | 66 +++++++++++++++++++++++++++++++ yoshi-theme.el | 14 ------- 13 files changed, 83 insertions(+), 14 deletions(-) create mode 100644 icons/file-circle-minus-solid.svg create mode 100644 icons/file-code-solid.svg create mode 100644 icons/file-lines-solid.svg create mode 100644 icons/file-pen-solid.svg create mode 100644 icons/file-shield-solid.svg create mode 100644 icons/file-solid.svg create mode 100644 icons/folder-open-solid.svg create mode 100644 icons/folder-solid.svg create mode 100644 icons/terminal-solid.svg create mode 100644 yoshi-mode-line.el diff --git a/CHANGELOG.org b/CHANGELOG.org index 6087014..90d3ef8 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -10,6 +10,10 @@ This project adheres to [[http://semver.org][Semantic Versioning]]. * COMMENT [[https://github.com/ryuslash/yoshi-theme/compare/v7.0.0...HEAD][Unreleased]] +** REMOVED Hacks for the mode-line + +** ADDED Custom mode-line module yoshi-mode-line + * [[https://github.com/ryuslash/yoshi-theme/compare/v6.2.0...v7.0.0][7.0.0]] -- 2023-08-01 :PROPERTIES: :CUSTOM_ID: release-7.0.0 diff --git a/README.org b/README.org index fdbbb15..33511fd 100644 --- a/README.org +++ b/README.org @@ -82,6 +82,10 @@ Once you've installed Yoshi theme you can either use =M-x load-theme= to enable (load-theme 'yoshi :no-confirm) #+END_SRC +*** Other modules + +- yoshi-mode-line :: Enable this by calling ~(require 'yoshi-mode-line)~. This module enables the mode-line as is intended to be used with Yoshi theme. + ** Installation in Spacemacs Edit your .spacemacs file ~(SPC f e d)~ and add the ~yoshi-theme~ package: diff --git a/icons/file-circle-minus-solid.svg b/icons/file-circle-minus-solid.svg new file mode 100644 index 0000000..079729f --- /dev/null +++ b/icons/file-circle-minus-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/file-code-solid.svg b/icons/file-code-solid.svg new file mode 100644 index 0000000..1ff6c5f --- /dev/null +++ b/icons/file-code-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/file-lines-solid.svg b/icons/file-lines-solid.svg new file mode 100644 index 0000000..db6b0df --- /dev/null +++ b/icons/file-lines-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/file-pen-solid.svg b/icons/file-pen-solid.svg new file mode 100644 index 0000000..2a6ba42 --- /dev/null +++ b/icons/file-pen-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/file-shield-solid.svg b/icons/file-shield-solid.svg new file mode 100644 index 0000000..cbe717e --- /dev/null +++ b/icons/file-shield-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/file-solid.svg b/icons/file-solid.svg new file mode 100644 index 0000000..74f3d8a --- /dev/null +++ b/icons/file-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/folder-open-solid.svg b/icons/folder-open-solid.svg new file mode 100644 index 0000000..403c036 --- /dev/null +++ b/icons/folder-open-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/folder-solid.svg b/icons/folder-solid.svg new file mode 100644 index 0000000..7e67ae8 --- /dev/null +++ b/icons/folder-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/icons/terminal-solid.svg b/icons/terminal-solid.svg new file mode 100644 index 0000000..75449ee --- /dev/null +++ b/icons/terminal-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/yoshi-mode-line.el b/yoshi-mode-line.el new file mode 100644 index 0000000..0113765 --- /dev/null +++ b/yoshi-mode-line.el @@ -0,0 +1,66 @@ +;;; yoshi-mode-line.el --- Custom mode-line settings for Yoshi theme -*- lexical-binding: t; -*- + +;; Copyright (C) 2023 Tom Willemse + +;; Author: Tom Willemse +;; Keywords: + +;; 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: + +;; This module defines the mode-line that is meant to be used with with the +;; ‘yoshi-theme’ theme. This module is heavily inspired by the ‘nano-modeline’ +;; module from the ‘nano-emacs’ project. + +;;; Code: + +(defconst yoshi-mode-line-root + (file-name-directory + (or load-file-name + (buffer-file-name))) + "The directory where ‘yoshi-mode-line’ was loaded from.") + +(defconst yoshi-mode-line-icons-dir + (expand-file-name "icons" yoshi-mode-line-root) + "The directory where ‘yoshi-mode-line’ stores its icons.") + +;;; These files were all downloaded from the Font Awesome website. +(defun yoshi-mode-line-buffer-status-display () + "Display an icon for the status of the buffer." + (cond + ((derived-mode-p 'comint-mode 'eshell-mode) + (propertize "term" 'display `(image :type svg :file ,(expand-file-name "terminal-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height)))) + ((derived-mode-p 'wdired-mode) + (propertize "wdired" 'display `(image :type svg :file ,(expand-file-name "folder-open-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height)))) + ((derived-mode-p 'dired-mode) + (propertize "dired" 'display `(image :type svg :file ,(expand-file-name "folder-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height)))) + ((null buffer-file-name) + (propertize "no-file" 'display `(image :type svg :file ,(expand-file-name "file-circle-minus-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height)))) + ((buffer-modified-p) + (propertize "modified" 'display `(image :type svg :file ,(expand-file-name "file-pen-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height)))) + (buffer-read-only + (propertize "read-only" 'display `(image :type svg :file ,(expand-file-name "file-shield-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height)))) + ((derived-mode-p 'prog-mode) + (propertize "code" 'display `(image :type svg :file ,(expand-file-name "file-code-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height)))) + ((derived-mode-p 'text-mode) + (propertize "text" 'display `(image :type svg :file ,(expand-file-name "file-lines-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height)))) + (t + (propertize "read-write" 'display `(image :type svg :file ,(expand-file-name "file-solid.svg" yoshi-mode-line-icons-dir) :ascent center :height ,(window-default-font-height)))))) + +(setq-default mode-line-format + `("%e" mode-line-front-space (:eval (yoshi-mode-line-buffer-status-display)) ,@(cdr (default-value 'mode-line-format)))) + +(provide 'yoshi-mode-line) +;;; yoshi-mode-line.el ends here diff --git a/yoshi-theme.el b/yoshi-theme.el index 79d22ef..be8440c 100644 --- a/yoshi-theme.el +++ b/yoshi-theme.el @@ -32,20 +32,6 @@ (deftheme yoshi "Created 2012-09-24") -(defun yoshi-theme-add-space-to-first-arg (args) - "Return ARGS with the car modified to contain 2 spaces." - (cons (format " %s " (car args)) (cdr args))) - -(defun yoshi-theme-add-spaces-around-current-info-node (func &rest args) - (let ((Info-current-node (format " %s " Info-current-node))) - (apply func args))) - -(advice-add 'propertized-buffer-identification - :filter-args #'yoshi-theme-add-space-to-first-arg) - -(advice-add 'Info-set-mode-line - :around #'yoshi-theme-add-spaces-around-current-info-node) - (defun yoshi-theme--make-inline-box (border-color) "Return a list representing a box specification using BORDER-COLOR." (let ((line-width (if (> emacs-major-version 27)