From ce1445355b15ae13949907880a4ab86365040b4d Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 10 Aug 2021 08:30:49 -0500 Subject: Add region-active indicator to word-count modeline --- lisp/acdw-modeline.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lisp') 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')." Uses `acdw-modeline/word-count-modes' to determine which function to use." (when-let ((modefun (assoc major-mode acdw-modeline/word-count-modes #'equal))) - (let ((fn (or (cdr modefun) - #'count-words)) - (min (if (region-active-p) (region-beginning) (point-min))) - (max (if (region-active-p) (region-end) (point-max)))) - (format " %dW" (funcall fn min max))))) + (let* ((fn (or (cdr modefun) + #'count-words)) + (r (region-active-p)) + (min (if r (region-beginning) (point-min))) + (max (if r (region-end) (point-max)))) + (format " %s%dW" (if r "+" "") (funcall fn min max))))) (provide 'acdw-modeline) -- cgit 1.4.1-21-gabe81