home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / lucid / lemacs-19.6 / lisp / gnus / gnus-describe.el next >
Encoding:
Text File  |  1993-01-15  |  2.3 KB  |  63 lines

  1. ;;; -*- Mode: Emacs-Lisp -*-
  2. ;; From: lutzeb@cs.tu-berlin.de (Dirk Lutzebaeck)
  3. ;; Subject: Source: description of newsgroups via NNRP
  4. ;; Date: 08 Jan 93 15:02:08 GMT
  5. ;; 
  6. ;; Hi all,
  7. ;; 
  8. ;; The NNRP protocol (which is a variation of the NNTP protocol used in
  9. ;; the INN news administration package, I think) provides a command named
  10. ;; `XGTITLE'.  This command takes a newsgroup as an argument and returns
  11. ;; a short description of it. I made this available to GNUS, i.e. if you
  12. ;; press `i' in the group, subject or killed groups buffer it looks for a
  13. ;; newsgroup at the current point and prints the description in the
  14. ;; minibuffer.  A prefix `C-u i' asks for a newsgroup name. Another
  15. ;; command `I' in the group buffer gives you the description of all
  16. ;; available newsgroups of your NNRP server.
  17.  
  18. (define-key gnus-Group-mode-map "i" 'gnus-Group-describe)
  19. (define-key gnus-Group-mode-map "I" 'gnus-Group-describe-all)
  20. (define-key gnus-Subject-mode-map "i" 'gnus-Group-describe)
  21. (define-key gnus-Browse-killed-mode-map "i" 'gnus-Group-describe)
  22.  
  23.  
  24. (defun gnus-Group-describe (&optional group)
  25.   "Describe current newsgroup.
  26. If optional argument GROUP is non-nil ask for a newsgroup, otherwise
  27. search around point for a newsgroup. If no newsgroup found take
  28. current newsgroup."
  29.   (interactive "P")
  30.   (cond
  31.    ((not group)
  32.     (setq group (gnus-Group-group-name))) ; search around point
  33.    ((listp group)
  34.     (setq group
  35.       (completing-read "Newsgroup: "
  36.                gnus-newsrc-assoc nil 'require-match))))
  37.   (if (not group)
  38.       (setq group gnus-newsgroup-name))    ; otherwise set current newsgroup name
  39.   (if (nntp-request-xgtitle group)
  40.       (save-excursion
  41.     (set-buffer nntp-server-buffer)
  42.     (if (> (point-max) (point-min))
  43.         (message (buffer-substring (point-min) (- (point-max) 1)))
  44.       (message "%s    no description." group)))
  45.     (message "cannot find description for %s." group)))
  46.  
  47.  
  48. (defun gnus-Group-describe-all ()
  49.   "Describe all newsgroups."
  50.   (interactive)
  51.   (switch-to-buffer (get-buffer-create " *GNUS newsgroup descriptions*"))
  52.   (erase-buffer)
  53.   (if (nntp-request-xgtitle "*")
  54.       (insert-buffer-substring nntp-server-buffer))
  55.   (goto-char (point-min)))
  56.  
  57.  
  58. (defun nntp-request-xgtitle (group)
  59.   "Get description of a group via XGTITLE NNRP-command."
  60.   (prog1
  61.       (nntp-send-command "^\\.\r$" "XGTITLE" group)
  62.     (nntp-decode-text)))
  63.