Gnus development mailing list
 help / color / mirror / Atom feed
From: "François Pinard" <pinard@iro.umontreal.ca>
Cc: Forum of ding/Gnus users <ding@gnus.org>
Subject: pgnus 0.83 - Modifying gnus-win.el for me ?
Date: 19 Apr 1999 17:26:23 -0400	[thread overview]
Message-ID: <oqso9wpaio.fsf@titan.progiciels-bpi.ca> (raw)

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



                 reply	other threads:[~1999-04-19 21:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=oqso9wpaio.fsf@titan.progiciels-bpi.ca \
    --to=pinard@iro.umontreal.ca \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).