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.devel Subject: Re: 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="28946"; 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: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 25 15:37:37 2019 Return-path: Envelope-to: ged-emacs-devel@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 1hfldh-0007If-4p for ged-emacs-devel@m.gmane.org; Tue, 25 Jun 2019 15:37:37 +0200 Original-Received: from localhost ([::1]:60312 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hfldg-0005XK-2R for ged-emacs-devel@m.gmane.org; Tue, 25 Jun 2019 09:37:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57448) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hflXK-0001j5-0V for emacs-devel@gnu.org; Tue, 25 Jun 2019 09:31:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hflXI-0007Ri-V6 for emacs-devel@gnu.org; Tue, 25 Jun 2019 09:31:01 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:57480) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hflXI-0007KX-MV; Tue, 25 Jun 2019 09:31:00 -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-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 80.91.231.51 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:238134 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