Gnus development mailing list
 help / color / mirror / Atom feed
* gnus-buffer-configuration in mml-preview
@ 2005-10-28 12:26 Reiner Steib
  2005-10-28 15:09 ` Katsumi Yamaoka
  0 siblings, 1 reply; 3+ messages in thread
From: Reiner Steib @ 2005-10-28 12:26 UTC (permalink / raw)


Hi,

the changes in `mml-preview' in the trunk (compared to v5-10 or
revision 7.17 [1]) prevent that my configuration of
`special-display-regexps'[1] does the right thing.

I can work around this by removing mml-preview from
gnus-buffer-configuration:

(when (assq 'mml-preview gnus-buffer-configuration)
  (setq gnus-buffer-configuration
	(remove (assq 'mml-preview gnus-buffer-configuration)
		gnus-buffer-configuration)))

I'm not sure if `gnus-buffer-configuration' is supposed to override
`special-display-regexps' or not.  I don't say that the code in
`mml-preview' is incorrect, but maybe we should document it.

Bye, Reiner.

[1]
,----[ <f1> v special-display-regexps RET ]
| special-display-regexps is a variable defined in `C source code'.
| Its value is shown below.
| 
| Documentation:
| *List of regexps saying which buffers should have their own special frames.
| [...]
| Value:
| ([...] ("MIME preview" (height . 55)) [...])
`----

[2]
2004-09-22  Katsumi Yamaoka  <yamaoka@jpl.org>

	* gnus-win.el (gnus-buffer-configuration): Add mml-preview.
	(gnus-window-to-buffer): Ditto.

	* mml.el (mml-preview-buffer): New variable.
	(mml-preview): Manage window layout with gnus-buffer-configuration.

--8<---------------cut here---------------start------------->8---
--- mml.el	28 Oct 2005 14:20:41 +0200	7.17
+++ mml.el	28 Oct 2005 14:12:52 +0200	
@@ -1078,10 +1209,15 @@
     (message-position-on-field "Mail-Followup-To" "X-Draft-From")
     (insert (message-make-mail-followup-to))))
 
+(defvar mml-preview-buffer nil)
+
 (defun mml-preview (&optional raw)
   "Display current buffer with Gnus, in a new buffer.
 If RAW, don't highlight the article."
   (interactive "P")
+  (setq mml-preview-buffer (generate-new-buffer
+			    (concat (if raw "*Raw MIME preview of "
+				      "*MIME preview of ") (buffer-name))))
   (save-excursion
     (let* ((buf (current-buffer))
 	   (message-options message-options)
@@ -1093,13 +1229,13 @@
 					   (message-fetch-field "Newsgroups")))
 					message-posting-charset)))
       (message-options-set-recipient)
