summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-03-14 23:48:40 -0500
committerCase Duckworth2021-03-14 23:48:40 -0500
commit4283ccdd2c39ae482ca2dbc46936300329cf7dda (patch)
tree460004bcb3d955a7b2132250c16befaf4e62700d /lisp
parentTurn `font-lock-mode' off (diff)
downloademacs-4283ccdd2c39ae482ca2dbc46936300329cf7dda.tar.gz
emacs-4283ccdd2c39ae482ca2dbc46936300329cf7dda.zip
Further configure the mode line
I've broken out extra functions into `acdw-modeline', so they don't clutter up
the init.el too much.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-modeline.el82
1 files changed, 82 insertions, 0 deletions
diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el new file mode 100644 index 0000000..89037f9 --- /dev/null +++ b/lisp/acdw-modeline.el
@@ -0,0 +1,82 @@
1:;;; acdw-modeline.el -*- lexical-binding: t; coding: utf-8-unix -*-
2;;
3;; Author: Case Duckworth <acdw@acdw.net>
4;; Created: Sometime during Covid-19, 2020
5;; Keywords: configuration
6;; URL: https://tildegit.org/acdw/emacs
7;;
8;; This file is NOT part of GNU Emacs.
9;;
10;;; License:
11;;
12;; Everyone is permitted to do whatever with this software, without
13;; limitation. This software comes without any warranty whatsoever,
14;; but with two pieces of advice:
15;; - Don't hurt yourself.
16;; - Make good choices.
17;;
18;;; Commentary:
19;; `acdw-modeline' is a dumping ground for extra modeline functions, so they
20;; don't clutter up `init.el'.
21;;
22;;; Code:
23
24(require 'simple-modeline)
25(require 'minions)
26
27;; modified from `simple-modeline'
28(defun acdw-modeline/modified ()
29 "Displays a color-coded buffer modification/read-only
30indicator in the mode-line."
31 (if (not (string-match-p "\\*.*\\*" (buffer-name)))
32 (let* ((read-only (and buffer-read-only (buffer-file-name)))
33 (modified (buffer-modified-p)))
34 (propertize
35 (if read-only " =" (if modified " +" " -"))
36 'help-echo (format
37 (concat "Buffer is %s and %smodified\n"
38 "mouse-1: Toggle read-only status.")
39 (if read-only "read-only" "writable")
40 (if modified "" "not "))
41 'local-map (purecopy (simple-modeline-make-mouse-map
42 'mouse-1
43 (lambda (event)
44 (interactive "e")
45 (with-selected-window
46 (posn-window (event-start event))
47 (read-only-mode 'toggle)))))
48 'mouse-face 'mode-line-highlight))))
49
50;; all me, baby
51(defun acdw-modeline/minions ()
52 "Display a button for `minions-minor-modes-menu'."
53 (concat
54 " "
55 (propertize
56 "&"
57 'help-echo (format
58 "Minor modes menu\nmouse-1: show menu.")
59 'local-map (purecopy (simple-modeline-make-mouse-map
60 'mouse-1
61 (lambda (event)
62 (interactive "e")
63 (with-selected-window (posn-window
64 (event-start event))
65 (minions-minor-modes-menu)))))
66 'mouse-face 'mode-line-highlight)))
67
68;; from https://www.gonsie.com/blorg/modeline.html, from Doom
69(defun acdw-modeline/vc-branch ()
70 (let ((backend (vc-backend buffer-file-name)))
71 (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))))
72
73;; from gonsie
74(defun acdw-modeline/buffer-name ()
75 (propertize " %b "
76 'face
77 (if (buffer-modified-p)
78 'font-lock-warning-face
79 'font-lock-type-face)
80 'help-echo (buffer-file-name)))
81
82(provide 'acdw-modeline)