all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* what-page and first line of page?
@ 2009-09-14 10:42 Mario Lang
  2009-09-15  1:22 ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Mario Lang @ 2009-09-14 10:42 UTC (permalink / raw
  To: emacs-devel

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,
  ⡍⠁⠗⠊⠕




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-09-16 13:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-14 10:42 what-page and first line of page? Mario Lang
2009-09-15  1:22 ` Stefan Monnier
2009-09-16 11:15   ` bug#4445: " Juanma Barranquero
2009-09-16 11:15   ` Juanma Barranquero
2009-09-16 13:15     ` bug#4447: " Stefan Monnier
2009-09-16 13:15     ` Stefan Monnier
2009-09-16 13:36       ` bug#4445: " Juanma Barranquero
2009-09-16 13:36       ` Juanma Barranquero

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.