From 9587c6884290b04935c9e099690e95b0d282c628 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Wed, 18 Jul 2012 22:29:34 +0800 Subject: [PATCH] * simple.el (count-words): Report on narrowing. Fixes: debbugs:9959 --- lisp/ChangeLog | 2 ++ lisp/simple.el | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 42e8e9a84fc..794de32b69b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,7 @@ 2012-07-18 Chong Yidong + * simple.el (count-words): Report on narrowing (Bug#9959). + * bindings.el: Bind M-= to count-words. * faces.el (face-spec-reset-face): Handle reverse video (Bug#4238). diff --git a/lisp/simple.el b/lisp/simple.el index c958c460f98..3240ede0299 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -986,7 +986,11 @@ END, without printing any message." ((use-region-p) (call-interactively 'count-words-region)) (t - (count-words--message "Buffer" (point-min) (point-max))))) + (count-words--message + (if (= (point-max) (1+ (buffer-size))) + "Buffer" + "Narrowed part of buffer") + (point-min) (point-max))))) (defun count-words--message (str start end) (let ((lines (count-lines start end)) -- 2.39.2