about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-08-10 08:30:49 -0500
committerCase Duckworth2021-08-10 08:30:49 -0500
commitce1445355b15ae13949907880a4ab86365040b4d (patch)
tree914c1513e1c086954bc1c86f154c48568c23f8f7 /lisp
parentAdd BadRadio (diff)
downloademacs-ce1445355b15ae13949907880a4ab86365040b4d.tar.gz
emacs-ce1445355b15ae13949907880a4ab86365040b4d.zip
Add region-active indicator to word-count modeline
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw-modeline.el11
1 files changed, 6 insertions, 5 deletions
diff --git a/lisp/acdw-modeline.el b/lisp/acdw-modeline.el index c073992..104ea28 100644 --- a/lisp/acdw-modeline.el +++ b/lisp/acdw-modeline.el
@@ -128,10 +128,11 @@ Otherwise, cdr should be a function that takes two points (see `count-words')."
128Uses `acdw-modeline/word-count-modes' to determine which function to use." 128Uses `acdw-modeline/word-count-modes' to determine which function to use."
129 (when-let ((modefun 129 (when-let ((modefun
130 (assoc major-mode acdw-modeline/word-count-modes #'equal))) 130 (assoc major-mode acdw-modeline/word-count-modes #'equal)))
131 (let ((fn (or (cdr modefun) 131 (let* ((fn (or (cdr modefun)
132 #'count-words)) 132 #'count-words))
133 (min (if (region-active-p) (region-beginning) (point-min))) 133 (r (region-active-p))
134 (max (if (region-active-p) (region-end) (point-max)))) 134 (min (if r (region-beginning) (point-min)))
135 (format " %dW" (funcall fn min max))))) 135 (max (if r (region-end) (point-max))))
136 (format " %s%dW" (if r "+" "") (funcall fn min max)))))
136 137
137(provide 'acdw-modeline) 138(provide 'acdw-modeline)