Function: gnus-summary-next-article

gnus-summary-next-article is an interactive and byte-compiled function defined in gnus-sum.el.gz.

Signature

(gnus-summary-next-article &optional UNREAD SUBJECT BACKWARD PUSH)

Documentation

Select the next article.

If UNREAD, only unread articles are selected. If SUBJECT, only articles with SUBJECT are selected. If BACKWARD, the previous article is selected instead of the next.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
(defun gnus-summary-next-article (&optional unread subject backward push)
  "Select the next article.
If UNREAD, only unread articles are selected.
If SUBJECT, only articles with SUBJECT are selected.
If BACKWARD, the previous article is selected instead of the next."
  (interactive "P" gnus-summary-mode)
  ;; Make sure we are in the summary buffer.
  (unless (derived-mode-p 'gnus-summary-mode)
    (set-buffer gnus-summary-buffer))
  (cond
   ;; Is there such an article?
   ((and (gnus-summary-search-forward unread subject backward)
	 (or (gnus-summary-display-article (gnus-summary-article-number))
	     (eq (gnus-summary-article-mark) gnus-canceled-mark)))
    (gnus-summary-position-point))
   ;; If not, we try the first unread, if that is wanted.
   ((and subject
	 gnus-auto-select-same
	 (gnus-summary-first-unread-article))
    (gnus-summary-position-point)
    (gnus-message 6 "Wrapped"))
   ;; Try to get next/previous article not displayed in this group.
   ((and gnus-auto-extend-newsgroup
	 (not unread) (not subject))
    (gnus-summary-goto-article
     (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
     nil (count-lines (point-min) (point))))
   ;; Go to next/previous group.
   (t
    (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
      (gnus-summary-jump-to-group gnus-newsgroup-name))
    (let ((cmd last-command-event)
	  (point
	   (with-current-buffer gnus-group-buffer
	     (point)))
	  (current-summary (current-buffer))
	  (group
	   (if (eq gnus-keep-same-level 'best)
	       (gnus-summary-best-group gnus-newsgroup-name)
	     (gnus-summary-search-group backward gnus-keep-same-level))))
      ;; Select next unread newsgroup automagically.
      (cond
       ((or (not gnus-auto-select-next)
	    (not cmd))
	(unless (eq gnus-auto-select-next 'quietly)
	  (gnus-message 6 "No more%s articles" (if unread " unread" ""))))
       ((or (eq gnus-auto-select-next 'quietly)
	    (and (eq gnus-auto-select-next 'slightly-quietly)
		 push)
	    (and (eq gnus-auto-select-next 'almost-quietly)
		 (gnus-summary-last-article-p)))
	;; Select quietly.
	(if (gnus-ephemeral-group-p gnus-newsgroup-name)
	    (gnus-summary-exit)
	  (unless (eq gnus-auto-select-next 'quietly)
	    (gnus-message 6 "No more%s articles (%s)..."
			  (if unread " unread" "")
			  (if group (concat "selecting " group)
			    "exiting")))
	  (gnus-summary-next-group nil group backward)))
       (t
	(when (numberp last-input-event)
	  ;; Somehow or other, we may now have selected a different
	  ;; window.  Make point go back to the summary buffer.
	  (when (eq current-summary (current-buffer))
            ;; FIXME: This burps when get-buffer-window returns nil.
	    (select-window (get-buffer-window current-summary 0)))
	  (gnus-summary-walk-group-buffer
	   gnus-newsgroup-name cmd unread backward point))))))))