From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Daniel Koning Newsgroups: gmane.emacs.bugs Subject: bug#41761: [PATCH] bug#41761: 28.0.50; M-x count-words counts words only up to a field boundary Date: Wed, 10 Jun 2020 15:15:32 -0500 Message-ID: References: <87y2oxwldi.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="79197"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (darwin) Cc: 41761@debbugs.gnu.org To: Pip Cet Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 10 22:16:11 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jj78t-000KYK-1B for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Jun 2020 22:16:11 +0200 Original-Received: from localhost ([::1]:51000 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jj78r-0002fd-Ug for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 10 Jun 2020 16:16:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jj78k-0002fV-3p for bug-gnu-emacs@gnu.org; Wed, 10 Jun 2020 16:16:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52112) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jj78j-0003FO-Qo for bug-gnu-emacs@gnu.org; Wed, 10 Jun 2020 16:16:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jj78j-0002f4-Lx for bug-gnu-emacs@gnu.org; Wed, 10 Jun 2020 16:16:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Koning Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 10 Jun 2020 20:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41761 X-GNU-PR-Package: emacs Original-Received: via spool by 41761-submit@debbugs.gnu.org id=B41761.159182014810204 (code B ref 41761); Wed, 10 Jun 2020 20:16:01 +0000 Original-Received: (at 41761) by debbugs.gnu.org; 10 Jun 2020 20:15:48 +0000 Original-Received: from localhost ([127.0.0.1]:35425 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jj78W-0002eW-Hj for submit@debbugs.gnu.org; Wed, 10 Jun 2020 16:15:48 -0400 Original-Received: from sender4-of-o56.zoho.com ([136.143.188.56]:21603) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jj78T-0002eK-S8 for 41761@debbugs.gnu.org; Wed, 10 Jun 2020 16:15:46 -0400 ARC-Seal: i=1; a=rsa-sha256; t=1591820142; cv=none; d=zohomail.com; s=zohoarc; b=g2oZ0xtKleGidsiJEMCm3oQ6m14MPVwv2oA9JCiGhmijYdsLBXevp45Rea6P0FJmKsJii7XrkL11xSfrOUK4eGSQohXlI/ZYcEicYSJ/6QwvWvgi9Bpo3jZ7IxxRjajGjI/7g2S98S7jYunA6V544WRok3w2A8CvO8OewW0rHOA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591820142; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=MKDT0SKZt0t8AQpAxJ41W1vxAfv5GAa+JQNSO1lf3mA=; b=hPzYRaaCBMW19llhJpKhGQadaelMoT+ijmcbd+anmjqT/Py/jvJVZIm3cc8uFtpO87bTzBBPgkeU3OqDDkDmFGNo1pAxFgcL5hcH87cCcwv9Y7bPvjPrq2Sl9yjt0fMeiNmpJT2UilAIa9575xBIsEN4WHb5YtIV+g6axUsvdEE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass smtp.mailfrom=dk@danielkoning.com; dmarc=pass header.from= header.from= Original-Received: from cornelius (112.157.239.35.bc.googleusercontent.com [35.239.157.112]) by mx.zohomail.com with SMTPS id 15918201404201010.3798736791774; Wed, 10 Jun 2020 13:15:40 -0700 (PDT) In-Reply-To: <87y2oxwldi.fsf@gmail.com> (Pip Cet's message of "Mon, 08 Jun 2020 16:52:25 +0000") X-Zoho-Virus-Status: 1 X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181830 Archived-At: --=-=-= Content-Type: text/plain Pip Cet writes: > Expected result: > > message "Region has 1 line, 10 words, and 50 characters" > > Actual result: > > message "Region has 1 line, 1 word, and 50 characters" `count-words' should be disabling field-boundary behavior in `forward-word-strictly' by setting `inhibit-field-text-motion'. Patch included. I grepped for other calls to `count-words' that might be making the same omission, but everything I saw looked like a use case that should respect field boundaries. Daniel --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Don-t-stop-at-field-boundaries-when-counting-words-B.patch Content-Description: count-words patch >From af0d9c48aaf99d8df5fa55a8ba2c0ee42bf695e9 Mon Sep 17 00:00:00 2001 From: Daniel Koning Date: Wed, 10 Jun 2020 14:42:39 -0500 Subject: [PATCH] Don't stop at field boundaries when counting words (Bug#41761) * lisp/simple.el (count-words): Ensure that `forward-word-strictly' moves point from one field to the next during the word-counting loop. Copyright-paperwork-exempt: yes --- lisp/simple.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/simple.el b/lisp/simple.el index 6d7600e414..9d898eeeec 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1319,7 +1319,9 @@ count-words END, without printing any message." (interactive (list nil nil)) (cond ((not (called-interactively-p 'any)) - (let ((words 0)) + (let ((words 0) + ;; Count across field boundaries. (Bug#41761) + (inhibit-field-text-motion t)) (save-excursion (save-restriction (narrow-to-region start end) -- 2.20.1 --=-=-=--