about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-08-10 14:47:00 -0500
committerCase Duckworth2021-08-10 14:47:00 -0500
commit3a100209daa7f43cc2476c348b8f5d1b06b3a971 (patch)
tree4e91536870cc50d3d58ddf2752047704a0d81c1a /lisp
parentChange acdw/system call to executable-find (diff)
downloademacs-3a100209daa7f43cc2476c348b8f5d1b06b3a971.tar.gz
emacs-3a100209daa7f43cc2476c348b8f5d1b06b3a971.zip
Add acdw-modeline/position
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-modeline.el29
1 files changed, 29 insertions, 0 deletions
diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index 104ea28..4e6b002 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el
@@ -94,6 +94,35 @@ indicator in the mode-line."
94 'mouse-2 #'mode-line-widen)) 94 'mouse-2 #'mode-line-widen))
95 'mouse-face 'mode-line-highlight)))) 95 'mouse-face 'mode-line-highlight))))
96 96
97(defun acdw-modeline/position ()
98 "Displays the current cursor position in the mode-line.
99
100Unlike `simple-modeline-segment-position', this changes the first
101character from '+' to '-' if the region goes 'backward' -- that
102is, if point < mark."
103 `((line-number-mode
104 ((column-number-mode
105 (column-number-indicator-zero-based
106 (8 " %l:%c")
107 (8 " %l:%C"))
108 (5 " L%l")))
109 ((column-number-mode
110 (column-number-indicator-zero-based
111 (5 " C%c")
112 (5 " C%C")))))
113 ,(if (region-active-p)
114 (propertize (format "%s%s"
115 (if (and (mark)
116 (< (point) (mark)))
117 "-"
118 "+")
119 (apply #'+ (mapcar
120 (lambda (pos)
121 (- (cdr pos)
122 (car pos)))
123 (region-bounds))))
124 'font-lock-face 'font-lock-variable-name-face))))
125
97(defun acdw-modeline/text-scale () 126(defun acdw-modeline/text-scale ()
98 ;; adapted from https://github.com/seagle0128/doom-modeline 127 ;; adapted from https://github.com/seagle0128/doom-modeline
99 (when (and (boundp 'text-scale-mode-amount) 128 (when (and (boundp 'text-scale-mode-amount)