Compare commits
No commits in common. "main" and "3.0.0" have entirely different histories.
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Repository assets (screenshots, etc.)
|
||||
.repo-assets/** filter=lfs diff=lfs merge=lfs -text
|
@ -1,20 +1,3 @@
|
||||
```lisp
|
||||
;; Emacs 29 with native compilation, default GC threshold
|
||||
;; Run in a lisp-interaction-mode buffer with Flymake
|
||||
|
||||
(defun time-mode-line (num &optional and-mem)
|
||||
(let ((gc-cons-threshold (if and-mem gc-cons-threshold most-positive-fixnum))
|
||||
(start-time (current-time)))
|
||||
(cl-loop for i to num
|
||||
do (format-mode-line mode-line-format))
|
||||
(format-time-string "%s.%3N seconds" (time-since start-time))))
|
||||
|
||||
;; Default mode line:
|
||||
(time-mode-line 10000) ;; "0.440 seconds"
|
||||
(time-mode-line 10000 :and-mem) ;; "2.402 seconds"
|
||||
|
||||
;; mood-line (default settings):
|
||||
(mood-line-mode t)
|
||||
(time-mode-line 10000) ;; "0.309 seconds"
|
||||
(time-mode-line 10000 :and-mem) ;; "1.286 seconds"
|
||||
```
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7bb22f786b2a5e3f01d1c784b320f6451bf093ceb049d9b45f7c283344635495
|
||||
size 670
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 19 KiB |
Binary file not shown.
3
.repo-assets/preview.png
Normal file
3
.repo-assets/preview.png
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3ac214b9c012211913dc903ced696036e85ca1d9c2af1d28b117e537da9ea108
|
||||
size 231459
|
Binary file not shown.
Before Width: | Height: | Size: 65 KiB |
22
README.md
22
README.md
@ -1,10 +1,12 @@
|
||||
# <img src=".repo-assets/icon.png" width=50> mood-line
|
||||
|
||||
A lightweight, drop-in replacement for the default Emacs mode line configuration.
|
||||
# mood-line
|
||||
|
||||
[](https://melpa.org/#/mood-line)
|
||||
[](https://stable.melpa.org/#/mood-line)
|
||||
|
||||
## About
|
||||
|
||||
mood-line is a lightweight, drop-in replacement for the default Emacs mode line configuration.
|
||||
|
||||
## Features
|
||||
|
||||
* Clean, informative design
|
||||
@ -15,11 +17,11 @@ A lightweight, drop-in replacement for the default Emacs mode line configuration
|
||||
|
||||
* Lazy-loaded extensions
|
||||
|
||||
* [Lightweight](.repo-assets/benchmark.md), no dependencies
|
||||
* [Lightweight](./repo-assets/benchmark.md), no dependencies
|
||||
|
||||
## Preview
|
||||
|
||||

|
||||

|
||||
|
||||
## Configuration
|
||||
|
||||
@ -38,7 +40,7 @@ If you are a user of `use-package`, it is easy to configure mood-line directly i
|
||||
|
||||
;; Use pretty Fira Code-compatible glyphs
|
||||
:custom
|
||||
(mood-line-glyph-alist mood-line-glyphs-fira-code))
|
||||
(mood-line-glyph-alist . mood-line-glyphs-fira-code))
|
||||
```
|
||||
|
||||
### Format
|
||||
@ -69,8 +71,8 @@ mood-line uses a modular segment format, and it is easy to reconfigure:
|
||||
((mood-line-segment-checker) . " "))))
|
||||
```
|
||||
|
||||
More information on the format specification is available in the documentation:\
|
||||
`M-x describe-variable mood-line-format`\
|
||||
More information on the format specification is available in the documentation: \
|
||||
`M-x describe-variable mood-line-format` \
|
||||
`M-x describe-function mood-line-defformat`
|
||||
|
||||
### Glyphs
|
||||
@ -80,7 +82,7 @@ If you'd like to see prettier Unicode glyphs, you can change the value of `mood-
|
||||
|
||||
```elisp
|
||||
;; The default set of glyphs:
|
||||
;; * myModifiedFile.js Replace*3 + main JavaScript ! Issues: 2
|
||||
;; * myModifiedFile.js Replace*3 + main Javascript ! Issues: 2
|
||||
(setq mood-line-glyph-alist mood-line-glyphs-ascii)
|
||||
|
||||
;; A set of Fira Code-compatible Unicode glyphs:
|
||||
@ -110,7 +112,7 @@ To run the included tests:
|
||||
## Feedback
|
||||
|
||||
If you experience any issues with this package, please
|
||||
[open an issue](https://git.tty.dog/jessieh/mood-line/issues/new)
|
||||
[open an issue](https://gitlab.com/jessieh/mood-line/issues/new)
|
||||
on the issue tracker.
|
||||
|
||||
Suggestions for improvements and feature requests are always appreciated, as well!
|
||||
|
@ -2,7 +2,7 @@
|
||||
;;
|
||||
;; Author: Jessie Hildebrandt <jessieh.net>
|
||||
;; Homepage: https://gitlab.com/jessieh/mood-line
|
||||
;;
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Commentary:
|
||||
@ -35,7 +35,7 @@
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
|
||||
;; ---------------------------------- ;;
|
||||
;; Required features
|
||||
;; Compile time requirements
|
||||
;; ---------------------------------- ;;
|
||||
|
||||
(eval-when-compile
|
||||
@ -45,19 +45,19 @@
|
||||
;; External variable defs
|
||||
;; ---------------------------------- ;;
|
||||
|
||||
(eval-when-compile
|
||||
(defvar flycheck-current-errors))
|
||||
(defvar flycheck-current-errors)
|
||||
|
||||
;; ---------------------------------- ;;
|
||||
;; External function decls
|
||||
;; ---------------------------------- ;;
|
||||
|
||||
(eval-when-compile
|
||||
(declare-function mood-line--get-glyph "mood-line")
|
||||
(declare-function flycheck-count-errors "flycheck")
|
||||
(declare-function flymake-running-backends "flymake")
|
||||
(declare-function flymake-reporting-backends "flymake")
|
||||
(declare-function flymake--lookup-type-property "flymake"))
|
||||
(declare-function mood-line--get-glyph "mood-line")
|
||||
|
||||
(declare-function flycheck-count-errors "flycheck")
|
||||
|
||||
(declare-function flymake-running-backends "flymake")
|
||||
(declare-function flymake-reporting-backends "flymake")
|
||||
(declare-function flymake--lookup-type-property "flymake")
|
||||
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
;;
|
||||
|
@ -3,7 +3,7 @@
|
||||
;; Author: Alynx Zhou <alynx.zhou@gmail.com>
|
||||
;; Jessie Hildebrandt <jessieh.net>
|
||||
;; Homepage: https://gitlab.com/jessieh/mood-line
|
||||
;;
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Commentary:
|
||||
@ -39,8 +39,7 @@
|
||||
;; External function decls
|
||||
;; ---------------------------------- ;;
|
||||
|
||||
(eval-when-compile
|
||||
(declare-function mood-line--get-glyph "mood-line"))
|
||||
(declare-function mood-line--get-glyph "mood-line")
|
||||
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
;;
|
||||
|
@ -3,7 +3,7 @@
|
||||
;; Author: trevDev() <trev@trevdev.ca>
|
||||
;; Jessie Hildebrandt <jessieh.net>
|
||||
;; Homepage: https://gitlab.com/jessieh/mood-line
|
||||
;;
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Commentary:
|
||||
@ -107,16 +107,6 @@ e.g., (:foreground \"red\")."
|
||||
(concat (propertize (car mode-cons)
|
||||
'face (cdr mode-cons))))))
|
||||
|
||||
;; ---------------------------------- ;;
|
||||
;; Xah segment
|
||||
;; ---------------------------------- ;;
|
||||
|
||||
(defun mood-line-segment-modal--xah-fn ()
|
||||
"Display the current xah-fly-keys state."
|
||||
(if (bound-and-true-p xah-fly-insert-state-p)
|
||||
"<I>"
|
||||
"<C>"))
|
||||
|
||||
;; ---------------------------------- ;;
|
||||
;; God segment
|
||||
;; ---------------------------------- ;;
|
||||
|
@ -2,7 +2,7 @@
|
||||
;;
|
||||
;; Author: Jessie Hildebrandt <jessieh.net>
|
||||
;; Homepage: https://gitlab.com/jessieh/mood-line
|
||||
;;
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Commentary:
|
||||
@ -38,8 +38,7 @@
|
||||
;; External function decls
|
||||
;; ---------------------------------- ;;
|
||||
|
||||
(eval-when-compile
|
||||
(declare-function mood-line--get-glyph "mood-line"))
|
||||
(declare-function mood-line--get-glyph "mood-line")
|
||||
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
;;
|
||||
@ -49,11 +48,8 @@
|
||||
|
||||
(defun mood-line-segment-vc--rev (vc-mode-str backend)
|
||||
"Return name of current file's revision for BACKEND according to `vc-mode'.
|
||||
VC-MODE-STR is expected to be the value of `vc-mode' in the current buffer.
|
||||
If `vc-display-status' is nil, return the name of BACKEND."
|
||||
(or (unless vc-display-status
|
||||
(symbol-name backend))
|
||||
(pcase backend
|
||||
VC-MODE-STR is expected to be the value of `vc-mode' in the current buffer."
|
||||
(or (pcase backend
|
||||
('Git (substring-no-properties vc-mode-str 5))
|
||||
('Hg (substring-no-properties vc-mode-str 4)))
|
||||
(ignore-errors
|
||||
|
110
mood-line.el
110
mood-line.el
@ -1,16 +1,17 @@
|
||||
;;; mood-line.el --- A minimal mode line inspired by doom-modeline -*- lexical-binding: t; -*-
|
||||
;;
|
||||
|
||||
;; Author: Jessie Hildebrandt <jessieh.net>
|
||||
;; Homepage: https://gitlab.com/jessieh/mood-line
|
||||
;; Keywords: mode-line faces
|
||||
;; Version: 3.1.0
|
||||
;; Version: 3.0.0
|
||||
;; Package-Requires: ((emacs "26.1"))
|
||||
;;
|
||||
|
||||
;; This file is not part of GNU Emacs.
|
||||
|
||||
;;; Commentary:
|
||||
;;
|
||||
;; mood-line is a lightweight, drop-in replacement for the default mode line.
|
||||
;; mood-line is a minimal mode line configuration that aims to replicate
|
||||
;; some of the features of the more advanced doom-modeline package.
|
||||
;;
|
||||
;; Features offered:
|
||||
;; * Clean, informative design
|
||||
@ -51,7 +52,7 @@
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
|
||||
;; ---------------------------------- ;;
|
||||
;; Required features
|
||||
;; Compile time requirements
|
||||
;; ---------------------------------- ;;
|
||||
|
||||
(eval-when-compile
|
||||
@ -61,19 +62,18 @@
|
||||
;; External variable defs
|
||||
;; ---------------------------------- ;;
|
||||
|
||||
(eval-when-compile
|
||||
(defvar anzu--cached-count)
|
||||
(defvar anzu--current-position)
|
||||
(defvar anzu--overflow-p)
|
||||
(defvar anzu--total-matched))
|
||||
(defvar anzu--cached-count)
|
||||
(defvar anzu--current-position)
|
||||
(defvar anzu--overflow-p)
|
||||
(defvar anzu--total-matched)
|
||||
|
||||
;; ---------------------------------- ;;
|
||||
;; External function decls
|
||||
;; ---------------------------------- ;;
|
||||
|
||||
(eval-when-compile
|
||||
(declare-function mc/num-cursors "multiple-cursors")
|
||||
(declare-function string-blank-p "subr-x"))
|
||||
(declare-function mc/num-cursors "multiple-cursors")
|
||||
|
||||
(declare-function string-blank-p "subr-x")
|
||||
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
;;
|
||||
@ -82,8 +82,10 @@
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
|
||||
(defmacro mood-line--deflazy (name)
|
||||
"Define dummy function NAME to `require' its module and call actual function."
|
||||
(let ((module (intern (car (split-string (symbol-name name) "--")))))
|
||||
"Define dummy function NAME to `require' its module and call actual function.
|
||||
If NAME is already bound, this does nothing."
|
||||
(when-let ((not-bound (not (fboundp name)))
|
||||
(module (intern (car (split-string (symbol-name name) "--")))))
|
||||
`(defun ,name (&rest args)
|
||||
"Not yet loaded."
|
||||
(fmakunbound (quote ,name))
|
||||
@ -144,8 +146,6 @@ An optional key :padding may be provided, the value of which will be used as
|
||||
(:buffer-modified . ?*)
|
||||
(:buffer-read-only . ?#)
|
||||
|
||||
(:frame-client . ?@)
|
||||
|
||||
(:count-separator . ?*))
|
||||
"Set of ASCII glyphs for use with mood-line.")
|
||||
|
||||
@ -167,8 +167,6 @@ An optional key :padding may be provided, the value of which will be used as
|
||||
(:buffer-modified . ?●)
|
||||
(:buffer-read-only . ?■)
|
||||
|
||||
(:frame-client . ?)
|
||||
|
||||
(:count-separator . ?×))
|
||||
"Set of Fira Code-compatible glyphs for use with mood-line.")
|
||||
|
||||
@ -190,8 +188,6 @@ An optional key :padding may be provided, the value of which will be used as
|
||||
(:buffer-modified . ?●)
|
||||
(:buffer-read-only . ?■)
|
||||
|
||||
(:frame-client . ?⇅)
|
||||
|
||||
(:count-separator . ?✕))
|
||||
"Set of Unicode glyphs for use with mood-line.")
|
||||
|
||||
@ -199,7 +195,7 @@ An optional key :padding may be provided, the value of which will be used as
|
||||
(mood-line-defformat
|
||||
:left
|
||||
(((mood-line-segment-modal) . " ")
|
||||
((or (mood-line-segment-buffer-status) " ") . " ")
|
||||
((mood-line-segment-buffer-status) . " ")
|
||||
((mood-line-segment-buffer-name) . " ")
|
||||
((mood-line-segment-anzu) . " ")
|
||||
((mood-line-segment-multiple-cursors) . " ")
|
||||
@ -217,10 +213,7 @@ An optional key :padding may be provided, the value of which will be used as
|
||||
(mood-line-defformat
|
||||
:left
|
||||
(((mood-line-segment-modal) . " ")
|
||||
((or (mood-line-segment-buffer-status)
|
||||
(mood-line-segment-client)
|
||||
" ") . " ")
|
||||
((mood-line-segment-project) . "/")
|
||||
((mood-line-segment-buffer-status) . " ")
|
||||
((mood-line-segment-buffer-name) . " ")
|
||||
((mood-line-segment-anzu) . " ")
|
||||
((mood-line-segment-multiple-cursors) . " ")
|
||||
@ -297,8 +290,6 @@ Keys are names for different mode line glyphs, values are characters for that
|
||||
:buffer-modified | File-backed buffer is modified
|
||||
:buffer-read-only | File-backed buffer is read-only
|
||||
|
||||
:frame-client | Frame is a client for an Emacs daemon
|
||||
|
||||
:count-separator | Separates some indicator names from numerical counts
|
||||
|
||||
`mood-line-glyphs-ascii' will be used as a fallback whenever a glyph is found
|
||||
@ -355,10 +346,6 @@ See `mood-line-defformat' for a helpful formatting macro."
|
||||
"Face used for the ':buffer-narrowed' buffer status indicator."
|
||||
:group 'mood-line-faces)
|
||||
|
||||
(defface mood-line-frame-status-client
|
||||
'((t (:inherit mood-line-unimportant)))
|
||||
"Face used for the :frame-client frame status indicator.")
|
||||
|
||||
(defface mood-line-major-mode
|
||||
'((t (:inherit bold)))
|
||||
"Face used for the major mode indicator."
|
||||
@ -399,13 +386,22 @@ See `mood-line-defformat' for a helpful formatting macro."
|
||||
"Face used for less important mode line elements."
|
||||
:group 'mood-line-faces)
|
||||
|
||||
;; ---------------------------------- ;;
|
||||
;; Obsolete faces
|
||||
;; ---------------------------------- ;;
|
||||
|
||||
(define-obsolete-face-alias
|
||||
'mood-line-modified
|
||||
'mood-line-buffer-status-modified
|
||||
"2.1.0")
|
||||
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
;;
|
||||
;; Helper functions
|
||||
;;
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
|
||||
(defvar mood-line--escape-buffer (get-buffer-create " *mood-line*")
|
||||
(defvar mood-line--escape-buffer (get-buffer-create " *mood-line*" t)
|
||||
"Buffer used by `mood-line--escape'.")
|
||||
|
||||
(defun mood-line--escape (&rest strings)
|
||||
@ -461,22 +457,17 @@ described in the documentation for `mood-line-format', which see."
|
||||
|
||||
(mood-line--deflazy mood-line-segment-modal--evil-fn)
|
||||
(mood-line--deflazy mood-line-segment-modal--meow-fn)
|
||||
(mood-line--deflazy mood-line-segment-modal--xah-fn)
|
||||
(mood-line--deflazy mood-line-segment-modal--god-fn)
|
||||
|
||||
(defun mood-line-segment-modal ()
|
||||
"Return the correct mode line segment for the first active modal mode found.
|
||||
Modal editing modes checked, in order:
|
||||
`evil-mode', `meow-mode', `xah-fly-keys', `god-mode'"
|
||||
Modal modes checked, in order: `evil-mode', `meow-mode', `god-mode'."
|
||||
(cond
|
||||
((bound-and-true-p evil-mode)
|
||||
(mood-line-segment-modal--evil-fn))
|
||||
((bound-and-true-p meow-mode)
|
||||
(mood-line-segment-modal--meow-fn))
|
||||
((bound-and-true-p xah-fly-keys)
|
||||
(mood-line-segment-modal--xah-fn))
|
||||
((or (bound-and-true-p god-local-mode)
|
||||
(bound-and-true-p god-global-mode))
|
||||
((featurep 'god-mode)
|
||||
(mood-line-segment-modal--god-fn))))
|
||||
|
||||
;; ---------------------------------- ;;
|
||||
@ -515,33 +506,6 @@ Modal editing modes checked, in order:
|
||||
((bound-and-true-p flymake-mode)
|
||||
mood-line-segment-checker--flymake-text)))
|
||||
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
;;
|
||||
;; Client segment
|
||||
;;
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
|
||||
(defun mood-line-segment-client ()
|
||||
"Return an indicator representing the client status of the current frame."
|
||||
(when (frame-parameter nil 'client)
|
||||
(propertize (mood-line--get-glyph :frame-client)
|
||||
'face 'mood-line-frame-status-client)))
|
||||
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
;;
|
||||
;; Project segment
|
||||
;;
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
|
||||
(defun mood-line-segment-project ()
|
||||
"Return project name from project.el or Projectile, if any."
|
||||
(or
|
||||
(and (fboundp 'project-name)
|
||||
(project-current)
|
||||
(project-name (project-current)))
|
||||
(and (fboundp 'projectile-project-name)
|
||||
(projectile-project-name))))
|
||||
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
;;
|
||||
;; anzu segment
|
||||
@ -611,10 +575,12 @@ Modal editing modes checked, in order:
|
||||
'face 'mood-line-buffer-status-modified))
|
||||
(buffer-read-only
|
||||
(propertize (mood-line--get-glyph :buffer-read-only)
|
||||
'face 'mood-line-buffer-status-read-only)))
|
||||
(when (buffer-narrowed-p)
|
||||
'face 'mood-line-buffer-status-read-only))
|
||||
(t " "))
|
||||
(if (buffer-narrowed-p)
|
||||
(propertize (mood-line--get-glyph :buffer-narrowed)
|
||||
'face 'mood-line-buffer-status-narrowed))))
|
||||
'face 'mood-line-buffer-status-narrowed)
|
||||
" ")))
|
||||
|
||||
;; ---------------------------------- ;;
|
||||
;; Buffer name segment
|
||||
@ -726,6 +692,10 @@ Modal editing modes checked, in order:
|
||||
;;
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
|
||||
;; ---------------------------------- ;;
|
||||
;; Configuration
|
||||
;; ---------------------------------- ;;
|
||||
|
||||
(defconst mood-line--hooks-alist
|
||||
'((mood-line-segment-checker--flycheck-update
|
||||
. (flycheck-mode-hook
|
||||
|
@ -34,12 +34,4 @@
|
||||
(should (string= (mood-line-segment-vc--rev "" 'SVN)
|
||||
"???"))))
|
||||
|
||||
(ert-deftest --rev/vc-display-status-nil ()
|
||||
"Name of the VCS backend should be reported when `vc-display-status' is nil."
|
||||
(let ((vc-display-status nil))
|
||||
(should (string= (mood-line-segment-vc--rev " Git:main" 'Git)
|
||||
"Git"))
|
||||
(should (string= (mood-line-segment-vc--rev " Hg:main" 'Hg)
|
||||
"Hg"))))
|
||||
|
||||
;;; mood-line-segment-vc-test.el ends here
|
||||
|
@ -17,80 +17,57 @@
|
||||
;; mood-line-defformat
|
||||
;; ---------------------------------- ;;
|
||||
|
||||
(ert-deftest -defformat/padding ()
|
||||
"The expanded sequence should include the provided (or default) padding."
|
||||
(should (equal (mood-line-defformat)
|
||||
(list
|
||||
;; Left
|
||||
'(" ")
|
||||
;; Right
|
||||
'(" "))))
|
||||
(ert-deftest -defformat/right-nil ()
|
||||
"The format sequence should expand if the right segment list is not provided."
|
||||
(should (equal (mood-line-defformat
|
||||
:padding
|
||||
"---")
|
||||
;; Left
|
||||
("XYZ")
|
||||
;; Right
|
||||
)
|
||||
(list
|
||||
;; Left
|
||||
'("---")
|
||||
'("XYZ")
|
||||
;; Right
|
||||
'("---")))))
|
||||
|
||||
(ert-deftest -defformat/left-right-nil ()
|
||||
"The format sequence should expand if the left or right segment list is nil."
|
||||
(should (equal (mood-line-defformat
|
||||
:left
|
||||
("XYZ"))
|
||||
(list
|
||||
;; Left
|
||||
'(" " "XYZ")
|
||||
;; Right
|
||||
'(" "))))
|
||||
(should (equal (mood-line-defformat
|
||||
:right
|
||||
("XYZ"))
|
||||
(list
|
||||
;; Left
|
||||
'(" ")
|
||||
;; Right
|
||||
'("XYZ" " ")))))
|
||||
nil))))
|
||||
|
||||
(ert-deftest -defformat/left-right ()
|
||||
"The expanded sequence should include left and right segments lists."
|
||||
"The expanded sequence should should include left and right segments lists."
|
||||
(should (equal (mood-line-defformat
|
||||
:left
|
||||
;; Left
|
||||
("ABC")
|
||||
:right
|
||||
;; Right
|
||||
("XYZ"))
|
||||
(list
|
||||
;; Left
|
||||
'(" " "ABC")
|
||||
'("ABC")
|
||||
;; Right
|
||||
'("XYZ" " ")))))
|
||||
'("XYZ")))))
|
||||
|
||||
(ert-deftest -defformat/cons-cells ()
|
||||
"Cons cell segments should expand into their `car' and `cdr' values."
|
||||
(should (equal (mood-line-defformat
|
||||
:left
|
||||
;; Left
|
||||
("ABC" ("ABC" . "XYZ") "XYZ")
|
||||
:right
|
||||
;; Right
|
||||
("..." ((some-fn) . " ") "..."))
|
||||
(list
|
||||
;; Left
|
||||
'(" " "ABC" "ABC" "XYZ" "XYZ")
|
||||
'("ABC" "ABC" "XYZ" "XYZ")
|
||||
;; Right
|
||||
'("..." (some-fn) " " "..." " ")))))
|
||||
'("..." (some-fn) " " "...")))))
|
||||
|
||||
(ert-deftest -defformat/exp-separators ()
|
||||
"Non-string, non-cons expressions should expand followed by a blank string."
|
||||
(should (equal (mood-line-defformat
|
||||
:left
|
||||
;; Left
|
||||
("ABC" ("ABC" . "XYZ") some-exp "XYZ" (some-fn))
|
||||
:right
|
||||
;; Right
|
||||
("..." ((some-fn) . " ") (another-fn) "..."))
|
||||
(list
|
||||
;; Left
|
||||
'(" " "ABC" "ABC" "XYZ" some-exp "" "XYZ" (some-fn) "")
|
||||
'("ABC" "ABC" "XYZ" some-exp "" "XYZ" (some-fn) "")
|
||||
;; Right
|
||||
'("..." (some-fn) " " (another-fn) "" "..." " ")))))
|
||||
'("..." (some-fn) " " (another-fn) "" "...")))))
|
||||
|
||||
;; -------------------------------------------------------------------------- ;;
|
||||
;;
|
||||
@ -148,7 +125,7 @@
|
||||
(should (string= segments-str "ABC123XYZ"))))
|
||||
|
||||
;; ---------------------------------- ;;
|
||||
;; mood-line--process-format
|
||||
;; mood-line---process-format
|
||||
;; ---------------------------------- ;;
|
||||
|
||||
(ert-deftest --process-format/default ()
|
||||
|
Loading…
Reference in New Issue
Block a user