Function: pages-copy-header-and-position
pages-copy-header-and-position is a byte-compiled function defined in
page-ext.el.gz.
Signature
(pages-copy-header-and-position COUNT-LINES-P)
Documentation
Copy page header and its position to the Pages Directory.
Only arg non-nil, count lines in page and insert before header.
Used by pages-directory function.
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/page-ext.el.gz
(defun pages-copy-header-and-position (count-lines-p)
"Copy page header and its position to the Pages Directory.
Only arg non-nil, count lines in page and insert before header.
Used by `pages-directory' function."
(let (position line-count)
(if count-lines-p
(save-excursion
(save-restriction
(narrow-to-page)
(setq line-count (count-lines (point-min) (point-max))))))
;; Keep track of page for later cursor positioning
(if (<= (point) pages-buffer-original-position)
(setq pages-buffer-original-page
(1+ pages-buffer-original-page)))
(save-excursion
;; go to first non-blank char after the page-delimiter
(skip-chars-forward " \t\n")
;; set the marker here; this the place to which the
;; `pages-directory-goto' command will go
(setq position (make-marker))
(set-marker position (point))
(let ((start (point))
(end (line-end-position))
inserted-at)
;; change to directory buffer
(set-buffer standard-output)
;; record page position
(setq pages-pos-list (cons position pages-pos-list))
;; insert page header
(setq inserted-at (point))
(insert-buffer-substring pages-target-buffer start end)
(add-text-properties inserted-at (point)
'(mouse-face highlight
help-echo "mouse-2: go to this page"))
(put-text-property inserted-at (point) 'rear-nonsticky 'highlight))
(if count-lines-p
(save-excursion
(beginning-of-line)
(insert (format "%3d: " line-count))))
(terpri))
(end-of-line 1)))