Skip to content

11111000000/shaoline

Repository files navigation

Shaoline – The Modeline of Nothingness

“The mode-line that can be seen is not the eternal mode-line.” — Lao-Tzu, Emacs 27 + edition

screenshot-shaoline.png

There was an age when every buffer carried a heavy belt of glyphs, digits and blinking widgets. Then a humble Lisp script shaved its head, sat down in the echo area and simply was. That script is Shaoline.

Shaoline replaces the traditional modeline with a minimalist, highly functional string drawn in the echo area. It vanishes the moment Emacs must speak, or stays if that is your Path. It does just enough and nothing more. Walk its Dao by doing nothing; everything is already done.

“When nothing is done, nothing remains undone.” — Tao Te Ching, §48

Installation

MELPA (package.el):

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(unless (package-installed-p 'shaoline)
  (package-refresh-contents)
  (package-install 'shaoline))
(require 'shaoline-mode)
(shaoline-mode 1)
(use-package shaoline
  :straight (shaoline
             :type git
             :host github
             :repo "11111000000/shaoline")
  :init   (require 'shaoline-mode) ; UI layer
  :config (shaoline-mode 1))       ; enable globally

Or manual/local checkout:

;; Manual installation: clone/download and add to load-path
;; Example:
;;   git clone https://github.com/11111000000/shaoline ~/.emacs.d/site-lisp/shaoline
;; If sources live under a 'lisp/' subdir, add that:
(add-to-list 'load-path "~/.emacs.d/site-lisp/shaoline/lisp")
(require 'shaoline-mode)  ;; UI layer
(shaoline-mode 1)         ;; enable globally

Ready. Ignore the rest. Curious? Let insight flow further.

Architecture of Emptiness

  1. Core (shaoline.el) pure functions, no side-effects.
  2. Effects (shaoline-effects.el) the only gate to the world.
  3. Strategy (shaoline-strategy.el) yin / yang / adaptive logic.
  4. UI (shaoline-mode.el) turn on/off, reports.
  5. Garden (shaoline-segments.el) collection of pure segments.

Purity is kept, impurity is isolated – the metaphysics of performance.

Highlights – Reflections of Void

  1. Echo-area only — no windows, frames, overlays.
  2. Four-layer architecture — Core → Effects → Strategy → UI.
  3. Strategies yin / yang / adaptive — auto-switch by load, file size, remote, GUI/TTY.
  4. EXWM tray aware — right margin auto-aligns under your system tray.
  5. Prefix-key hint — unfinished key sequences / C-u 42 show instantly.
  6. Token bucket — shapes update traffic, no storms.
  7. TTL cache + async for heavy segments (battery, project).
  8. Zero timers until truly needed — core stays timer-free.
  9. Persistent centre — last useful message lives until a new one appears.
  10. Dependency = 0 unless you want icons.

Student: “Master, how many dependencies does Shaoline have?” Master: “Mu.”

Configuration

Tip: frequent external calls re-use the composed line thanks to shaoline-compose-cache-ttl and shaoline-compose-min-interval.

Default segments

(setq shaoline-segments
      '((:left   shaoline-segment-major-mode-icon
                 shaoline-segment-buffer-name
                 shaoline-segment-current-keys
                 shaoline-segment-modified)
        (:center shaoline-segment-echo-message)
        (:right  shaoline-segment-position     ; [line:col]
                 shaoline-segment-project-name
                 shaoline-segment-git-branch
                 shaoline-segment-battery
                 shaoline-segment-time)))

Re-order, remove, or add functions as you wish.

Key variables (excerpt)

VariableDefaultMeaning
shaoline-mode-strategy‘yangyin / yang / adaptive
shaoline-enable-dynamic-segmentstClock, battery & friends
shaoline-right-margin1Fixed right padding
shaoline-with-traytAuto-adjust to EXWM system tray
shaoline-tray-refresh-interval1.5Seconds between tray margin recalculations
shaoline-hide-modelinetHide the classic modeline
shaoline-update-debounce0.25Throttle cursor-movement refreshes
shaoline-cache-ttl2.0Default cache TTL (segments)
shaoline-compose-cache-ttl0.5TTL for full composed line cache
shaoline-compose-min-interval0.2Min interval between real recompositions
shaoline-debugnilVerbose logs in shaoline-logs

Interactively: M-x customize-group RET shaoline RET

  • Strategies – The Dao in Action
  • yin — passive; no hooks/timers, manual M-x shaoline-refresh.
  • yang — active; always visible, hides mode-line.
  • adaptive — automatically chooses yin or yang.

Cycle live: M-x shaoline-toggle-strategy

Segment Garden (all pure)

SegmentShowsNeeds
buffer-nameBuffer name
modified“*” if buffer modified
current-keysCurrent prefix / C-u 42 / “C-x”
positionLine (and column if asked)
major-mode-iconIcon / text of major modeall-the-icons (opt.)
project-nameProject name (TTL 2 s)project.el / projectile
git-branchCurrent Git branchvc-git
batteryPercent + icon (async, TTL 5 s)battery.el, async.el
time24 h clock
echo-messageLast non-empty (message …)

More live in shaoline-segments.el or craft your own:

(shaoline-define-segment shaoline-segment-ts-lang ()
  (when (fboundp 'treesit-language-at)
    (format "%s" (treesit-language-at (point)))))
(push 'shaoline-segment-ts-lang (alist-get :left shaoline-segments))

EXWM Tray Alignment

Running EXWM with a system tray? Shaoline measures its pixel width, converts to characters and tweaks shaoline-right-margin on the fly. Disable: (setq shaoline-with-tray nil) Tune refresh: (setq shaoline-tray-refresh-interval 1.5) Tune refresh: (setq shaoline-tray-refresh-interval 1.5)

Frequently Asked Koans

  1. Where is my old modeline? (setq shaoline-hide-modeline nil) or disable the mode.
  2. Why does the line vanish on M-x? Minibuffer is talking, Shaoline bows.
  3. Echo area flickers! Some package spams (message nil). Turn on shaoline-debug.
  4. TTY support? Yes; icons degrade to text, serenity remains.
  5. Force update?M-x shaoline-refresh.
  6. Clear it now?M-x shaoline-clear.

Returning to Emptiness

(shaoline-total-cleanup)   ;; removes timers, hooks, restores everything

Zen of Performance

• Compose string < 0.2 ms (6 segments). • Timers start only when dynamic segments exist. • Token bucket shapes traffic; light-updates rate-limited further. • Memory footprint – the heaviest object is this README.

Documentation is a finger pointing at the moon; Shaoline shows both the moon and its phase.

License

MIT. Copy it, fork it, tie it to a kite and let it fly. —

Close this buffer, take a breath, return to code – nothing to add, nothing to remove.

About

shaoline-mode

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •