From 5ae26036e23133eff548269861ea7a71c22cab59 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 25 Feb 2000 19:02:42 +0000 Subject: [PATCH] Implement COUNT-WORDS-REGION. --- v7/src/edwin/texcom.scm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/v7/src/edwin/texcom.scm b/v7/src/edwin/texcom.scm index 221dc52cd..ffcd65114 100644 --- a/v7/src/edwin/texcom.scm +++ b/v7/src/edwin/texcom.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: texcom.scm,v 1.40 2000/02/25 17:46:45 cph Exp $ +;;; $Id: texcom.scm,v 1.41 2000/02/25 19:02:42 cph Exp $ ;;; ;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology ;;; @@ -110,6 +110,18 @@ With a zero argument, it transposes the words at point and mark." "p" (lambda (argument) (transpose-things forward-word argument))) + +(define (count-words-region region) + (let ((end (region-end region))) + (let loop ((start (region-start region)) (count 0)) + (let ((start (forward-to-word start 'LIMIT))) + (if (mark< start end) + (let ((count (+ count 1)) + (m (forward-word start 1 #f))) + (if m + (loop m count) + count)) + count))))) ;;;; Case Conversion -- 2.25.1