From unknown Wed Jun 25 09:08:35 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#23675 <23675@debbugs.gnu.org> To: bug#23675 <23675@debbugs.gnu.org> Subject: Status: Feature request: Emacs 25.0.94: count-lines should offer a way to ignore invisible lines, e.g. outline mode Reply-To: bug#23675 <23675@debbugs.gnu.org> Date: Wed, 25 Jun 2025 16:08:35 +0000 retitle 23675 Feature request: Emacs 25.0.94: count-lines should offer a wa= y to ignore invisible lines, e.g. outline mode reassign 23675 emacs submitter 23675 Robert Weiner severity 23675 wishlist tag 23675 patch fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 01 11:33:39 2016 Received: (at submit) by debbugs.gnu.org; 1 Jun 2016 15:33:39 +0000 Received: from localhost ([127.0.0.1]:50024 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b889L-0001lE-3T for submit@debbugs.gnu.org; Wed, 01 Jun 2016 11:33:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:52700) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b874d-0005Iq-CV for submit@debbugs.gnu.org; Wed, 01 Jun 2016 10:24:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b874X-0000tT-8n for submit@debbugs.gnu.org; Wed, 01 Jun 2016 10:24:38 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,HTML_MESSAGE, RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:54597) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b874X-0000t7-5x for submit@debbugs.gnu.org; Wed, 01 Jun 2016 10:24:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b874U-0005pd-K3 for bug-gnu-emacs@gnu.org; Wed, 01 Jun 2016 10:24:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b874O-0000qo-LC for bug-gnu-emacs@gnu.org; Wed, 01 Jun 2016 10:24:33 -0400 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:43235) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b874O-0000qh-Hu for bug-gnu-emacs@gnu.org; Wed, 01 Jun 2016 10:24:28 -0400 Received: from mail-oi0-f50.google.com ([209.85.218.50]:34347) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1b874M-00086s-U6 for bug-gnu-emacs@gnu.org; Wed, 01 Jun 2016 10:24:27 -0400 Received: by mail-oi0-f50.google.com with SMTP id e72so29721986oib.1 for ; Wed, 01 Jun 2016 07:24:26 -0700 (PDT) X-Gm-Message-State: ALyK8tI7HHiwnROaO8dCB31e/JalRrPNUcZwb8sfKnwxuEU2ZO4P2/L/sKVJQFs/bXmOFfWRwWjoYYsMJZ5R3A== X-Received: by 10.202.178.197 with SMTP id b188mr21065647oif.155.1464791066180; Wed, 01 Jun 2016 07:24:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.205.17 with HTTP; Wed, 1 Jun 2016 07:23:56 -0700 (PDT) From: Robert Weiner Date: Wed, 1 Jun 2016 10:23:56 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Feature request: Emacs 25.0.94: count-lines should offer a way to ignore invisible lines, e.g. outline mode To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary=001a113b72a22b88880534383f11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 01 Jun 2016 11:33:37 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.4 (------) --001a113b72a22b88880534383f11 Content-Type: text/plain; charset=UTF-8 Often when particular lines are hidden, one wants to count only visible lines. count-lines presently cannot do this. XEmacs has for a long-time had count-lines take an optional 3rd parameter flag which if non-nil, ignores invisible lines in the line count. This would be very helpful whenever selective-display is in use. --001a113b72a22b88880534383f11 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Often when particular lines are hidden, one =C2=A0wants to= count only visible lines. =C2=A0count-lines presently cannot do this.=C2= =A0 XEmacs has for a long-time had count-lines take an optional 3rd paramet= er flag which if non-nil, ignores invisible lines in the line count.=C2=A0 = This would be very helpful whenever selective-display is in use.

--001a113b72a22b88880534383f11-- From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 04 04:58:00 2016 Received: (at 23675) by debbugs.gnu.org; 4 Jun 2016 08:58:00 +0000 Received: from localhost ([127.0.0.1]:53718 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b97P5-0004e7-SB for submit@debbugs.gnu.org; Sat, 04 Jun 2016 04:58:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60849) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b97P3-0004du-NF for 23675@debbugs.gnu.org; Sat, 04 Jun 2016 04:57:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b97Ot-0003oa-Mp for 23675@debbugs.gnu.org; Sat, 04 Jun 2016 04:57:52 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36273) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b97Ot-0003oV-JS for 23675@debbugs.gnu.org; Sat, 04 Jun 2016 04:57:47 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2346 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1b97Os-0003pv-HM; Sat, 04 Jun 2016 04:57:47 -0400 Date: Sat, 04 Jun 2016 11:58:15 +0300 Message-Id: <83d1nxwct4.fsf@gnu.org> From: Eli Zaretskii To: Robert Weiner In-reply-to: (message from Robert Weiner on Wed, 1 Jun 2016 10:23:56 -0400) Subject: Re: bug#23675: Feature request: Emacs 25.0.94: count-lines should offer a way to ignore invisible lines, e.g. outline mode References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 23675 Cc: 23675@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.4 (------) > From: Robert Weiner > Date: Wed, 1 Jun 2016 10:23:56 -0400 > > Often when particular lines are hidden, one wants to count only visible lines. count-lines presently cannot do > this. XEmacs has for a long-time had count-lines take an optional 3rd parameter flag which if non-nil, ignores > invisible lines in the line count. This would be very helpful whenever selective-display is in use. Patches are welcome to add this. Also, we have forward-visible-line, which might prove instrumental. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 06 19:36:32 2016 Received: (at 23675) by debbugs.gnu.org; 6 Jun 2016 23:36:32 +0000 Received: from localhost ([127.0.0.1]:57253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bA44O-0000Ed-CS for submit@debbugs.gnu.org; Mon, 06 Jun 2016 19:36:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37287) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bA44M-0000ER-Ss for 23675@debbugs.gnu.org; Mon, 06 Jun 2016 19:36:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bA44C-0004Dw-4Z for 23675@debbugs.gnu.org; Mon, 06 Jun 2016 19:36:25 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_50,HTML_MESSAGE, RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:34688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bA44C-0004Df-06 for 23675@debbugs.gnu.org; Mon, 06 Jun 2016 19:36:20 -0400 Received: from mail-oi0-f51.google.com ([209.85.218.51]:32802) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bA44A-0005eW-6s for 23675@debbugs.gnu.org; Mon, 06 Jun 2016 19:36:18 -0400 Received: by mail-oi0-f51.google.com with SMTP id k23so251253626oih.0 for <23675@debbugs.gnu.org>; Mon, 06 Jun 2016 16:36:18 -0700 (PDT) X-Gm-Message-State: ALyK8tJKxXYUXJqpo1aLrvB6Mb4CbKPWT4cVrT2DkKSFRw1/RT5A7IUkxBIIMe9CY4/HoeiXta/Ykgc4pcv73g== X-Received: by 10.202.178.197 with SMTP id b188mr8629982oif.155.1465256177413; Mon, 06 Jun 2016 16:36:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.205.17 with HTTP; Mon, 6 Jun 2016 16:35:47 -0700 (PDT) In-Reply-To: References: From: Robert Weiner Date: Mon, 6 Jun 2016 19:35:47 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Feature request: Emacs 25.0.94: count-lines should offer a way to ignore invisible lines, e.g. outline mode To: 23675@debbugs.gnu.org Content-Type: multipart/mixed; boundary=001a113b72a2f5d1720534a4899b X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -3.9 (---) X-Debbugs-Envelope-To: 23675 Cc: emacs-devel X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rswgnu@gmail.com Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.4 (------) --001a113b72a2f5d1720534a4899b Content-Type: multipart/alternative; boundary=001a113b72a2f5d16c0534a48999 --001a113b72a2f5d16c0534a48999 Content-Type: text/plain; charset=UTF-8 Attached is a patch to add this feature based on 25.0.94. Please consider applying it to Emacs. I have also included the full new version of the function below. --------------------- (defun count-lines (start end &optional ignore-invisible-lines-flag) "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. With optional IGNORE-INVISIBLE-LINES-FLAG non-nil, lines collapsed with selective-display are excluded from the line count." (save-excursion (save-restriction (narrow-to-region start end) (goto-char (point-min)) (cond ((and (not ignore-invisible-lines-flag) (eq selective-display t)) (save-match-data (let ((done 0)) (while (re-search-forward "\n\\|\r[^\n]" nil t 40) (setq done (+ 40 done))) (while (re-search-forward "\n\\|\r[^\n]" nil t 1) (setq done (+ 1 done))) (goto-char (point-max)) (if (and (/= start end) (not (bolp))) (1+ done) done)))) (ignore-invisible-lines-flag (- (buffer-size) (forward-line (buffer-size)) (let ((invisible-count 0) prop) (goto-char (point-min)) (while (re-search-forward "\n\\|\r[^\n]" nil t) (setq prop (get-char-property (1- (point)) 'invisible)) (if (if (eq buffer-invisibility-spec t) prop (or (memq prop buffer-invisibility-spec) (assq prop buffer-invisibility-spec))) (setq invisible-count (1+ invisible-count)))) invisible-count))) (t (- (buffer-size) (forward-line (buffer-size)))))))) --------------------- On Wed, Jun 1, 2016 at 10:23 AM, Robert Weiner wrote: > > Often when particular lines are hidden, one wants to count only visible lines. count-lines presently cannot do this. XEmacs has for a long-time had count-lines take an optional 3rd parameter flag which if non-nil, ignores invisible lines in the line count. This would be very helpful whenever selective-display is in use. > --001a113b72a2f5d16c0534a48999 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Attached is a patch to add this feature based on 25.0.94.= =C2=A0 Please consider applying it to Emacs.=C2=A0 I have also included the= full new version of the function below.

