From: Stephen Berman <stephen.berman@gmx.net>
To: emacs-devel@gnu.org
Subject: Re: count-lines-page
Date: Wed, 25 Aug 2010 01:18:46 +0200 [thread overview]
Message-ID: <87zkwbmwfd.fsf@escher.home> (raw)
In-Reply-To: 874oejoc1o.fsf@escher.home
On Wed, 25 Aug 2010 00:56:03 +0200 Stephen Berman <stephen.berman@gmx.net> 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 ()
prev parent reply other threads:[~2010-08-24 23:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-22 18:31 count-lines-page Christoph
2010-08-22 19:38 ` count-lines-page Glenn Morris
2010-08-24 22:56 ` count-lines-page Stephen Berman
2010-08-24 23:18 ` Stephen Berman [this message]
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=87zkwbmwfd.fsf@escher.home \
--to=stephen.berman@gmx.net \
--cc=emacs-devel@gnu.org \
/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.