From: Lars Ingebrigtsen <larsi@gnus.org>
To: Robert Weiner <rsw@gnu.org>
Cc: rswgnu@gmail.com, 23675@debbugs.gnu.org,
emacs-devel <emacs-devel@gnu.org>
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 [thread overview]
Message-ID: <m35zotaj23.fsf@gnus.org> (raw)
In-Reply-To: <CA+OMD9houRLimgDdDkC0TEg7Rk_c9qmQ9+7ebURoxy6c=vZvVw@mail.gmail.com> (Robert Weiner's message of "Mon, 6 Jun 2016 19:35:47 -0400")
Some comments on the patch:
Robert Weiner <rsw@gnu.org> 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
next prev parent reply other threads:[~2019-06-25 13:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-01 14:23 bug#23675: Feature request: Emacs 25.0.94: count-lines should offer a way to ignore invisible lines, e.g. outline mode Robert Weiner
2016-06-04 8:58 ` Eli Zaretskii
2016-06-06 23:35 ` Robert Weiner
2016-06-06 23:35 ` Robert Weiner
2016-06-07 15:58 ` bug#23675: " Eli Zaretskii
2016-06-07 22:17 ` Robert Weiner
2019-06-25 15:33 ` Stefan Monnier
2019-06-25 13:30 ` Lars Ingebrigtsen [this message]
2019-06-25 15:26 ` Stefan Monnier
2019-06-25 15:29 ` Lars Ingebrigtsen
2019-06-25 13:30 ` Lars Ingebrigtsen
2020-08-11 14:53 ` Lars Ingebrigtsen
2023-08-05 0:35 ` bug#23675: 30.0.50: make count-lines optionally ignore invisible lines J.P.
[not found] ` <87ttteuy0g.fsf@neverwas.me>
2023-08-05 6:32 ` Eli Zaretskii
[not found] ` <83v8dut2x1.fsf@gnu.org>
2023-08-06 13:03 ` J.P.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m35zotaj23.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=23675@debbugs.gnu.org \
--cc=emacs-devel@gnu.org \
--cc=rsw@gnu.org \
--cc=rswgnu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.