Function: gnus-narrow-to-page

gnus-narrow-to-page is an autoloaded, interactive and byte-compiled function defined in gnus-art.el.gz.

Signature

(gnus-narrow-to-page &optional ARG)

Documentation

Narrow the article buffer to a page.

If given a numerical ARG, move forward ARG pages.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-art.el.gz
(defun gnus-narrow-to-page (&optional arg)
  "Narrow the article buffer to a page.
If given a numerical ARG, move forward ARG pages."
  (interactive "P" gnus-article-mode)
  (setq arg (if arg (prefix-numeric-value arg) 0))
  (with-current-buffer gnus-article-buffer
    (widen)
    ;; Remove any old next/prev buttons.
    (when (gnus-visual-p 'page-marker)
      (let ((inhibit-read-only t))
	(gnus-remove-text-with-property 'gnus-prev)
	(gnus-remove-text-with-property 'gnus-next)))
    (let (st nd pt)
      (when (save-excursion
	      (cond ((< arg 0)
		     (if (re-search-backward page-delimiter nil 'move (abs arg))
			 (prog1
			     (setq nd (match-beginning 0)
				   pt nd)
			   (when (re-search-backward page-delimiter nil t)
			     (setq st (match-end 0))))
		       (when (re-search-forward page-delimiter nil t)
			 (setq nd (match-beginning 0)
			       pt (point-min)))))
		    ((> arg 0)
		     (if (re-search-forward page-delimiter nil 'move arg)
			 (prog1
			     (setq st (match-end 0)
				   pt st)
			   (when (re-search-forward page-delimiter nil t)
			     (setq nd (match-beginning 0))))
		       (when (re-search-backward page-delimiter nil t)
			 (setq st (match-end 0)
			       pt (point-max)))))
		    (t
		     (when (re-search-backward page-delimiter nil t)
		       (goto-char (setq st (match-end 0))))
		     (when (re-search-forward page-delimiter nil t)
		       (setq nd (match-beginning 0)))
		     (or st nd))))
	(setq gnus-page-broken t)
	(when pt (goto-char pt))
	(narrow-to-region (or st (point-min)) (or nd (point-max)))
	(when (gnus-visual-p 'page-marker)
	  (save-excursion
	    (when nd
	      (goto-char nd)
	      (gnus-insert-next-page-button))
	    (when st
	      (goto-char st)
	      (gnus-insert-prev-page-button))))))))