* Using Gnus _from_ RMAIL mode
@ 2000-01-07 17:46 François Pinard
0 siblings, 0 replies; only message in thread
From: François Pinard @ 2000-01-07 17:46 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 4223 bytes --]
Hi, people. Let me share with you some Emacs LISP code I use to ease using
Gnus _from_ RMAIL mode, so take advantage of threading or MIME features.
I have a great deal of archives kept in a few thousands of Babyl files, which
are kept that way instead of being turned into `nnml' files. This saves
some i-nodes, but more importantly, I do not see how I would manage the big
Group or Topics display it would generate. I like the group list all within
the window, but I do not want revealing or hiding topics all the time :-).
Yet, while in these archives, I much miss Gnus highlighting, threading,
MIME-handling, as well as plenty of other nice features. I would call
Gnus to the rescue in some occasions, and return to RMAIL mode once done.
With this, the `!' command in RMAIL mode generates a two windows views: a
Gnus summary for the whole Babyl filey, and the current message now shown
as a Gnus article. Quitting the group brings you back in RMAIL mode,
right on your original message. Your Gnus work and marks are forgotten.
There is a prefixed version of that command. `C-u !' in RMAIL mode gets
the same thing as above, without the summary. You just have the feeling
that your RMAIL message has been repainted the Gnus way. `q' return you
to RMAIL. However, `C-u !' uses a quite different machinery internally.
As it is meant for a single message, it avoids the whole rescanning of
a possibly huge Babyl file, by using a new backend meant for this case.
This is `nnone', appended as an attachment near the end of this message.
(defun fp-maybe-start-gnus ()
"Have Gnus started, if not already."
(save-window-excursion
(unless (gnus-alive-p)
(gnus))))
(autoload 'gnus-alive-p "gnus-util")
(defun fp-rmail-mode-routine ()
;; [...]
(local-set-key "!" 'fp-rmail-display-with-gnus)
;;
)
(add-hook 'rmail-mode-hook 'fp-rmail-mode-routine)
;; FIXME: Rather depend on uniquification of names.
(defvar fp-rmail-display-with-gnus-counter 0
"To make sure no two servers are simultaneously opened with the same name.")
(defun fp-rmail-display-with-gnus (flag)
"Display the whole Babyl file with Gnus, using a nndoc ephemeral server.
With a flag argument, display only the current message instead, using nnone."
(interactive "P")
(fp-maybe-start-gnus)
(if flag
(fp-rmail-display-babyl-message-with-gnus)
(fp-rmail-display-babyl-file-with-gnus)))
(defun fp-rmail-display-babyl-message-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*")))
(group (format "nnone:%s-%d[%d]"
(file-name-nondirectory buffer-file-name)
(incf fp-rmail-display-with-gnus-counter)
rmail-current-message)))
(if (rmail-msg-is-pruned)
(let ((modified (buffer-modified-p)))
(rmail-toggle-header)
(append-to-buffer nnone-buffer (point-min) (point-max))
(rmail-toggle-header)
(set-buffer-modified-p modified))
(append-to-buffer nnone-buffer (point-min) (point-max)))
(if (gnus-group-read-ephemeral-group
group `(nnone ,group (nnone-article-buffer ,nnone-buffer))
nil (cons rmail-buffer (current-window-configuration)))
(progn
(gnus-summary-beginning-of-article)
(bury-buffer)
(delete-window))
(kill-buffer nnone-buffer)
(set-buffer rmail-buffer)
(gnus-error 3 "Article couldn't be entered"))))
(defun fp-rmail-display-babyl-file-with-gnus ()
"Display the whole Babyl file with Gnus, using a nndoc ephemeral server.
Automatically selects within Gnus the message which is current in RMAIL."
(let ((rmail-buffer (current-buffer))
(group (format "nndoc:%s-%d"
(file-name-nondirectory buffer-file-name)
(incf fp-rmail-display-with-gnus-counter)))
(article rmail-current-message))
(if (save-restriction
(widen)
(gnus-group-read-ephemeral-group
group `(nndoc ,group (nndoc-address ,rmail-buffer)
(nndoc-article-type babyl))
t (cons rmail-buffer (current-window-configuration))))
(gnus-summary-goto-article article)
(set-buffer rmail-buffer)
(gnus-error 3 "Babyl group couldn't be entered"))))
[-- Attachment #2: nnone.el --]
[-- Type: application/emacs-lisp, Size: 1427 bytes --]
[-- Attachment #3: Type: text/plain, Size: 59 bytes --]
--
François Pinard http://www.iro.umontreal.ca/~pinard
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-01-07 17:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-07 17:46 Using Gnus _from_ RMAIL mode 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).