---------------------
<= div>(defun count-lines (start end &optional ignore-invisible-lines-flag= )
=C2=A0 "Return number of lines between START and END.
This is usually the number of newlines between them,
but ca= n be one more if START is not equal to END
and the greater of the= m is not at the start of a line.

With optional IGN= ORE-INVISIBLE-LINES-FLAG non-nil,
lines collapsed with selective-= display are excluded
from the line count."
=C2=A0 = (save-excursion
=C2=A0 =C2=A0 (save-restriction
=C2=A0 = =C2=A0 =C2=A0 (narrow-to-region start end)
=C2=A0 =C2=A0 =C2=A0 (= goto-char (point-min))
=C2=A0 =C2=A0 =C2=A0 (cond ((and (not igno= re-invisible-lines-flag) (eq selective-display t))
=C2=A0 =C2=A0 (save-match-data
<= div> =C2=A0 =C2=A0 =C2= =A0 (let ((done 0))
= (while (re-search-forward "\n\\|\r[^\n]" nil t 40)
<= div> =C2=A0 (setq done = (+ 40 done)))
(while (re-search-forward "\n\\|\r[^\n]" nil t 1)
=C2=A0 (setq done (+ 1 do= ne)))
(goto-= char (point-max))
(if (and (/=3D start end)
=C2=A0(not (bolp)))
=C2=A0 =C2=A0 (1+ done)
=C2=A0 done))))
=C2=A0 =C2=A0(ignore-invisibl= e-lines-flag
= =C2=A0 =C2=A0 (- (buffer-size) (forward-line (buffer-size))
(let ((invisible-count 0)
=C2=A0 =C2=A0 = =C2=A0prop)
= =C2=A0(goto-char (point-min))
=C2=A0(while (re-search-forward "\n\\|\r[^\n]" = nil t)
=C2= =A0 =C2=A0(setq prop (get-char-property (1- (point)) 'invisible))
=
=C2=A0 =C2=A0(if = (if (eq buffer-invisibility-spec t)
=C2=A0 =C2=A0prop
=C2=A0(or (memq prop buffer-invisibility-sp= ec)
=C2=A0 = =C2=A0 =C2=A0(assq prop buffer-invisibility-spec)))
(setq invisible-count (1+ invisib= le-count))))
= =C2=A0invisible-count)))
=C2=A0 =C2=A0(t (- (buffer-size) (forward-line (buffer-size)))= )))))

---------------------


On Wed, Jun= 1, 2016 at 10:23 AM, Robert Weiner <rsw@= gnu.org> wrote:
>
> Often when particular lines are hidd= en, one =C2=A0wants to count only visible lines. =C2=A0count-lines presentl= y cannot do this.=C2=A0 XEmacs has for a long-time had count-lines take an = optional 3rd parameter flag which if non-nil, ignores invisible lines in th= e line count.=C2=A0 This would be very helpful whenever selective-display i= s in use.
>
--001a113b72a2f5d16c0534a48999-- --001a113b72a2f5d1720534a4899b Content-Type: text/plain; charset=US-ASCII; name="count-lines-diff.txt" Content-Disposition: attachment; filename="count-lines-diff.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ip4nmaiw0 KioqIHNpbXBsZS1vcmlnLmVsCTIwMTYtMDYtMDYgMTk6MjQ6NTAuMDAwMDAwMDAwIC0wNDAwCi0t LSBzaW1wbGUuZWwJMjAxNi0wNi0wNiAxOToyNDo1MC4wMDAwMDAwMDAgLTA0MDAKKioqKioqKioq KioqKioqCioqKiAxMjE0LDEyNDEgKioqKgogIAkgIChtZXNzYWdlICJsaW5lICVkIChuYXJyb3dl ZCBsaW5lICVkKSIKICAJCSAgICgrIG4gKGxpbmUtbnVtYmVyLWF0LXBvcyBzdGFydCkgLTEpIG4p KSkpKSkKICAKISAoZGVmdW4gY291bnQtbGluZXMgKHN0YXJ0IGVuZCkKICAgICJSZXR1cm4gbnVt YmVyIG9mIGxpbmVzIGJldHdlZW4gU1RBUlQgYW5kIEVORC4KICBUaGlzIGlzIHVzdWFsbHkgdGhl IG51bWJlciBvZiBuZXdsaW5lcyBiZXR3ZWVuIHRoZW0sCiAgYnV0IGNhbiBiZSBvbmUgbW9yZSBp ZiBTVEFSVCBpcyBub3QgZXF1YWwgdG8gRU5ECiEgYW5kIHRoZSBncmVhdGVyIG9mIHRoZW0gaXMg bm90IGF0IHRoZSBzdGFydCBvZiBhIGxpbmUuIgogICAgKHNhdmUtZXhjdXJzaW9uCiAgICAgIChz YXZlLXJlc3RyaWN0aW9uCiAgICAgICAgKG5hcnJvdy10by1yZWdpb24gc3RhcnQgZW5kKQogICAg ICAgIChnb3RvLWNoYXIgKHBvaW50LW1pbikpCiEgICAgICAgKGlmIChlcSBzZWxlY3RpdmUtZGlz cGxheSB0KQohIAkgIChzYXZlLW1hdGNoLWRhdGEKISAJICAgIChsZXQgKChkb25lIDApKQohICAg ICAgICAgICAgICAgICAgICAgICh3aGlsZSAocmUtc2VhcmNoLWZvcndhcmQgIltcblxDLW1dIiBu aWwgdCA0MCkKISAgICAgICAgICAgICAgICAgICAgICAgIChzZXRxIGRvbmUgKCsgNDAgZG9uZSkp KQohICAgICAgICAgICAgICAgICAgICAgICh3aGlsZSAocmUtc2VhcmNoLWZvcndhcmQgIltcblxD LW1dIiBuaWwgdCAxKQohICAgICAgICAgICAgICAgICAgICAgICAgKHNldHEgZG9uZSAoKyAxIGRv bmUpKSkKISAgICAgICAgICAgICAgICAgICAgICAoZ290by1jaGFyIChwb2ludC1tYXgpKQohICAg ICAgICAgICAgICAgICAgICAgIChpZiAoYW5kICgvPSBzdGFydCBlbmQpCiEgCQkgICAgICAgKG5v dCAoYm9scCkpKQohIAkJICAoMSsgZG9uZSkKISAJCWRvbmUpKSkKISAJKC0gKGJ1ZmZlci1zaXpl KSAoZm9yd2FyZC1saW5lIChidWZmZXItc2l6ZSkpKSkpKSkKICAKICAoZGVmdW4gbGluZS1udW1i ZXItYXQtcG9zICgmb3B0aW9uYWwgcG9zKQogICAgIlJldHVybiAobmFycm93ZWQpIGJ1ZmZlciBs aW5lIG51bWJlciBhdCBwb3NpdGlvbiBQT1MuCi0tLSAxMjE0LDEyNTggLS0tLQogIAkgIChtZXNz YWdlICJsaW5lICVkIChuYXJyb3dlZCBsaW5lICVkKSIKICAJCSAgICgrIG4gKGxpbmUtbnVtYmVy LWF0LXBvcyBzdGFydCkgLTEpIG4pKSkpKSkKICAKISAoZGVmdW4gY291bnQtbGluZXMgKHN0YXJ0 IGVuZCAmb3B0aW9uYWwgaWdub3JlLWludmlzaWJsZS1saW5lcy1mbGFnKQogICAgIlJldHVybiBu dW1iZXIgb2YgbGluZXMgYmV0d2VlbiBTVEFSVCBhbmQgRU5ELgogIFRoaXMgaXMgdXN1YWxseSB0 aGUgbnVtYmVyIG9mIG5ld2xpbmVzIGJldHdlZW4gdGhlbSwKICBidXQgY2FuIGJlIG9uZSBtb3Jl IGlmIFNUQVJUIGlzIG5vdCBlcXVhbCB0byBFTkQKISBhbmQgdGhlIGdyZWF0ZXIgb2YgdGhlbSBp cyBub3QgYXQgdGhlIHN0YXJ0IG9mIGEgbGluZS4KISAKISBXaXRoIG9wdGlvbmFsIElHTk9SRS1J TlZJU0lCTEUtTElORVMtRkxBRyBub24tbmlsLAohIGxpbmVzIGNvbGxhcHNlZCB3aXRoIHNlbGVj dGl2ZS1kaXNwbGF5IGFyZSBleGNsdWRlZAohIGZyb20gdGhlIGxpbmUgY291bnQuIgogICAgKHNh dmUtZXhjdXJzaW9uCiAgICAgIChzYXZlLXJlc3RyaWN0aW9uCiAgICAgICAgKG5hcnJvdy10by1y ZWdpb24gc3RhcnQgZW5kKQogICAgICAgIChnb3RvLWNoYXIgKHBvaW50LW1pbikpCiEgICAgICAg KGNvbmQgKChhbmQgKG5vdCBpZ25vcmUtaW52aXNpYmxlLWxpbmVzLWZsYWcpIChlcSBzZWxlY3Rp dmUtZGlzcGxheSB0KSkKISAJICAgICAoc2F2ZS1tYXRjaC1kYXRhCiEgCSAgICAgICAobGV0ICgo ZG9uZSAwKSkKISAJCSAod2hpbGUgKHJlLXNlYXJjaC1mb3J3YXJkICJcblxcfFxyW15cbl0iIG5p bCB0IDQwKQohIAkJICAgKHNldHEgZG9uZSAoKyA0MCBkb25lKSkpCiEgCQkgKHdoaWxlIChyZS1z ZWFyY2gtZm9yd2FyZCAiXG5cXHxcclteXG5dIiBuaWwgdCAxKQohIAkJICAgKHNldHEgZG9uZSAo KyAxIGRvbmUpKSkKISAJCSAoZ290by1jaGFyIChwb2ludC1tYXgpKQohIAkJIChpZiAoYW5kICgv PSBzdGFydCBlbmQpCiEgCQkJICAobm90IChib2xwKSkpCiEgCQkgICAgICgxKyBkb25lKQohIAkJ ICAgZG9uZSkpKSkKISAJICAgIChpZ25vcmUtaW52aXNpYmxlLWxpbmVzLWZsYWcKISAJICAgICAo LSAoYnVmZmVyLXNpemUpIChmb3J3YXJkLWxpbmUgKGJ1ZmZlci1zaXplKSkKISAJCShsZXQgKChp bnZpc2libGUtY291bnQgMCkKISAJCSAgICAgIHByb3ApCiEgCQkgIChnb3RvLWNoYXIgKHBvaW50 LW1pbikpCiEgCQkgICh3aGlsZSAocmUtc2VhcmNoLWZvcndhcmQgIlxuXFx8XHJbXlxuXSIgbmls IHQpCiEgCQkgICAgKHNldHEgcHJvcCAoZ2V0LWNoYXItcHJvcGVydHkgKDEtIChwb2ludCkpICdp bnZpc2libGUpKQohIAkJICAgIChpZiAoaWYgKGVxIGJ1ZmZlci1pbnZpc2liaWxpdHktc3BlYyB0 KQohIAkJCSAgICBwcm9wCiEgCQkJICAob3IgKG1lbXEgcHJvcCBidWZmZXItaW52aXNpYmlsaXR5 LXNwZWMpCiEgCQkJICAgICAgKGFzc3EgcHJvcCBidWZmZXItaW52aXNpYmlsaXR5LXNwZWMpKSkK ISAJCQkoc2V0cSBpbnZpc2libGUtY291bnQgKDErIGludmlzaWJsZS1jb3VudCkpKSkKISAJCSAg aW52aXNpYmxlLWNvdW50KSkpCiEgCSAgICAodCAoLSAoYnVmZmVyLXNpemUpIChmb3J3YXJkLWxp bmUgKGJ1ZmZlci1zaXplKSkpKSkpKSkKICAKICAoZGVmdW4gbGluZS1udW1iZXItYXQtcG9zICgm b3B0aW9uYWwgcG9zKQogICAgIlJldHVybiAobmFycm93ZWQpIGJ1ZmZlciBsaW5lIG51bWJlciBh dCBwb3NpdGlvbiBQT1MuCg== --001a113b72a2f5d1720534a4899b-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 07 11:58:10 2016 Received: (at 23675) by debbugs.gnu.org; 7 Jun 2016 15:58:10 +0000 Received: from localhost ([127.0.0.1]:58915 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bAJOM-0002Bv-L0 for submit@debbugs.gnu.org; Tue, 07 Jun 2016 11:58:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59977) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bAJOL-0002Bj-53 for 23675@debbugs.gnu.org; Tue, 07 Jun 2016 11:58:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAJOB-0006ld-7Z for 23675@debbugs.gnu.org; Tue, 07 Jun 2016 11:58:04 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAJOB-0006lX-48; Tue, 07 Jun 2016 11:57:59 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4681 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bAJO8-0004TJ-9T; Tue, 07 Jun 2016 11:57:56 -0400 Date: Tue, 07 Jun 2016 18:58:32 +0300 Message-Id: <83a8ixrnx3.fsf@gnu.org> From: Eli Zaretskii To: rswgnu@gmail.com In-reply-to: (message from Robert Weiner on Mon, 6 Jun 2016 19:35:47 -0400) Subject: Re: Feature request: Emacs 25.0.94: count-lines should offer a way to ignore invisible lines, e.g. outline mode References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 23675 Cc: 23675@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.4 (------) > From: Robert Weiner > Date: Mon, 6 Jun 2016 19:35:47 -0400 > Cc: emacs-devel > > Attached is a patch to add this feature based on 25.0.94. Please consider applying it to Emacs. I have also > included the full new version of the function below. Thanks. Any reason why you didn't use forward-visible-line, which would leave the skipping of invisible text to that function, and make your code simpler? From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 07 18:18:06 2016 Received: (at 23675) by debbugs.gnu.org; 7 Jun 2016 22:18:06 +0000 Received: from localhost ([127.0.0.1]:59205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bAPK1-0007uo-Su for submit@debbugs.gnu.org; Tue, 07 Jun 2016 18:18:06 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46423) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bAPK0-0007uK-8L for 23675@debbugs.gnu.org; Tue, 07 Jun 2016 18:18:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAPJq-0005sU-1W for 23675@debbugs.gnu.org; Tue, 07 Jun 2016 18:17:58 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_40,HTML_MESSAGE, RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:57960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAPJp-0005sJ-UY for 23675@debbugs.gnu.org; Tue, 07 Jun 2016 18:17:53 -0400 Received: from mail-oi0-f47.google.com ([209.85.218.47]:35185) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bAPJo-0000V4-Co for 23675@debbugs.gnu.org; Tue, 07 Jun 2016 18:17:52 -0400 Received: by mail-oi0-f47.google.com with SMTP id s139so60900991oie.2 for <23675@debbugs.gnu.org>; Tue, 07 Jun 2016 15:17:52 -0700 (PDT) X-Gm-Message-State: ALyK8tLf5x+AGFwgbGGWSi2XsrD1op1LGlxA14Dp1Hbsl5FxVTky+JdubTkeM9KdzavLHF1JqA3QGXBAH8Roig== X-Received: by 10.202.205.140 with SMTP id d134mr1145439oig.119.1465337871682; Tue, 07 Jun 2016 15:17:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.202.236.73 with HTTP; Tue, 7 Jun 2016 15:17:22 -0700 (PDT) In-Reply-To: <83a8ixrnx3.fsf@gnu.org> References: <83a8ixrnx3.fsf@gnu.org> From: Robert Weiner Date: Tue, 7 Jun 2016 18:17:22 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Feature request: Emacs 25.0.94: count-lines should offer a way to ignore invisible lines, e.g. outline mode To: Eli Zaretskii Content-Type: multipart/alternative; boundary=001a11c14dfc51569e0534b78f7a X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -3.9 (---) X-Debbugs-Envelope-To: 23675 Cc: 23675@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rswgnu@gmail.com Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.4 (------) --001a11c14dfc51569e0534b78f7a Content-Type: text/plain; charset=UTF-8 On Tue, Jun 7, 2016 at 11:58 AM, Eli Zaretskii wrote: > > Any reason why you didn't use forward-visible-line, which would leave > the skipping of invisible text to that function, and make your code > simpler? > Because unlike forward-line, forward-visible-line does not indicate how many lines it failed to move when it cannot move the requested amount (of course it should). Therefore, I could not tell when it failed to move and would have had to add other buffer location tests. I hope that explains it sufficiently. Bob --001a11c14dfc51569e0534b78f7a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Tue, Jun 7, 2016 at 11:58 AM, Eli Zaretskii=C2=A0<eliz@gnu.= org>=C2=A0wrote:
Any reason why you didn'= t use forward-visible-line, which would leave
the skipping of invisible = text to that function, and make your code
simpler?
=
Because unlike forward-line, forward-visible-line does not i= ndicate how many lines it failed to move when it cannot move the requested = amount (of course it should).=C2=A0 Therefore, I could not tell when it fai= led to move and would have had to add other buffer location tests.=C2=A0 I = hope that explains it sufficiently.

Bob
=
--001a11c14dfc51569e0534b78f7a-- From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 25 09:30:54 2019 Received: (at 23675) by debbugs.gnu.org; 25 Jun 2019 13:30:54 +0000 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 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 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 From: Lars Ingebrigtsen To: Robert Weiner Subject: Re: bug#23675: Feature request: Emacs 25.0.94: count-lines should offer a way to ignore invisible lines, e.g. outline mode References: 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 Date: Tue, 25 Jun 2019 15:30:44 +0200 In-Reply-To: (Robert Weiner's message of "Mon, 6 Jun 2016 19:35:47 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: 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 th [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 23675 Cc: rswgnu@gmail.com, 23675@debbugs.gnu.org, emacs-devel X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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 From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 25 11:27:00 2019 Received: (at 23675) by debbugs.gnu.org; 25 Jun 2019 15:27:00 +0000 Received: from localhost ([127.0.0.1]:33237 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfnLX-0006P0-RA for submit@debbugs.gnu.org; Tue, 25 Jun 2019 11:27:00 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:3897) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfnLU-0006Om-G6 for 23675@debbugs.gnu.org; Tue, 25 Jun 2019 11:26:57 -0400 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 5BC254440E0; Tue, 25 Jun 2019 11:26:50 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E8E49442B6C; Tue, 25 Jun 2019 11:26:48 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1561476408; bh=Q7xySiXw1KlmoOZ2aooyoFhWR2b8b0RY8/uLDQeSpG4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=FxCp7yDmmtAcAlvezDbMGRueeg3JaR0cnmDn4Sf12Z6ZQKVxli8ubVgHubOHXjfbk 63aWT8r+J47OutJl7Hiil89tKyaUV+toZnbPE47z5Wo8KHbyJLNTQorJYAdzZu+LtU L/dYxPQ8cIYl8M+wUwT1X05AVom2Nb1Uent8d/WanITkz1xVtmU99epEXX9fL9SEgr mNDjmcWi8a4iFYQ8hNBImbi8Hqf1nLTtgHTm7GJN/ev5msjqEMOr8iQfKoF5SGIF5G Snh2dJ1TAzssB3ogyjbI4X9xc1v6untR2uHqhYCs9kJS0sMkOpGUqp+v+Yhql/EP1U 2ConkCPNk8xeQ== Received: from pastel (69-196-134-84.dsl.teksavvy.com [69.196.134.84]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BF1FC1204BB; Tue, 25 Jun 2019 11:26:48 -0400 (EDT) From: Stefan Monnier To: Lars Ingebrigtsen Subject: Re: bug#23675: Feature request: Emacs 25.0.94: count-lines should offer a way to ignore invisible lines, e.g. outline mode Message-ID: References: Date: Tue, 25 Jun 2019 11:26:47 -0400 In-Reply-To: (Lars Ingebrigtsen's message of "Tue, 25 Jun 2019 15:30:44 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.010 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 23675 Cc: 23675@debbugs.gnu.org, Robert Weiner X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >> ! (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, That's because the t value of selective-display has been described as obsolete in the manual since 2013. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 25 11:29:51 2019 Received: (at 23675) by debbugs.gnu.org; 25 Jun 2019 15:29:51 +0000 Received: from localhost ([127.0.0.1]:33253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfnOJ-0006US-7H for submit@debbugs.gnu.org; Tue, 25 Jun 2019 11:29:51 -0400 Received: from quimby.gnus.org ([80.91.231.51]:51420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfnOH-0006UK-NB for 23675@debbugs.gnu.org; Tue, 25 Jun 2019 11:29:50 -0400 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 1hfnOD-0001OP-1z; Tue, 25 Jun 2019 17:29:47 +0200 From: Lars Ingebrigtsen To: Stefan Monnier Subject: Re: bug#23675: Feature request: Emacs 25.0.94: count-lines should offer a way to ignore invisible lines, e.g. outline mode References: Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEUHBgXW1tZkY2IYFxYF AwMKCAdn2ceNAAACZ0lEQVQ4jU2UTW7jMAyFido6gBR0X0vw3hbLvYEqe44V3v8q8yg7nVFTBdZn /j1SIVK7Vjc1nZ/vJyIj68yCDc+thQsw+ZZzZnYopE9T9Vfxn6OvFFORvRjcuVknO3NeBoq51GKE 83aETn1PufpxWVLpQkQADYCX5CapGDY4usBhxAVhgTJA9PAEZzNAXyl0kLL9ifFhPG2v2YMQiyKx vHy2Halx51VnIgCvxoM/6I8nxozEyEKgwNY93bTuvos82AL+iKoZjlCC4yKGnN0LaQ12elirOSbV gAQGCP7ZI7ToCPU9/3zaIEQBup9woUGW+DWH1Uyqg6EyTfxqanmlA08Znv28s1bh0D7wsueve3yM fuiJV8KTP1LNW3uGnisP4IUklyouaYPvDlkdQCposY2WPMhbi/KFPOMa13mGVYxfDUKNuKQ0h5q+ 27GXKcbt1Q4aVuSrFmnPpXBFgVfFNzgXzEmFslncz5DcG0lnLLxAx1zYg2q4QfuA3NYFBsJK18gB zMd0z0+UcRJuUDX8D2xM7QAr+QhhUCLEUm/rbfFFOQuGEPXae9gZ4Oe7hVrdz/kPdIDDx2iA/gtw DXwhDYFyPZe3Ix7gOMI03h0bOt1LYZJA7Zj0bXdZFHSwozWtKwYWV0WuCThzqmQzOhDa62gULrMu veRCrq9SQ3Z0LTcpMV/fFcJWXAVov3qMeAOokR8AvtaJx8EAfK8y7nQw4ZrorjRM5ZKKaBOBa7pr wowyq19OpId48RfcQ4yhaZwfHGk+/JoiV72aBEV7Zlj4D4Ff7G1oMcMVWRUA+LyWmuAXBpVrPyH0 Xwhi31X7JUg5AAAAAElFTkSuQmCC Date: Tue, 25 Jun 2019 17:29:44 +0200 In-Reply-To: (Stefan Monnier's message of "Tue, 25 Jun 2019 11:26:47 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Stefan Monnier writes: >> Hm... the current version of the function doesn't mention >> selective-display at all, > > That's because the t value of selective-display has been described as > obsolete in the manual since 2013. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 23675 Cc: 23675@debbugs.gnu.org, Robert Weiner X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Monnier writes: >> Hm... the current version of the function doesn't mention >> selective-display at all, > > That's because the t value of selective-display has been described as > obsolete in the manual since 2013. Aha. But then the new doc string (if we apply this patch) shouldn't either, I guess... -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 25 11:33:55 2019 Received: (at 23675) by debbugs.gnu.org; 25 Jun 2019 15:33:55 +0000 Received: from localhost ([127.0.0.1]:33276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfnSE-0006eJ-PN for submit@debbugs.gnu.org; Tue, 25 Jun 2019 11:33:54 -0400 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:36098) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hfnSD-0006e5-RS for 23675@debbugs.gnu.org; Tue, 25 Jun 2019 11:33:54 -0400 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 810E481153; Tue, 25 Jun 2019 11:33:48 -0400 (EDT) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 5172E80D82; Tue, 25 Jun 2019 11:33:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1561476827; bh=5hk2qiIsolNn6zepTxIXy0tmz5pV52DWNVxJloWXf7s=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=TNNDZczZmrIildUSO7dZfMCHBD9r0iVcT8vvnyWPX95txmsn22Ii/W81EgYY3AajV 8wpxTN0hQK9yLBxtQcR1rtGFVAY6UUJDSBopVixZhTOYac9s1QrE1CZ/XZPD/cj9gl 5/X6E7p/OURO+u1fKk8jbDLEGYsnBlEBt4pvUuWKQUPPUN/JLFmJt/zql8HzR6wLAw IUpbX0niX00gc7tD1u5gvKzSEqqF9EyuaAemoqLWJN7cK7SVb8itH7DCkMvie0xm9X MDKzPFrK2YvXn1m2O4CLVrBpHgJ3bjurqAu8o14GSyilcg9LSQtx59Q1xn4nw31hZ1 JalzwZHfVoK6w== Received: from pastel (69-196-134-84.dsl.teksavvy.com [69.196.134.84]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id F4060120AC4; Tue, 25 Jun 2019 11:33:46 -0400 (EDT) From: Stefan Monnier To: Robert Weiner Subject: Re: bug#23675: Feature request: Emacs 25.0.94: count-lines should offer a way to ignore invisible lines, e.g. outline mode Message-ID: References: <83a8ixrnx3.fsf@gnu.org> Date: Tue, 25 Jun 2019 11:33:44 -0400 In-Reply-To: (Robert Weiner's message of "Tue, 7 Jun 2016 18:17:22 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.005 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 23675 Cc: Eli Zaretskii , rswgnu@gmail.com, 23675@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >> Any reason why you didn't use forward-visible-line, which would leave >> the skipping of invisible text to that function, and make your code >> simpler? > Because unlike forward-line, forward-visible-line does not indicate how > many lines it failed to move when it cannot move the requested amount (of > course it should). Then let's fix that. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 11 10:53:59 2020 Received: (at 23675) by debbugs.gnu.org; 11 Aug 2020 14:54:00 +0000 Received: from localhost ([127.0.0.1]:41379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5Vf5-0004Fm-KI for submit@debbugs.gnu.org; Tue, 11 Aug 2020 10:53:59 -0400 Received: from quimby.gnus.org ([95.216.78.240]:33322) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5Vez-0004FS-Oj for 23675@debbugs.gnu.org; Tue, 11 Aug 2020 10:53:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=FSC9i1afE2EWyLX4yaZv2EU5ms4CBujMVUIWF+SRBhk=; b=bSkuuJWzLuhQMAtqdXgSe6mfd5 HpdBxWdfEnFgHiZ1ya1bJE6fjYGOqE2wKXaL4GDTk5fRXKaKWFWMFVsFWbPHFvQPQz0NzGR5t6Kmt ZPD4/0DyqSQYCm09sN2xWr4hG0gYAFeF5ftdrJPPuVbLKqZptugPMvivDC3Gt3RtoVy0=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k5Veq-00051P-NP; Tue, 11 Aug 2020 16:53:47 +0200 From: Lars Ingebrigtsen To: Robert Weiner Subject: Re: bug#23675: Feature request: Emacs 25.0.94: count-lines should offer a way to ignore invisible lines, e.g. outline mode References: Date: Tue, 11 Aug 2020 16:53:43 +0200 In-Reply-To: (Robert Weiner's message of "Mon, 6 Jun 2016 19:35:47 -0400") Message-ID: <87mu31ters.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Robert Weiner writes: > Attached is a patch to add this feature based on 25.0.94. Please > consider applying it to Emacs. I have also included the full new > version of the function below. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 23675 Cc: rswgnu@gmail.com, 23675@debbugs.gnu.org, emacs-devel X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Robert Weiner writes: > Attached is a patch to add this feature based on 25.0.94. Please > consider applying it to Emacs. I have also included the full new > version of the function below. There were some comments about implementing this based on other functions, but that was never followed up, so I went ahead and applied the patch to Emacs 28. Further improvements are left as an exercise for the reader. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 11 10:54:07 2020 Received: (at control) by debbugs.gnu.org; 11 Aug 2020 14:54:07 +0000 Received: from localhost ([127.0.0.1]:41384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5VfC-0004Gc-TA for submit@debbugs.gnu.org; Tue, 11 Aug 2020 10:54:07 -0400 Received: from quimby.gnus.org ([95.216.78.240]:33336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k5VfB-0004Fu-Ax for control@debbugs.gnu.org; Tue, 11 Aug 2020 10:54:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=vJDCzI8WofFKzcVMinDZ9VcTd4SxqIeHELybU8cz3E0=; b=tKLD8Lsbbz2DqOeBqaUpvW237+ Kq4wDeNOlaiEK4649wazCPcac/Daga7jfQStCI8Pq34+RPzvMe28SPNZ8hAUcBoa/m4JTAubWvoAt KMsxbvnZo4z52TJGbyKDktseBNQjXlEPruFu2LbnZgk1ZbDa+addbWpsztOm87xmE4IU=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k5Vf3-00051r-KA for control@debbugs.gnu.org; Tue, 11 Aug 2020 16:53:59 +0200 Date: Tue, 11 Aug 2020 16:53:56 +0200 Message-Id: <87lfilterf.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #23675 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 23675 fixed close 23675 28.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 23675 fixed close 23675 28.1 quit From unknown Wed Jun 25 09:08:35 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 09 Sep 2020 11:24:11 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 04 08:54:02 2023 Received: (at control) by debbugs.gnu.org; 4 Aug 2023 12:54:02 +0000 Received: from localhost ([127.0.0.1]:53565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qRuJd-0003el-Qy for submit@debbugs.gnu.org; Fri, 04 Aug 2023 08:54:02 -0400 Received: from mail-108-mta71.mxroute.com ([136.175.108.71]:33707) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qRuJa-0003eK-2B for control@debbugs.gnu.org; Fri, 04 Aug 2023 08:53:59 -0400 Received: from mail-111-mta2.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta71.mxroute.com (ZoneMTA) with ESMTPSA id 189c09c99f000023b6.001 for (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Fri, 04 Aug 2023 12:53:55 +0000 X-Zone-Loop: a061ea4028e9f3c9fbd30845f532d9d89d4009f9a7c3 X-Originating-IP: [136.175.111.2] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From:Sender: Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=UhUof3eMwUlINBzZlGLWrWgR0ucXvZ5owo0BzDWZDJg=; b=lmJFqzW4rtQIBFDleWsAAVLe7k 9POue4mRS3wYIy146Xw4bohhuS8GgdKHztPMWvC/FcEfehw2wV4C66/r+MW5EV89sMHqAHF09YsxV sVSN6pZTKpx8Veicr6yhBtVmkFmYaD+4ReKojIWwnfgYXpDfZNYK9hZ1+Ntcl9DyLuoPSMwOZo3vm DXi1KOkqF3nmaib8ic7Dp9NmTJyZlqgKoEDfT5VsEZeqZ0RFbJKCI/rYDQLlIhcag8SpSF+dcCAwM z4GGj9nsKeNu713Ut4s2pBEwzHnw67aISOincKzDJbExABNBcwGLsajR4jvfwfEAkn/cyzb0hfVfp 302Fwbmw==; From: "J.P." To: control@debbugs.gnu.org Subject: control message for bug #23675 Date: Fri, 04 Aug 2023 05:53:52 -0700 Message-ID: <87leerynmn.fsf@neverwas.me> MIME-Version: 1.0 Content-Type: text/plain X-Authenticated-Id: masked@neverwas.me X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) unarchive 23675 quit From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 04 20:35:42 2023 Received: (at 23675) by debbugs.gnu.org; 5 Aug 2023 00:35:42 +0000 Received: from localhost ([127.0.0.1]:55041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qS5Gf-00062K-L8 for submit@debbugs.gnu.org; Fri, 04 Aug 2023 20:35:42 -0400 Received: from mail-108-mta53.mxroute.com ([136.175.108.53]:46607) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qS5Gc-00062A-A3 for 23675@debbugs.gnu.org; Fri, 04 Aug 2023 20:35:39 -0400 Received: from mail-111-mta2.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta53.mxroute.com (ZoneMTA) with ESMTPSA id 189c31ef0cf00023b6.001 for <23675@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sat, 05 Aug 2023 00:35:32 +0000 X-Zone-Loop: 5584f6294486926cde9cbd4d13f719fee0da0c84a1ab X-Originating-IP: [136.175.111.2] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=dbuq0jS7TA4upKCb3JaH3Kuj4HWahljxyI4IdES9O+A=; b=U9XS2kswe9Hh/ewF82Gj4WSKlT odMrlzg2aAvZIh9MZcYvIm6IYPNxEpjem15RzGLENo1oT+OoUjd+LJut6b8aRWChdFLCdXBciGbs9 6B7XQvL8gcgLoBhWjL+OZnjniKq5IOdzVDPK4kzxIllnOqzxdhiWE7aJ3rPM+8wXHnJMwOqf3uI2k g2wsPE+vjFbS4I8ERQMP5uHkeKv8hKGQpVG9Vrmb+1Y4peoWYOaU6rSWcB0c/XsJzPkcBFPYp2tez rCHHC/lbrkmaQdDTwB/AxDYm7vuMwChtmZNFtezpDCT61q/lNqUZz6oBZjbZU0Sjd48s3F+uqzJee QxxXQprg==; From: "J.P." To: 23675@debbugs.gnu.org Subject: Re: bug#23675: 30.0.50: make count-lines optionally ignore invisible lines In-Reply-To: (Robert Weiner's message of "Wed, 1 Jun 2016 10:23:56 -0400") References: Date: Fri, 04 Aug 2023 17:35:27 -0700 Message-ID: <87ttteuy0g.fsf@neverwas.me> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Authenticated-Id: masked@neverwas.me X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 23675 Cc: emacs-erc@gnu.org, rsw@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Closed in 2020 (Emacs 28). Perhaps I'm not understanding how the `ignore-invisible-lines' parameter for `count-lines' is supposed to work, but it doesn't seem to make the function consider `invisible' text properties that have lists as values. I bring this up because ERC will likely be needing a line-counting function that's list-aware, at least in the manner shown in the attached tests. The change to `count-lines' accompanying these tests was merely lifted from `forward-visible-line' to make them pass, but it's quite possibly flawed and/or incomplete. If a proper solution ever emerges to address this, hopefully it'll come at the hands of someone better informed than I in the ways of Emacs invisibility. In the meantime (2023), ERC will likely be doing its own subpar rendition unless someone takes up the challenge for 30.1 (and Compat agrees to adopt it). Thanks. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-POC-Honor-invisible-text-prop-list-values-in-count-l.patch Content-Transfer-Encoding: quoted-printable >From 68fb034a60f74ea3cab9acd8e35bdf52ba9d5024 Mon Sep 17 00:00:00 2001 From: "F. Jason Park" Date: Thu, 3 Aug 2023 22:24:57 -0700 Subject: [PATCH] [POC] Honor invisible text-prop list values in count-lines * lisp/simple.el (count-lines): Use `invisible-p' when `ignore-invisible-lines' parameter is non-nil. * test/lisp/simple-tests.el (simple-tests-count-lines/invisible/interval, simple-tests-count-lines/invisible/list/single, simple-tests-count-lines/invisible/list/tail): Add tests. (Bug#23675) --- lisp/simple.el | 19 ++++-------- test/lisp/simple-tests.el | 62 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 14 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 6dc08ff0eb0..5c414fb364f 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -1782,20 +1782,11 @@ count-lines done)))) (ignore-invisible-lines (goto-char (point-min)) - (save-match-data - (- (buffer-size) - (forward-line (buffer-size)) - (let ((invisible-count 0) - prop) - (goto-char (point-min)) - (while (re-search-forward "\n\\|\r[^\n]" nil t) - (setq prop (get-char-property (1- (point)) 'invisible)) - (if (if (eq buffer-invisibility-spec t) - prop - (or (memq prop buffer-invisibility-spec) - (assq prop buffer-invisibility-spec))) - (setq invisible-count (1+ invisible-count)))) - invisible-count)))) + (let ((count (if (eobp) 0 1))) + (while (and (zerop (forward-line)) (not (eobp))) + (unless (invisible-p (1- (point))) + (cl-incf count))) + count)) (t (goto-char (point-max)) (if (bolp) diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el index 7dabb735522..e8e83c9a5cd 100644 --- a/test/lisp/simple-tests.el +++ b/test/lisp/simple-tests.el @@ -67,6 +67,68 @@ simple-test-count-lines/ignore-invisible-lines (insert (propertize "\nbar\nbaz\nzut" 'invisible t)) (should (=3D (count-lines (point-min) (point-max) t) 2)))) =20 +(ert-deftest simple-tests-count-lines/invisible/interval () + (with-current-buffer (get-buffer-create "*count-lines/invisible/interval= *") + (should (=3D 0 (count-lines (point-min) (point-max) t))) ; invisible + (insert "pre\n" + "before\n" + (propertize "0\n" 'invisible t) + (propertize "1\n" 'invisible t) + (propertize "2\n" 'invisible t) + (propertize "3\n" 'invisible t) + "after\n" + "post\n") + (should (equal buffer-invisibility-spec 't)) + (with-restriction 5 (- (point-max) 5) + (goto-char (point-min)) + (should (looking-at "before")) + (goto-char (point-max)) + (should (looking-back "after\n"))) + (should (=3D 6 (count-lines 5 (- (point-max) 5)))) + (should (=3D 2 (count-lines 5 (- (point-max) 5) t))) ; invisible + (when noninteractive (kill-buffer)))) + +(ert-deftest simple-tests-count-lines/invisible/list/single () + (with-current-buffer (get-buffer-create "*count-lines/invisible/list/hea= d*") + (insert "before\n" + (propertize "0\n" 'invisible '(0)) + (propertize "1\n" 'invisible '(1)) + (propertize "2\n" 'invisible '(2)) + (propertize "3\n" 'invisible '(3)) + "after\n") + (setq buffer-invisibility-spec '(0 1 (2 . t) 3 t)) + (should (=3D 6 (count-lines (point-min) (point-max)))) + (should (=3D 2 (count-lines (point-min) (point-max) t))) ; invisible + (when noninteractive (kill-buffer))) + + (with-current-buffer (get-buffer-create "*count-lines/invisible/list/alt= *") + (insert "before\n" + (propertize "0\n" 'invisible '(0)) + "a\n" + (propertize "1\n" 'invisible '(1)) + "b\n" + (propertize "2\n" 'invisible '(2)) + "c\n" + (propertize "3\n" 'invisible '(3)) + "after\n") + (setq buffer-invisibility-spec '(0 1 (2 . t) 3 t)) + (should (=3D 9 (count-lines (point-min) (point-max)))) + (should (=3D 5 (count-lines (point-min) (point-max) t))) ; invisible + (when noninteractive (kill-buffer)))) + +(ert-deftest simple-tests-count-lines/invisible/list/tail () + (with-current-buffer (get-buffer-create "*count-lines/invisible/list/tai= l*") + (insert "before\n" + (propertize "0\n" 'invisible '(x 0)) + (propertize "1\n" 'invisible '(x 1)) + (propertize "2\n" 'invisible '(x 2)) + (propertize "3\n" 'invisible '(x 3)) + "after\n") + (setq buffer-invisibility-spec '(0 (1 . t) 2 3 t)) + (should (=3D 6 (count-lines (point-min) (point-max)))) + (should (=3D 2 (count-lines (point-min) (point-max) t))) ; invisible + (when noninteractive (kill-buffer)))) + (ert-deftest simple-text-count-lines-non-ascii () (with-temp-buffer (insert "=E3=81=82\n=E3=81=84\n=E3=81=86\n=E3=81=88\n=E3=81=8A\n") --=20 2.41.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 05 02:32:22 2023 Received: (at 23675) by debbugs.gnu.org; 5 Aug 2023 06:32:22 +0000 Received: from localhost ([127.0.0.1]:55257 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSApq-00016P-AA for submit@debbugs.gnu.org; Sat, 05 Aug 2023 02:32:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56770) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSApo-00016D-OQ for 23675@debbugs.gnu.org; Sat, 05 Aug 2023 02:32:21 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSApi-0008Af-9k; Sat, 05 Aug 2023 02:32:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=6mSkyRW3kCWsMS6gAdsN7AXLmHgTgyFAkVS5M+7XOs4=; b=ZRuN3cb+BWWT iEHSfUMHaHX+VRnfyNWn9/BtIJ7TVSrNFW7gZA08Fqc928enJ8OayjyifSFEkxgTqetjh3+QEGcig ms9j3C4HhrWI7tusR6cwB1JKYbpf/bJSmkkc22visw0kYSxQhAZuqxrYwLUnK+APXJ5PYiIUM6uIy cXqqxzfZezUJ8sTFbGdyxUozKho+H/y1Y8LYTWvwtqIlNS3zbOCx/ZtzIoV/C3/bIG65TIxPkf4Sk +PavTWB+SLME7zeswu0M19/ZvNsQ3B7QDpQ+thTuyjpQHxlapskoG4Yf+w9d52YvG0G65YJJEGbSa MA/k+3lsg7+hgm/tUAeaSA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qSApf-0004hD-VB; Sat, 05 Aug 2023 02:32:13 -0400 Date: Sat, 05 Aug 2023 09:32:26 +0300 Message-Id: <83v8dut2x1.fsf@gnu.org> From: Eli Zaretskii To: "J.P." In-Reply-To: <87ttteuy0g.fsf@neverwas.me> (jp@neverwas.me) Subject: Re: bug#23675: 30.0.50: make count-lines optionally ignore invisible lines References: <87ttteuy0g.fsf@neverwas.me> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 23675 Cc: emacs-erc@gnu.org, Stefan Monnier , 23675@debbugs.gnu.org, rsw@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: emacs-erc@gnu.org, rsw@gnu.org > From: "J.P." > Date: Fri, 04 Aug 2023 17:35:27 -0700 > > Perhaps I'm not understanding how the `ignore-invisible-lines' parameter > for `count-lines' is supposed to work, but it doesn't seem to make the > function consider `invisible' text properties that have lists as values. > I bring this up because ERC will likely be needing a line-counting > function that's list-aware, at least in the manner shown in the attached > tests. The change to `count-lines' accompanying these tests was merely > lifted from `forward-visible-line' to make them pass, but it's quite > possibly flawed and/or incomplete. If a proper solution ever emerges to > address this, hopefully it'll come at the hands of someone better > informed than I in the ways of Emacs invisibility. In the meantime > (2023), ERC will likely be doing its own subpar rendition unless someone > takes up the challenge for 30.1 (and Compat agrees to adopt it). Thanks. This is OK for master, but please don't use cl-incf in simple.el, as there's no real need to do so there. Stefan, any comments? From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 06 09:03:51 2023 Received: (at 23675) by debbugs.gnu.org; 6 Aug 2023 13:03:51 +0000 Received: from localhost ([127.0.0.1]:58771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSdQF-0006mS-02 for submit@debbugs.gnu.org; Sun, 06 Aug 2023 09:03:51 -0400 Received: from mail-108-mta9.mxroute.com ([136.175.108.9]:36235) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qSdQ9-0006mF-Us for 23675@debbugs.gnu.org; Sun, 06 Aug 2023 09:03:49 -0400 Received: from mail-111-mta2.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta9.mxroute.com (ZoneMTA) with ESMTPSA id 189caf2466b00023b6.001 for <23675@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Sun, 06 Aug 2023 13:03:42 +0000 X-Zone-Loop: bf995b26e346d5a159a3c3315f811bbfb894d86b7228 X-Originating-IP: [136.175.111.2] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=neverwas.me ; s=x; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=7YxMA1R+bf29ury7mqwGIkVrzwuGNirZWBPli6jDI2k=; b=f0hM3sVSCdjij2OkdaddJwN6BD JKwF9g0zEeWi5xtN7sixui9KcLcOAEuiWyYt6Ik9FcGbabobECBZTgTPDzYSAaEGq9UD3u3il4JXd poLwIJCvSp7LQErDQVhAdYa3UqLKQ2OM1lqw5vZyT/RYql6Xs3G7+h/T9yIHzBPmcJGJYbg4Dfb0x LNbBJCs2GfLixW3RQV4YNdQTioZT8Vlyxdm5Ryaxrb/vS71o0QwTjexXdT52gP0MZqE9aww4Qs5wt h3CBMZ9PDIhDIBKQpzqTX6Kx20Nt/ilMbTIrIco9h3UERDhA0zclIkZ0oWhWfKByLhC7wFiBAFYeL 4fwIXS8w==; From: "J.P." To: Eli Zaretskii Subject: Re: bug#23675: 30.0.50: make count-lines optionally ignore invisible lines In-Reply-To: <83v8dut2x1.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 05 Aug 2023 09:32:26 +0300") References: <87ttteuy0g.fsf@neverwas.me> <83v8dut2x1.fsf@gnu.org> Date: Sun, 06 Aug 2023 06:03:38 -0700 Message-ID: <87350wtj9x.fsf@neverwas.me> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Authenticated-Id: masked@neverwas.me X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 23675 Cc: emacs-erc@gnu.org, Stefan Monnier , 23675@debbugs.gnu.org, rsw@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> Cc: emacs-erc@gnu.org, rsw@gnu.org >> From: "J.P." >> Date: Fri, 04 Aug 2023 17:35:27 -0700 >> >> Perhaps I'm not understanding how the `ignore-invisible-lines' parameter >> for `count-lines' is supposed to work, but it doesn't seem to make the >> function consider `invisible' text properties that have lists as values. >> I bring this up because ERC will likely be needing a line-counting >> function that's list-aware, at least in the manner shown in the attached >> tests. The change to `count-lines' accompanying these tests was merely >> lifted from `forward-visible-line' to make them pass, but it's quite >> possibly flawed and/or incomplete. If a proper solution ever emerges to >> address this, hopefully it'll come at the hands of someone better >> informed than I in the ways of Emacs invisibility. In the meantime >> (2023), ERC will likely be doing its own subpar rendition unless someone >> takes up the challenge for 30.1 (and Compat agrees to adopt it). Thanks. > > This is OK for master, but please don't use cl-incf in simple.el, as > there's no real need to do so there. Actually, it's looking like `count-screen-lines' will suit ERC's needs. Thanks anyway for taking a peek, and apologies for the noise. From unknown Wed Jun 25 09:08:35 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 04 Sep 2023 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator