Gnus development mailing list
 help / color / mirror / Atom feed
From: Karl Kleinpaste <karl@justresearch.com>
Subject: Re: moving the window when rendering non-text/plain
Date: 20 Nov 1998 11:59:03 -0500	[thread overview]
Message-ID: <vxkaf1m712g.fsf@beaver.jprc.com> (raw)
In-Reply-To: Lars Magne Ingebrigtsen's message of "19 Nov 1998 04:08:52 +0100"

Karl Kleinpaste <karl@justresearch.com> writes:
>> When there is a multipart/alternative containing (e.g.) text/plain and
>> text/html, RET on the buttons toggles which one shows.  However, when
>> toggling in favor of non-text/plain, Gnus insists on moving the window
>> so that the line of button alternatives is at the top of the window,
>> even if the whole message fits comfortably within the screen.  Can
>> Gnus be convinced not to move the window when doing this rendering?

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
> I'm unable to reproduce this for multipart/alternative.
> multipart/mixed parts do reposition point, though...

This was still happening in p0.52; I looked at it, and fixed this in
gnus-mime-display-alternative using (save-window-excursion ...) around
the bulk of the function.  Perhaps this isn't a problem in XEmacs 21
beta, but I'm still on 20.4.

(The patch is large, but it's just because the bulk of the function is 
re-indented an extra level.)

--karl

--- ChangeLog~	Thu Nov 19 23:25:06 1998
+++ ChangeLog	Fri Nov 20 11:53:47 1998
@@ -1,3 +1,8 @@
+1998-11-20  Karl Kleinpaste  <karl@justresearch.com>
+
+	* gnus-art.el (gnus-mime-display-alternative): Avoid window
+	movement with save-window-excursion.
+
 Fri Nov 20 05:30:26 1998  Lars Magne Ingebrigtsen  <larsi@menja.ifi.uio.no>
 
 	* gnus.el: Pterodactyl Gnus v0.52 is released.
--- gnus-art.el.~1~	Thu Nov 19 23:25:06 1998
+++ gnus-art.el	Fri Nov 20 11:40:56 1998
@@ -2511,53 +2511,28 @@
 	 (ihandles handles)
 	 (point (point))
 	 handle buffer-read-only from props begend not-pref)
-    (save-restriction
-      (when ibegend
-	(narrow-to-region (car ibegend) (cdr ibegend))
-	(delete-region (point-min) (point-max))
-	(mm-remove-parts handles))
-      (setq begend (list (point-marker)))
-      ;; Do the toggle.
-      (unless (setq not-pref (cadr (member preferred ihandles)))
-	(setq not-pref (car ihandles)))
-      (gnus-add-text-properties
-       (setq from (point))
-       (progn
-	 (insert (format "%d.  " id))
-	 (point))
-       `(gnus-callback
-	 (lambda (handles)
-	   (unless ,(not ibegend)
-	     (setq gnus-article-mime-handle-alist
-		   ',gnus-article-mime-handle-alist))
-	   (gnus-mime-display-alternative
-	    ',ihandles ',not-pref ',begend ,id))
-	 local-map ,gnus-mime-button-map
-	 ,gnus-mouse-face-prop ,gnus-article-mouse-face
-	 face ,gnus-article-button-face
-	 keymap ,gnus-mime-button-map
-	 gnus-part ,id
-	 gnus-data ,handle))
-      (widget-convert-button 'link from (point)
-			     :action 'gnus-widget-press-button
-			     :button-keymap gnus-widget-button-keymap)
-      ;; Do the handles
-      (while (setq handle (pop handles))
+    (save-window-excursion
+      (save-restriction
+	(when ibegend
+	  (narrow-to-region (car ibegend) (cdr ibegend))
+	  (delete-region (point-min) (point-max))
+	  (mm-remove-parts handles))
+	(setq begend (list (point-marker)))
+	;; Do the toggle.
+	(unless (setq not-pref (cadr (member preferred ihandles)))
+	  (setq not-pref (car ihandles)))
 	(gnus-add-text-properties
 	 (setq from (point))
 	 (progn
-	   (insert (format "[%c] %-18s"
-			   (if (equal handle preferred) ?* ? )
-			   (if (stringp (car handle))
-			       (car handle)
-			     (car (mm-handle-type handle)))))
+	   (insert (format "%d.  " id))
 	   (point))
 	 `(gnus-callback
 	   (lambda (handles)
 	     (unless ,(not ibegend)
 	       (setq gnus-article-mime-handle-alist
 		     ',gnus-article-mime-handle-alist))
-	     (gnus-mime-display-alternative ',ihandles ',handle ',begend ,id))
+	     (gnus-mime-display-alternative
+	      ',ihandles ',not-pref ',begend ,id))
 	   local-map ,gnus-mime-button-map
 	   ,gnus-mouse-face-prop ,gnus-article-mouse-face
 	   face ,gnus-article-button-face
@@ -2567,14 +2542,40 @@
 	(widget-convert-button 'link from (point)
 			       :action 'gnus-widget-press-button
 			       :button-keymap gnus-widget-button-keymap)
-	(insert "  "))
-      (insert "\n\n")
-      (when preferred
-	(if (stringp (car preferred))
-	    (gnus-display-mime preferred)
-	  (mm-display-part preferred)
+	;; Do the handles
+	(while (setq handle (pop handles))
+	  (gnus-add-text-properties
+	   (setq from (point))
+	   (progn
+	     (insert (format "[%c] %-18s"
+			     (if (equal handle preferred) ?* ? )
+			     (if (stringp (car handle))
+				 (car handle)
+			       (car (mm-handle-type handle)))))
+	     (point))
+	   `(gnus-callback
+	     (lambda (handles)
+	       (unless ,(not ibegend)
+		 (setq gnus-article-mime-handle-alist
+		       ',gnus-article-mime-handle-alist))
+	       (gnus-mime-display-alternative ',ihandles ',handle ',begend ,id))
+	     local-map ,gnus-mime-button-map
+	     ,gnus-mouse-face-prop ,gnus-article-mouse-face
+	     face ,gnus-article-button-face
+	     keymap ,gnus-mime-button-map
+	     gnus-part ,id
+	     gnus-data ,handle))
+	  (widget-convert-button 'link from (point)
+				 :action 'gnus-widget-press-button
+				 :button-keymap gnus-widget-button-keymap)
+	  (insert "  "))
+	(insert "\n\n")
+	(when preferred
+	  (if (stringp (car preferred))
+	      (gnus-display-mime preferred)
+	    (mm-display-part preferred)
 	    (goto-char (point-max)))
-	(setcdr begend (point-marker))))
+	  (setcdr begend (point-marker)))))
     (when ibegend
       (goto-char point))))
 


      reply	other threads:[~1998-11-20 16:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-18 22:03 Karl Kleinpaste
1998-11-19  3:08 ` Lars Magne Ingebrigtsen
1998-11-20 16:59   ` Karl Kleinpaste [this message]

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=vxkaf1m712g.fsf@beaver.jprc.com \
    --to=karl@justresearch.com \
    /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).