From be57e624fa279ee847e33372c4b333881d3a9e8f Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 2 Jul 2016 00:54:52 -0400 Subject: count-words-region: Count hyphenated words as one word --- lisp/km-editing.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lisp') diff --git a/lisp/km-editing.el b/lisp/km-editing.el index e172fec..e7a5cba 100644 --- a/lisp/km-editing.el +++ b/lisp/km-editing.el @@ -110,7 +110,14 @@ XSELECT is non-nil, copy the region with `x-select-text'." (when comment-char (flush-lines (concat "^" (regexp-quote comment-char) ".*$"))))) -(defvar km/count-words-region-filter-functions '(km/delete-comment-lines) +(defun km/delete-hyphens (orig-buf) + (save-excursion + (while (search-forward "-" nil t) + (delete-char -1)))) + +(defvar km/count-words-region-filter-functions + '(km/delete-comment-lines + km/delete-hyphens) "Hooks run by `km/count-words-region-filtered'. These will be called in a temporary buffer and should delete any text that should not be considered by `count-words-region'. They -- cgit v1.2.3