From d4f4c50cbbe019e8e4325b30086d758aceaacca8 Mon Sep 17 00:00:00 2001 From: Farlado Date: Sun, 15 Mar 2020 20:09:11 -0400 Subject: [PATCH 1/4] Fix file header and emacs version dependency --- mood-line.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mood-line.el b/mood-line.el index c510768..a85f0a7 100644 --- a/mood-line.el +++ b/mood-line.el @@ -1,10 +1,10 @@ -;;; mood-line.el --- A minimal mode-line inspired by doom-modeline. -*- lexical-binding: t; -*- +;;; mood-line.el --- A minimal mode-line inspired by doom-modeline -*- lexical-binding: t; -*- ;; Author: Jessie Hildebrandt ;; Homepage: https://gitlab.com/jessieh/mood-line ;; Keywords: mode-line faces ;; Version: 1.2.1 -;; Package-Requires: ((emacs "24.4")) +;; Package-Requires: ((emacs "25.1")) ;; This file is not part of GNU Emacs. From 70295f52a5991952e2f088324b59f2bd7ac5089f Mon Sep 17 00:00:00 2001 From: Farlado Date: Sun, 15 Mar 2020 20:10:53 -0400 Subject: [PATCH 2/4] Provide faces for buffer name and major mode --- mood-line.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mood-line.el b/mood-line.el index a85f0a7..91c5bad 100644 --- a/mood-line.el +++ b/mood-line.el @@ -86,6 +86,15 @@ :group 'mood-line :type 'boolean) +(defface mood-line-buffer-name + '((t (:inherit (mode-line-buffer-id)))) + :group 'mood-line) + +(defface mood-line-major-mode + '((t (:inherit (bold)))) + "Face used for major mode indicator in the mode-line." + :group 'mood-line) + (defface mood-line-status-neutral '((t (:inherit (shadow)))) "Face used for neutral or inactive status indicators in the mode-line." @@ -218,7 +227,7 @@ (defun mood-line-segment-buffer-name () "Displays the name of the current buffer in the mode-line." - (propertize "%b " 'face 'mode-line-buffer-id)) + (propertize "%b " 'face 'mood-line-buffer-name)) (defun mood-line-segment-anzu () "Displays color-coded anzu status information in the mode-line (if available)." @@ -265,7 +274,7 @@ (defun mood-line-segment-major-mode () "Displays the current major mode in the mode-line." - (propertize "%m " 'face 'bold)) + (propertize "%m " 'face 'mood-line-major-mode)) (defun mood-line-segment-misc-info () "Displays the current value of `mode-line-misc-info' in the mode-line." From 1e0bd0425f082d866a59f345a62b353e35c8a46e Mon Sep 17 00:00:00 2001 From: Farlado Date: Sun, 15 Mar 2020 20:16:46 -0400 Subject: [PATCH 3/4] Conform to function naming conventions --- mood-line.el | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mood-line.el b/mood-line.el index 91c5bad..36e82d8 100644 --- a/mood-line.el +++ b/mood-line.el @@ -134,23 +134,23 @@ ;; Helper functions ;; -(defun --string-trim-left (string) +(defun mood-line--string-trim-left (string) "Remove whitespace at the beginning of STRING." (if (string-match "\\`[ \t\n\r]+" string) (replace-match "" t t string) string)) -(defun --string-trim-right (string) +(defun mood-line--string-trim-right (string) "Remove whitespace at the end of STRING." (if (string-match "[ \t\n\r]+\\'" string) (replace-match "" t t string) string)) -(defun --string-trim (string) +(defun mood-line--string-trim (string) "Remove whitespace at the beginning and end of STRING." - (--string-trim-left (--string-trim-right string))) + (mood-line--string-trim-left (mood-line--string-trim-right string))) -(defun --format-mood-line (left right) +(defun mood-line--format (left right) "Return a string of `window-width' length containing LEFT and RIGHT, aligned respectively." (let ((reserve (length right))) (concat left @@ -280,7 +280,7 @@ "Displays the current value of `mode-line-misc-info' in the mode-line." (let ((misc-info (format-mode-line mode-line-misc-info 'mood-line-unimportant))) (unless (string= misc-info "") - (concat (--string-trim misc-info) " ")))) + (concat (mood-line--string-trim misc-info) " ")))) (defun mood-line-segment-flycheck () "Displays color-coded flycheck information in the mode-line (if available)." @@ -289,12 +289,12 @@ (defun mood-line-segment-flymake () "Displays information about the current status of flymake in the mode-line (if available)." (when (and (boundp 'flymake-mode) flymake-mode) - (concat (--string-trim (format-mode-line flymake--mode-line-format)) " "))) + (concat (mood-line--string-trim (format-mode-line flymake--mode-line-format)) " "))) (defun mood-line-segment-process () "Displays the current value of `mode-line-process' in the mode-line." (when mode-line-process - (concat (--string-trim (format-mode-line mode-line-process)) " "))) + (concat (mood-line--string-trim (format-mode-line mode-line-process)) " "))) ;; ;; Activation function @@ -324,7 +324,7 @@ ;; Set the new mode-line-format (setq-default mode-line-format '((:eval - (--format-mood-line + (mood-line--format ;; Left (format-mode-line '(" " From b39de8a32505fd59283d5bca60129a914a8296da Mon Sep 17 00:00:00 2001 From: Farlado Date: Tue, 17 Mar 2020 06:53:11 -0400 Subject: [PATCH 4/4] Add a forgotten docstring --- mood-line.el | 1 + 1 file changed, 1 insertion(+) diff --git a/mood-line.el b/mood-line.el index 36e82d8..349d683 100644 --- a/mood-line.el +++ b/mood-line.el @@ -88,6 +88,7 @@ (defface mood-line-buffer-name '((t (:inherit (mode-line-buffer-id)))) + "Face used for major mode indicator in the mode-line." :group 'mood-line) (defface mood-line-major-mode