From 7c16649462beca822c0b72438a2b20e77a261985 Mon Sep 17 00:00:00 2001 From: JSDurand Date: Tue, 22 Dec 2020 20:35:51 +0800 Subject: Initial commit --- modeline.el | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 modeline.el (limited to 'modeline.el') diff --git a/modeline.el b/modeline.el new file mode 100644 index 0000000..a564a10 --- /dev/null +++ b/modeline.el @@ -0,0 +1,66 @@ +;;;###autoload +(defun modeline-format-main () + "The main mode line format." + (let ((left (modeline-format-left)) + (right (modeline-format-right)) + (left-len (length left)) + (right-len (length right)) + (middle (propertize " " 'display + (make-string (- (window-width) + left-len + right-len) + 32)))) + (concat left middle right))) + +;;;###autoload +(defun modeline-format-left () + "The left mode line format." + ) + +;;;###autoload +(defvar modeline-bar-width 3 + "The width of the mode line bar") + +;;;###autoload +(defvar modeline-bar-height 27 + "The height of the mode line bar") + +;;;###autoload +(defun modeline-format-bar () + "We need a bar to ensure the mode line has the specified height." + (cond + ((and (display-graphic-p) + (image-type-available-p 'xpm)) + (propertize + " " 'display + (let ((data (make-list modeline-bar-height + (make-list modeline-bar-width 97))) + (color (face-background 'modus-theme-active-blue nil t))) + (ignore-errors + (create-image + (concat + "/* XPM */\nstatic char * bar[]={\n" + (format "\"%d %d 1 1\",\n\"a c %s\",\n" + modeline-bar-width modeline-bar-height + color) + (mapconcat + (lambda (row) + (format "\"%s\"" + (apply #'string row))) + data ",\n") + "\n};") + 'xpm t :ascent 'center))))))) + +;;;###autoload +(defun modeline-format-right () + "The right mode line format.") + + + + + + + +(setq mode-line-format '("%e" (:eval (modeline-format-main)))) + + -- cgit v1.2.3-18-g5258