Subject: Re: bug#5108: 23.1; ps-print-buffer infinite loop on image-mode

From: Stefan Monnier <[email-masked]>
Date: Mon, 19 Sep 2011 15:27:36 -0400

>> (with-temp-buffer
>>   (insert-file-contents (concat data-directory "images/cut.xpm"))
>>   (image-mode)
>>   (ps-print-buffer "/tmp/foo.ps"))
>> shows message
>> Formatting...  0%
>> and then goes away apparently forever.
> I can confirm that this bug is still present in Emacs 24.

Yes, it's the evil `intangible' property at work.
I've installed the patch below which should fix the immediate
inf-loop problem.  I also removed the intangible property from
image-mode to avoid similar problems in other codes.

        Stefan

--- lisp/ps-mule.el	2011-04-19 13:44:55 +0000
+++ lisp/ps-mule.el	2011-09-19 18:57:29 +0000
@@ -659,7 +659,7 @@
 	 width)
     (goto-char from)
     (while (not endpos)
-      (cond ((= (point) stop)
+      (cond ((>= (point) stop)
 	     (if (= stop to)
 		 (setq endpos stop)
 	       (when (< from stop)