-      (pop-to-buffer (generate-new-buffer
-		      (concat (if raw "*Raw MIME preview of "
-				"*MIME preview of ") (buffer-name))))
       (when (boundp 'gnus-buffers)
-	(push (current-buffer) gnus-buffers))
-      (erase-buffer)
-      (insert-buffer-substring buf)
+	(push mml-preview-buffer gnus-buffers))
+      (save-restriction
+	(widen)
+	(set-buffer mml-preview-buffer)
+	(erase-buffer)
+	(insert-buffer-substring buf))
       (mml-preview-insert-mail-followup-to)
       (let ((message-deletable-headers (if (message-news-p)
 					   nil
@@ -1112,6 +1248,7 @@
 	   (concat "^" (regexp-quote mail-header-separator) "\n") nil t)
 	  (replace-match "\n"))
       (let ((mail-header-separator ""));; mail-header-separator is removed.
+	(message-sort-headers)
 	(mml-to-mime))
       (if raw
 	  (when (fboundp 'set-buffer-multibyte)
@@ -1144,7 +1281,12 @@
 		     (lambda (event)
 		       (interactive "@e")
 		       (widget-button-press (widget-event-point event) event)))
-      (goto-char (point-min)))))
+      (goto-char (point-min))))
+  (if (and (boundp 'gnus-buffer-configuration)
+	   (assq 'mml-preview gnus-buffer-configuration))
+      (let ((gnus-message-buffer (current-buffer)))
+	(gnus-configure-windows 'mml-preview))
+    (pop-to-buffer mml-preview-buffer)))
 
 (defun mml-validate ()
   "Validate the current MML document."
--8<---------------cut here---------------end--------------->8---
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnus-buffer-configuration in mml-preview
  2005-10-28 12:26 gnus-buffer-configuration in mml-preview Reiner Steib
@ 2005-10-28 15:09 ` Katsumi Yamaoka
  2005-10-31  6:16   ` Katsumi Yamaoka
  0 siblings, 1 reply; 3+ messages in thread
From: Katsumi Yamaoka @ 2005-10-28 15:09 UTC (permalink / raw)


>>>>> In <v93bmlesj4.fsf@marauder.physik.uni-ulm.de>
>>>>>	Reiner Steib <reinersteib+gmane@imap.cc> wrote:

> the changes in `mml-preview' in the trunk (compared to v5-10 or
> revision 7.17 [1]) prevent that my configuration of
> `special-display-regexps'[1] does the right thing.

I didn't know such a handy variable but I meant to just make
the preview frame pop up and added `mml-preview' to
`gnus-buffer-configuration'.  It doesn't make a new frame by
default, though.  (The code to do that is in:
ftp://ftp.jpl.org/pub/elisp/message-multiple-frames.el.gz)

> I can work around this by removing mml-preview from
> gnus-buffer-configuration:

> (when (assq 'mml-preview gnus-buffer-configuration)
>   (setq gnus-buffer-configuration
> 	(remove (assq 'mml-preview gnus-buffer-configuration)
> 		gnus-buffer-configuration)))

> I'm not sure if `gnus-buffer-configuration' is supposed to override
> `special-display-regexps' or not.  I don't say that the code in
> `mml-preview' is incorrect, but maybe we should document it.

I'm not sure too, and I'll investigate it next week.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnus-buffer-configuration in mml-preview
  2005-10-28 15:09 ` Katsumi Yamaoka
@ 2005-10-31  6:16   ` Katsumi Yamaoka
  0 siblings, 0 replies; 3+ messages in thread
From: Katsumi Yamaoka @ 2005-10-31  6:16 UTC (permalink / raw)


>>>>>> In <v93bmlesj4.fsf@marauder.physik.uni-ulm.de>
>>>>>>	Reiner Steib <reinersteib+gmane@imap.cc> wrote:

>> I'm not sure if `gnus-buffer-configuration' is supposed to override
>> `special-display-regexps' or not.  I don't say that the code in
>> `mml-preview' is incorrect, but maybe we should document it.

>>>>> In <b4mzmotllu1.fsf@jpl.org> Katsumi Yamaoka wrote:

> I'm not sure too, and I'll investigate it next week.

Basically, I think the windows layout should be determined by
user's setting.  The default value of `gnus-buffer-configuration'
is no more than a default, so it should be able to be overridden
by `special-display-buffer-names' or `special-display-regexps'.
In addition to this, it is not easy to customize
`gnus-buffer-configuration' and a user cannot necessarily get
full control (actually I had trouble to make individual message
frames).  Especially the relationship between the preview window
and other Gnus windows is not significant, so I've modified the
`mml-preview' function so as to prefer user's special-display
setting.

For the same reasons, it would be nice for the message windows
layout to be easily customizable in that way.  I don't feel an
urge to do it now, though.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-10-31  6:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-28 12:26 gnus-buffer-configuration in mml-preview Reiner Steib
2005-10-28 15:09 ` Katsumi Yamaoka
2005-10-31  6:16   ` Katsumi Yamaoka

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).