GNU bug report logs - #23675
Feature request: Emacs 25.0.94: count-lines should offer a way to ignore invisible lines, e.g. outline mode

Previous Next

Package: emacs;

Reported by: Robert Weiner <rsw <at> gnu.org>

Date: Wed, 1 Jun 2016 15:34:03 UTC

Severity: wishlist

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 23675 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Robert Weiner <rsw <at> gnu.org>
Cc: rswgnu <at> gmail.com, 23675 <at> debbugs.gnu.org, emacs-devel <emacs-devel <at> 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
Some comments on the patch:

Robert Weiner <rsw <at> 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




This bug report was last modified 1 year and 295 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.