From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#23675: Feature request: Emacs 25.0.94: count-lines should offer a way to ignore invisible lines, e.g. outline mode Date: Tue, 25 Jun 2019 15:30:44 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="62147"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: rswgnu@gmail.com, 23675@debbugs.gnu.org, emacs-devel To: Robert Weiner Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 25 15:45:15 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hfll3-000G0R-Ql for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Jun 2019 15:45:13 +0200 Original-Received: from localhost ([::1]:60390 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfll2-0004CO-M8 for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Jun 2019 09:45:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57476) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hflXN-0001lK-KX for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 09:31:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hflXK-0007T5-Pr for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 09:31:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45406) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hflXK-0007Sm-MD for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 09:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hflXK-0004iQ-Fh for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2019 09:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Jun 2019 13:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23675 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 23675-submit@debbugs.gnu.org id=B23675.156146945418112 (code B ref 23675); Tue, 25 Jun 2019 13:31:02 +0000 Original-Received: (at 23675) by debbugs.gnu.org; 25 Jun 2019 13:30:54 +0000 Original-Received: from localhost ([127.0.0.1]:58950 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hflXB-0004i3-Ki for submit@debbugs.gnu.org; Tue, 25 Jun 2019 09:30:54 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:49112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hflX8-0004hq-2t for 23675@debbugs.gnu.org; Tue, 25 Jun 2019 09:30:50 -0400 Original-Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=stories) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hflX2-0000H7-Fb; Tue, 25 Jun 2019 15:30:47 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAIVBMVEUmJDJybnkkHyk+OkUb FhpCPkoPBwQlICoqKDUjIzMLAwG+16mnAAACG0lEQVQ4jW2UPYsbMRCGxeHDLiPMEtIqZ9RHJ3J1 WAzposiCyx/YYiuf9pZxG2PjbQMJeP+Ai/2VmRnth+9jCoH17DszmnmxKIriUlCUHUWZfhSF+N62 bdM0Tn5q279KQ22MV0rPGGA4+YuAmtfG+ngFzg8tg1gZt9wr/TwADgRqFVz2ZVBQ/h7AU3Dy6wiW E6gRPPbg7H0PvilYBUkgEviXuRFEAtgvF/+Tyal4HcIIfkuLt1nIqMbKMpilVIY6kJKL2+C8AlYc HwgESYr42dtgYurqOHZFwCBQwABn2AMAWHljjBazlyNBUDPYHd4AiHS8BTuALYLtS3AggBVhPoAz r5FAczotGhBiUpwRYKpmHrcCcx1Edym6Ljlg8EEyA3sjkbKYTgTFu5GLCkdggw8UG62VulN4wI2o 0x2F3ygO0LDdXwNURK3u6OUEMNEIaB5owwQMXcksAQWR7kEgwFXKbASaRBEWe1FZK9N1CD+jApAf afYMUDIUxykSeJJUHK0nE6LiO7lEsDy9AqSQeDyexJF6ki4bQIUfnUTDCjQ+17fULoEPouEarMmC txvqyjj5Y4HvuGXgsIYxDNgMBKaJoEL3YJHaTe+znh5IojSSML4Pxx51D2bi9mrs9wiA1gHoXVK4 kFa4SQDwvBEVdoQAF5w2qBXuV8Nc4OLX75hh3duH/1+6brLPWpQjuGCUk33y9aQZPJYXef4fH4+u 0xlHUf8AAAAASUVORK5CYII= Mail-Copies-To: never In-Reply-To: (Robert Weiner's message of "Mon, 6 Jun 2016 19:35:47 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:161356 Archived-At: Some comments on the patch: Robert Weiner writes: > ! (defun count-lines (start end) > "Return number of lines between START and END. > This is usually the number of newlines between them, > but can be one more if START is not equal to END > ! and the greater of them is not at the start of a line." > (save-excursion > (save-restriction > (narrow-to-region start end) > (goto-char (point-min)) > ! (if (eq selective-display t) > ! (save-match-data Hm... the current version of the function doesn't mention selective-display at all, which it probably should, anyway... > ! (defun count-lines (start end &optional ignore-invisible-lines-flag) I think we tend to avoid -flag in arguments these days? > ! With optional IGNORE-INVISIBLE-LINES-FLAG non-nil, > ! lines collapsed with selective-display are excluded > ! from the line count." This is very confusing, because it only mentions selective-display when this flag is non-nil, but not what the flag does otherwise. > ! (cond ((and (not ignore-invisible-lines-flag) (eq selective-display t)) > ! (save-match-data [...] > ! (while (re-search-forward "\n\\|\r[^\n]" nil t) And the selective-display bit saves match data and the non-selective-display one doesn't. But other than that, I think this sounds like a useful addition. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no