Function: thing-at-point-newsgroup-p

thing-at-point-newsgroup-p is a byte-compiled function defined in thingatpt.el.gz.

Signature

(thing-at-point-newsgroup-p STRING)

Documentation

Return STRING if it looks like a newsgroup name, else nil.

Aliases

ffap-newsgroup-p (obsolete since 30.1)

Source Code

;; Defined in /usr/src/emacs/lisp/thingatpt.el.gz
(defun thing-at-point-newsgroup-p (string)
  "Return STRING if it looks like a newsgroup name, else nil."
  (and
   (string-match thing-at-point-newsgroup-regexp string)
   (let ((htbs '(gnus-active-hashtb gnus-newsrc-hashtb gnus-killed-hashtb))
	 (heads thing-at-point-newsgroup-heads)
	 htb ret)
     (while htbs
       (setq htb (car htbs) htbs (cdr htbs))
       (ignore-errors
         (setq htb (symbol-value htb))
	 (when (cond ((obarrayp htb)
                      (intern-soft string htb))
                     ((listp htb)
                      (member string htb))
                     ((hash-table-p htb)
                      (gethash string htb)))
	   (setq ret string htbs nil))
	 ;; If we made it this far, gnus is running, so ignore "heads":
	 (setq heads nil)))
     (or ret (not heads)
	 (let ((head (string-match "\\`\\([[:lower:]]+\\)\\." string)))
	   (and head (setq head (substring string 0 (match-end 1)))
		(member head heads)
		(setq ret string))))
     ret)))