Function: gnus-group-goto-group

gnus-group-goto-group is a byte-compiled function defined in gnus-group.el.gz.

Signature

(gnus-group-goto-group GROUP &optional FAR TEST-MARKED)

Documentation

Go to newsgroup GROUP.

If FAR, it is likely that the group is not on the current line. If TEST-MARKED, the line must be marked.

Return nil if GROUP is not found.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-group.el.gz
(defun gnus-group-goto-group (group &optional far test-marked)
  "Go to newsgroup GROUP.
If FAR, it is likely that the group is not on the current line.
If TEST-MARKED, the line must be marked.

Return nil if GROUP is not found."
  (when group
    (let ((start (point)))
      (beginning-of-line)
      (cond
       ;; It's quite likely that we are on the right line, so
       ;; we check the current line first.
       ((and (not far)
	     (equal (get-text-property (point) 'gnus-group) group)
	     (or (not test-marked) (gnus-group-mark-line-p)))
	(point))
       ;; Previous and next line are also likely, so we check them as well.
       ((and (not far)
	     (save-excursion
	       (forward-line -1)
	       (and (equal (get-text-property (point) 'gnus-group) group)
		    (or (not test-marked) (gnus-group-mark-line-p)))))
	(forward-line -1)
	(point))
       ((and (not far)
	     (save-excursion
	       (forward-line 1)
	       (and (equal (get-text-property (point) 'gnus-group) group)
		    (or (not test-marked) (gnus-group-mark-line-p)))))
	(forward-line 1)
	(point))
       (test-marked
	(goto-char (point-min))
	(let (found)
	  (while (and (not found)
		      (gnus-text-property-search
		       'gnus-group group 'forward 'goto))
	    (if (gnus-group-mark-line-p)
		(setq found t)
	      (forward-line 1)))
	  found))
       (t
	;; Search through the entire buffer.
	(if (gnus-text-property-search
	     'gnus-group group nil 'goto)
	    (point)
	  (goto-char start)
	  nil))))))