Gnus development mailing list
 help / color / mirror / Atom feed
From: Satyaki Das <satyaki@chicory.stanford.edu>
Subject: Minor patches for CVS Gnus
Date: Sat, 08 Feb 2003 08:08:35 -0800	[thread overview]
Message-ID: <m3adh6bvr0.fsf@troodon.localdomain> (raw)


We have recently started using Gnus' MIME display code to display
messages in MH-E (the Emacs frontend to MH). It works quite nicely.
While working on this I came across a few potential bugs. Here they
are along with patches to fix them:

1. The function mm-display-external could leaks buffers. In this
   function assume that method is mailcap-save-binary-file. Then a
   new temporary buffer is generated and method is set to nil. That
   means that the cleanup forms in the unwind-protect doesn't free
   the buffer. I think the following patch fixes it.

Index: lisp/mm-decode.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/mm-decode.el,v
retrieving revision 6.87
diff -u -r6.87 mm-decode.el
--- lisp/mm-decode.el	3 Feb 2003 19:37:57 -0000	6.87
+++ lisp/mm-decode.el	8 Feb 2003 15:44:58 -0000
@@ -660,8 +660,7 @@
 		  (if method
 		      (funcall method)
 		    (mm-save-part handle))
-		(when (and (not non-viewer)
-			   method)
+		(when (not non-viewer)
 		  (mm-handle-set-undisplayer handle mm)))))
 	;; The function is a string to be executed.
 	(mm-insert-part handle)



2. The function mm-inline-emacs-image inserts a new line every
   time it is called. This means that if images are shown as
   buttons then a new line is inserted every cycle (show followed
   by hide). I think, this is only a problem for GNU Emacs. So I
   essentially copied the code for XEmacs and that seems to fix
   the problem. The following patch is what I did.

Index: lisp/mm-view.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/mm-view.el,v
retrieving revision 6.48
diff -u -r6.48 mm-view.el
--- lisp/mm-view.el	30 Oct 2002 07:54:59 -0000	6.48
+++ lisp/mm-view.el	8 Feb 2003 15:44:59 -0000
@@ -77,7 +77,10 @@
     (put-image (mm-get-image handle) b)
     (mm-handle-set-undisplayer
      handle
-     `(lambda () (remove-images ,b (1+ ,b))))))
+     `(lambda ()
+        (remove-images ,b (1+ ,b))
+        (delete-region ,(set-marker (make-marker) b)
+                       ,(set-marker (make-marker) (point)))))))
 
 (defun mm-inline-image-xemacs (handle)
   (insert "\n")



3. This isn't really a bug just a minor thing. I use pgg and don't
   like the way it blinks when used. Basically the contents of the
   buffer with the raw message is shown for a moment and then
   replaced with the buttons and all. I think this is caused
   because pgg calls gpg asynchronously with start-process. Since
   pgg then waits for the process to terminate any way I replaced
   start-process with call-process and the flashing goes away. I
   have used this for only a day or so, hence it is likely that
   this might cause other problems (there must be a reason why
   start-process was used in the first place).

Thanks,
Satyaki

Index: lisp/pgg-gpg.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/pgg-gpg.el,v
retrieving revision 6.8
diff -u -r6.8 pgg-gpg.el
--- lisp/pgg-gpg.el	2 Nov 2002 04:27:00 -0000	6.8
+++ lisp/pgg-gpg.el	8 Feb 2003 15:45:00 -0000
@@ -59,27 +59,22 @@
 	 (errors-buffer pgg-errors-buffer)
 	 (orig-mode (default-file-modes))
 	 (process-connection-type nil)
-	 process status exit-status)
+	 exit-status)
     (with-current-buffer (get-buffer-create errors-buffer)
       (buffer-disable-undo)
       (erase-buffer))
     (unwind-protect
 	(progn
 	  (set-default-file-modes 448)
-	  (let ((coding-system-for-write 'binary))
-	    (setq process
-		  (apply #'start-process "*GnuPG*" errors-buffer
-			 program args)))
-	  (set-process-sentinel process #'ignore)
-	  (when passphrase
-	    (process-send-string process (concat passphrase "\n")))
-	  (process-send-region process start end)
-	  (process-send-eof process)
-	  (while (eq 'run (process-status process))
-	    (accept-process-output process 5))
-	  (setq status (process-status process)
-		exit-status (process-exit-status process))
-	  (delete-process process)
+          (let* ((coding-system-for-write 'binary)
+                 (input (buffer-substring-no-properties start end)))
+            (with-temp-buffer
+              (when passphrase
+                (insert passphrase "\n"))
+              (insert input)
+              (setq exit-status
+                    (apply #'call-process-region (point-min) (point-max) program
+                           nil errors-buffer nil args))))
 	  (with-current-buffer (get-buffer-create output-buffer)
 	    (buffer-disable-undo)
 	    (erase-buffer)
@@ -87,12 +82,8 @@
 		(let ((coding-system-for-read 'raw-text-dos))
 		  (insert-file-contents output-file-name)))
 	    (set-buffer errors-buffer)
-	    (if (memq status '(stop signal))
-		(error "%s exited abnormally: '%s'" program exit-status))
-	    (if (= 127 exit-status)
-		(error "%s could not be found" program))))
-      (if (and process (eq 'run (process-status process)))
-	  (interrupt-process process))
+	    (if (not (equal exit-status 0))
+		(error "%s exited abnormally: '%s'" program exit-status))))
       (if (file-exists-p output-file-name)
 	  (delete-file output-file-name))
       (set-default-file-modes orig-mode))))



             reply	other threads:[~2003-02-08 16:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-08 16:08 Satyaki Das [this message]
2003-02-08 18:53 ` Simon Josefsson
2003-02-08 19:24   ` Satyaki Das

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=m3adh6bvr0.fsf@troodon.localdomain \
    --to=satyaki@chicory.stanford.edu \
    /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).