From xemacs-m  Fri May 30 11:41:56 1997
Received: from jagor.srce.hr (hniksic@jagor.srce.hr [161.53.2.130])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id LAA28796
	for <xemacs-beta@xemacs.org>; Fri, 30 May 1997 11:41:54 -0500 (CDT)
Received: (from hniksic@localhost)
          by jagor.srce.hr (8.8.5/8.8.4)
	  id SAA08728; Fri, 30 May 1997 18:41:53 +0200 (MET DST)
To: XEmacs Developers <xemacs-beta@xemacs.org>
Subject: [patch] Minor autodetection cleanup
X-Attribution: Hrv
X-Face: Mie8:rOV<\c/~z{s.X4A{!?vY7{drJ([U]0O=W/<W*SMo/Mv:58:*_y~ki>xDi&N7XG
        KV^$k0m3Oe/)'e%3=$PCR&3ITUXH,cK>]bci&<qQ>Ff%x_>1`T(+M2Gg/fgndU%k*ft
        [(7._6e0n-V%|%'[c|q:;}td$#INd+;?!-V=c8Pqf}3J
X-Antipastobozoticataclysm: Bariumenemanilow
From: Hrvoje Niksic <hniksic@srce.hr>
Date: 30 May 1997 18:41:50 +0200
Message-ID: <kiglo4w6hf5.fsf@jagor.srce.hr>
Lines: 68
X-Mailer: Gnus v5.4.52/XEmacs 20.2

Default autodetection regexps are very bogus.  For example, you can't
specify "\.xpm$"; first, "\." is the same as "." -- the author
probably wanted "\\.".  Second, `\'' should be used instead of $.

For large buffers `\`' and `\'' are matched momentarily, whereas ^ and 
$ require line-matching (which means an even greater slowdown under
Mule).

Here is a patch against glyphs.el to fix it.

Fri May 30 18:39:01 1997  Hrvoje Niksic  <hniksic@srce.hr>

	* prim/glyphs.el (init-glyphs): Minor regexp cleanup.


--- lisp/prim/glyphs.el.orig	Fri May 30 18:11:12 1997
+++ lisp/prim/glyphs.el	Fri May 30 18:20:34 1997
@@ -596,19 +596,18 @@
   ;; initialize default image types
   (if (featurep 'x)
     (set-console-type-image-conversion-list 'x
-     `(,@(if (featurep 'xpm) '(("\.xpm$" [xpm :file nil] 2)))
-       ,@(if (featurep 'xpm) '(("^/\\* XPM \\*/" [xpm :data nil] 2)))
-       ,@(if (featurep 'xface) '(("^X-Face:" [xface :data nil] 2)))
-       ,@(if (featurep 'gif) '(("\.gif$" [gif :file nil] 2)))
-       ,@(if (featurep 'gif) '(("^GIF8[79]" [gif :data nil] 2)))
-       ,@(if (featurep 'jpeg) '(("\.jpeg$" [jpeg :file nil] 2)))
-       ,@(if (featurep 'jpeg) '(("\.jpg$" [jpeg :file nil] 2)))
+     `(,@(if (featurep 'xpm) '(("\\.xpm$\\'" [xpm :file nil] 2)))
+       ,@(if (featurep 'xpm) '(("\\`/\\* XPM \\*/" [xpm :data nil] 2)))
+       ,@(if (featurep 'xface) '(("\\`X-Face:" [xface :data nil] 2)))
+       ,@(if (featurep 'gif) '(("\\.gif\\'" [gif :file nil] 2)))
+       ,@(if (featurep 'gif) '(("\\`GIF8[79]" [gif :data nil] 2)))
+       ,@(if (featurep 'jpeg) '(("\\.jpe?g\\'" [jpeg :file nil] 2)))
        ;; all of the JFIF-format JPEG's that I've seen begin with
        ;; the following.  I have no idea if this is standard.
-       ,@(if (featurep 'jpeg) '(("^\377\330\340\000\020JFIF"
+       ,@(if (featurep 'jpeg) '(("\\`\377\330\340\000\020JFIF"
 				 [jpeg :data nil] 2)))
-       ,@(if (featurep 'png) '(("\.png$" [png :file nil] 2)))
-       ,@(if (featurep 'png) '(("^\211PNG" [png :data nil] 2)))
+       ,@(if (featurep 'png) '(("\\.png\\'" [png :file nil] 2)))
+       ,@(if (featurep 'png) '(("\\`\211PNG" [png :data nil] 2)))
        ("" [autodetect :data nil] 2))))
   ;; #### this should really be formatted-string, not string but we
   ;; don't have it implemented yet
@@ -621,10 +620,10 @@
 	(set-console-type-image-conversion-list
 	 'tty
 	 '(("^#define" [string :data "[xpm]"])
-	   ("^X-Face:" [string :data "[xface]"])
-	   ("^/\\* XPM \\*/" [string :data "[xpm]"])
-	   ("^GIF87" [string :data "[gif]"])
-	   ("^\377\330\340\000\020JFIF" [string :data "[jpeg]"])
+	   ("\\`X-Face:" [string :data "[xface]"])
+	   ("\\`/\\* XPM \\*/" [string :data "[xpm]"])
+	   ("\\`GIF87" [string :data "[gif]"])
+	   ("\\`\377\330\340\000\020JFIF" [string :data "[jpeg]"])
 	   ("" [string :data nil] 2)
 	   ;; this last one is here for pointers and icons and such --
 	   ;; strings are not allowed so they will be ignored.



-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
Oh lord won't you buy me a color TV...

