diff lisp/modes/xpm-mode.el @ 4:b82b59fe008d r19-15b3

Import from CVS: tag r19-15b3
author cvs
date Mon, 13 Aug 2007 08:46:56 +0200
parents ac2d302a0011
children 0293115a14e9
line wrap: on
line diff
--- a/lisp/modes/xpm-mode.el	Mon Aug 13 08:46:35 2007 +0200
+++ b/lisp/modes/xpm-mode.el	Mon Aug 13 08:46:56 2007 +0200
@@ -109,6 +109,14 @@
     (next-line 1)
     (while (not (looking-at "\\s-*\""))
       (next-line 1))
+
+    (save-excursion
+      (goto-char (point-min))
+      (if (re-search-forward 
+	   "\"\\s-*\\([0-9]+\\)\\s-+\\([0-9]+\\)\\s-+\\([0-9]+\\)\\s-+\\([0-9]+\\)\\s-*"
+	   (point-max) t)
+	  (setq xpm-chars-per-pixel (string-to-int (match-string 4)))))
+
     (let ((co 0))
       (while (< co (xpm-num-colors))
 	(progn
@@ -144,7 +152,8 @@
     (let (ext
 	  pixel-chars
 	  pixel-color)
-      (while (< (point) (point-max))
+      (while (and (< (point) (point-max))
+		  (< (+ (point) xpm-chars-per-pixel) (point-max)))
 	(setq pixel-chars
 	      (buffer-substring (point) (+ (point) xpm-chars-per-pixel))
 	      pixel-color (assoc pixel-chars xpm-pixel-values)