emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: count-lines-page


From: Stephen Berman
Subject: Re: count-lines-page
Date: Wed, 25 Aug 2010 01:18:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

On Wed, 25 Aug 2010 00:56:03 +0200 Stephen Berman <address@hidden> wrote:

> if it is on line 3, there are two before and none after.  The following
> patch implements this behavior (and changes the doc string accordingly;
> the original doc string is in any case too long and also uses "or" where
> "and" is meant).

On second thought, I guess "or" was right after all -- and should be
used in my patch instead of "and".  But the clearest formulation is with
"and": "Also show how many lines precede and how many follow the line
point is on."

> Steve Berman
>
>
> *** /data/steve/bzr/emacs/trunk/lisp/textmodes/page.el        2010-01-13 
> 10:56:56.000000000 +0100
> --- /data/steve/bzr/emacs/quickfixes/lisp/textmodes/page.el   2010-08-25 
> 00:47:30.000000000 +0200
> ***************
> *** 126,132 ****
>   (put 'narrow-to-page 'disabled t)
>   
>   (defun count-lines-page ()
> !   "Report number of lines on current page, and how many are before or after 
> point."
>     (interactive)
>     (save-excursion
>       (let ((opoint (point)) beg end
> --- 126,133 ----
>   (put 'narrow-to-page 'disabled t)
>   
>   (defun count-lines-page ()
> !   "Return the number of lines on the current page.
> ! Also show how many lines precede and follow the line point is on."
>     (interactive)
>     (save-excursion
>       (let ((opoint (point)) beg end
> ***************
> *** 139,146 ****
>         (backward-page)
>         (setq beg (point))
>         (setq total (count-lines beg end)
> !         before (count-lines beg opoint)
> !         after (count-lines opoint end))
>         (message "Page has %d lines (%d + %d)" total before after))))
>   
>   (defun what-page ()
> --- 140,149 ----
>         (backward-page)
>         (setq beg (point))
>         (setq total (count-lines beg end)
> !         before (- (line-number-at-pos opoint)
> !                   (line-number-at-pos (point-min)))
> !         after (- (line-number-at-pos (point-max))
> !                  (line-number-at-pos opoint)))
>         (message "Page has %d lines (%d + %d)" total before after))))
>   
>   (defun what-page ()




reply via email to

[Prev in Thread] Current Thread [Next in Thread]