[Top][All Lists]

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

what-page and first line of page?

From: Mario Lang
Subject: what-page and first line of page?
Date: Mon, 14 Sep 2009 12:42:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)


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
line 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."
      (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"
                 (1+ (count-lines (point) opoint)))))))

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


reply via email to

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