Gnus development mailing list
 help / color / mirror / Atom feed
* pgnus 0.83 - Modifying gnus-win.el for me ?
@ 1999-04-19 21:26 François Pinard
  0 siblings, 0 replies; only message in thread
From: François Pinard @ 1999-04-19 21:26 UTC (permalink / raw)
  Cc: Forum of ding/Gnus users

Hi, Lars.

I hope you will accept the following diff for the standard distribution.
It might ease later easy installation in my case, regarding my attempts
for calling Gnus for displaying articles from within RMAIL (and maybe
other applications).  I do not think it should break Gnus in any other
way, and the added overhead is quite insignificant.  If you do accept this
little patch, you have to refill the whole function after having applied it.

Let me follow the diffs with the little tricks I made to myself, this
afternoon, to achieve this.  I'm sharing them with the `ding' liste, in case
other friends find it useful, or if they have ideas for improving on them!


--- gnus-win.el	1999/04/19 21:02:59	1.1
+++ gnus-win.el	1999/04/19 21:03:23
@@ -408,6 +408,8 @@
 (defvar gnus-frame-split-p nil)
 
 (defun gnus-configure-windows (setting &optional force)
+  (if (window-configuration-p setting)
+      (set-window-configuration setting)
   (setq gnus-current-window-configuration setting)
   (setq force (or force gnus-always-force-window-configuration))
   (setq setting (gnus-windows-old-to-new setting))
@@ -449,7 +451,7 @@
       (let (gnus-window-frame-focus)
 	(gnus-configure-frame split (get-buffer-window (current-buffer)))
 	(when gnus-window-frame-focus
-	  (select-frame (window-frame gnus-window-frame-focus)))))))
+	    (select-frame (window-frame gnus-window-frame-focus))))))))
 
 (defun gnus-delete-windows-in-gnusey-frames ()
   "Do a `delete-other-windows' in all frames that have Gnus windows."


Once the above diffs applied, I manage to have what follows, in my `.emacs'
file.  I picked "!" as a key-binding to call for Gnus display, because it
is traditionally how Masanobu was linking his MIME display things to RMAIL.
I vaguely remember that other packages used the same key.  And since one
of the reason Gnus display might be useful to RMAIL is its nice MIME support.


(defun fp-rmail-mode-routine ()
; ...
  (local-set-key "!" 'fp-rmail-display-with-gnus)
; ...
  )

;; FIXME: Rather depend on uniquification of names.
(defvar fp-rmail-display-with-gnus-counter 0
  "To make sure no two nnone are simultaneously opened with the same name.")

(defun fp-rmail-display-with-gnus ()
  "Display current message with Gnus, using a nnone ephemeral server."
  (interactive)
  (let ((rmail-buffer (current-buffer))
	(nnone-buffer (save-excursion
			(nnheader-set-temp-buffer " *copy article*")))
	(pruned (rmail-msg-is-pruned))
	(group (format "nnone:%s-%d[%d]"
		       (file-name-nondirectory buffer-file-name)
		       (incf fp-rmail-display-with-gnus-counter)
		       rmail-current-message)))
    (when pruned
      (rmail-toggle-header))
    (append-to-buffer nnone-buffer (point-min) (point-max))
    (when pruned
      (rmail-toggle-header))
    (if (gnus-group-read-ephemeral-group
	 group `(nnone ,group (nnone-article-buffer ,nnone-buffer))
	 nil (cons rmail-buffer (current-window-configuration)))
	(gnus-summary-beginning-of-article)
      (kill-buffer nnone-buffer)
      (set-buffer rmail-buffer)
      (gnus-error 3 "Article couldn't be entered"))))


And finally, to complete the code, I took some backend and deleted most
lines (I guess I could delete even more lines :-) to get the following file,
which I called `nnone.el', that is, `nn' for _one_ article at a time.


;;; nnone.el --- Gnus for a single article

;;; Code:

(require 'rmail)

(require 'nnheader)
(require 'nnmail)
(require 'nnoo)
(eval-when-compile (require 'cl))

(nnoo-declare nnone)

(defvoo nnone-article-buffer nil)

(defconst nnone-version "nnone 1.0"
  "nnone version.")

\f

;;; Interface functions

(nnoo-define-basics nnone)

(deffoo nnone-retrieve-headers (articles &optional group server fetch-old)
  (save-excursion
    (set-buffer nntp-server-buffer)
    (erase-buffer)
    (unless (stringp (car articles))
      (insert "221 1 Article retrieved.\n")
      (insert-buffer nnone-article-buffer)
      (goto-char (point-max))
      (insert ".\n")
      (nnheader-fold-continuation-lines)))
  'headers)

(deffoo nnone-request-article (article &optional newsgroup server buffer)
  (save-excursion
    (set-buffer (or buffer nntp-server-buffer))
    (erase-buffer)
    (if (stringp article)
	nil
      (insert-buffer nnone-article-buffer)
      (goto-char (point-max))
      (insert "\n")
      t)))

(deffoo nnone-request-group (group &optional server dont-check)
  (save-excursion
    (set-buffer nntp-server-buffer)
    (erase-buffer)
    (insert "211 1 1 1 " group "\n"))
  t)

(deffoo nnone-close-group (group &optional server)
  (and nnone-article-buffer
       (buffer-name nnone-article-buffer)
       (kill-buffer nnone-article-buffer))
  (setq nnone-article-buffer nil)
  (nnoo-close-server 'nnone server)
  t)

(deffoo nnone-request-list (&optional server)
  nil)

(deffoo nnone-request-newgroups (date &optional server)
  nil)

(deffoo nnone-request-list-newsgroups (&optional server)
  nil)

(deffoo nnone-request-move-article ()
  nil)

(deffoo nnone-request-accept-article (group &optional server last)
  nil)

(deffoo nnone-request-replace-article (article group buffer)
  nil)

(provide 'nnone)

;;; nnone.el ends here

-- 
François Pinard                            mailto:pinard@iro.umontreal.ca
Join the free Translation Project!    http://www.iro.umontreal.ca/~pinard



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1999-04-19 21:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-19 21:26 pgnus 0.83 - Modifying gnus-win.el for me ? François Pinard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).