home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / lucid / help-lucid-emacs / text0279.txt < prev    next >
Encoding:
Text File  |  1993-07-14  |  2.6 KB  |  77 lines

  1. Hi Lutz,
  2.  
  3.    Here is a definitive solution which will work!
  4.  
  5. Let me know how you get on.
  6.  
  7. --
  8. Regards, David
  9.  
  10. 8< ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CUT HERE for file: mygnus.el
  11. ;; stuff for GNUS in a separate screen
  12. (load "gnus" nil t)
  13.  
  14. (defun window-visible-p (win)
  15.   "Returns window if WINDOW is actually visible, nil otherwise."
  16.   (and (windowp win)
  17.        (condition-case err
  18.            (save-window-excursion (select-window win))
  19.          (error nil))))
  20.  
  21. (setq gnus-user-full-name (user-full-name)
  22.       gnus-large-newsgroup 100
  23.       gnus-default-article-saver (function gnus-Subject-save-in-mail))
  24.  
  25. (add-hook 'gnus-Article-mode-hook
  26.           (function (lambda () (setq screen-icon-title-format "GNUS"))))
  27.  
  28. (add-hook 'gnus-Group-mode-hook
  29.           (function (lambda () (setq screen-icon-title-format "GNUS"))))
  30.  
  31. (add-hook 'gnus-Subject-mode-hook
  32.           (function (lambda () (setq screen-icon-title-format "GNUS"))))
  33.  
  34. (defvar gnus-screen nil
  35.   "Screen to use for running gnus")
  36.  
  37. (or (fboundp 'real-gnus)
  38.     (fset 'real-gnus (symbol-function 'gnus)))
  39.  
  40. (defvar message-header-colour "brown"
  41.   "Colour in which mail headers are displayed")
  42.  
  43. (defun gnus (&optional confirm)
  44.   "Read network news.
  45. onal argument CONFIRM is non-nil, ask NNTP server."
  46.   (interactive "P")
  47.   (or (and (screenp gnus-screen)
  48.            (condition-case err (deiconify-screen gnus-screen) (error nil)))
  49.       (setq gnus-screen (x-create-screen nil)))
  50.   (select-screen gnus-screen)
  51.   (real-gnus confirm)
  52.   (gnus-Group-get-new-news)
  53.   (let ((gnus-subject (get-buffer "*Subject*"))
  54.         (gnus-article (get-buffer "*Article*")))
  55.     (if (locate-file "highlight-headers" load-path ":.el")
  56.         (progn
  57.           (load "highlight-headers" nil t)
  58.           (if (x-color-display-p)
  59.               (set-face-foreground
  60.                'message-cited-text message-header-colour)
  61.             (set-face-font 'message-header-contents (face-font 'bold))
  62.             (set-face-foreground
  63.              'message-header-contents message-header-colour))))
  64.     (select-window
  65.      (or (and (bufferp gnus-subject)
  66.               (eq (symbol-buffer-value 'major-mode gnus-subject) 'gnus-Subject-mode)
  67.               (window-visible-p (get-buffer-window gnus-subject)))
  68.          (and (bufferp gnus-article)
  69.               (eq (symbol-buffer-value 'major-mode gnus-article) 'gnus-Article-mode)
  70.               (window-visible-p (get-buffer-window gnus-article)))
  71.          (selected-window)))
  72.     (cond ((eq major-mode 'gnus-Subject-mode)
  73.            (gnus-Subject-show-article))
  74.           ((eq major-mode 'gnus-Article-mode)
  75.            (gnus-Article-show-subjects)))))
  76.  
  77.