unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mario Lang <mlang@delysid.org>
To: emacs-devel@gnu.org
Subject: what-page and first line of page?
Date: Mon, 14 Sep 2009 12:42:53 +0200	[thread overview]
Message-ID: <87tyz5ajte.fsf@x2.delysid.org> (raw)

Hi.

I am editiing a long document where original page numbers are important.
When I use `what-page' to see to which physical page the position
of point currently corresponds, I notice that it does not
work on the first line which starts with ^L.  I.e.:

line 1 or page 1
\fline 2 of page 1
line 1 of page 2

To make `what-page' return the correct page number I either
always have to immediately follow ^L with a newline, or
remove `beginning-of-line' in the definition of `what-page':

(defun what-page ()
  "Print page and line number of point."
  (interactive)
  (save-restriction
    (widen)
    (save-excursion
      ;(beginning-of-line)
      (let ((count 1)
	    (opoint (point)))
	(goto-char 1)
	(while (re-search-forward page-delimiter opoint t)
	  (setq count (1+ count)))
	(message "Page %d, line %d"
		 count
		 (1+ (count-lines (point) opoint)))))))

I am arguing this is a bug.  Does anyone know why
the `beginning-of-line' is actually in there?

-- 
CYa,
  ⡍⠁⠗⠊⠕




             reply	other threads:[~2009-09-14 10:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-14 10:42 Mario Lang [this message]
2009-09-15  1:22 ` what-page and first line of page? Stefan Monnier
2009-09-16 11:15   ` Juanma Barranquero
2009-09-16 13:15     ` Stefan Monnier
2009-09-16 13:36       ` Juanma Barranquero

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tyz5ajte.fsf@x2.delysid.org \
    --to=mlang@delysid.org \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).