Dear reviewers,
the following patch finally fixes the systematic bugs that I've
been experiencing with 21.5 in the past 3 years or so. The reason it's
been so hard on me was not that the bugs, in themselves, were difficult
to figure out. The reason was that they occur only with
log/display-warnings-minimum-level set to 'debug, and it's the code
signaling / displaying the errors that crashes (there are still a lot of
bugs in this area, especially when errors occur during redisplay). So my
investigations were completely mislead at first, and I had to
random-guess break points little by little in redisplay in order to
avoid crashing in a lisp backtrace unrelated to the original problem :-/
But now, I think we're finally ready for a 21.5 release ;-)
I'll apply it in a few days if nobody objects.
lisp/ChangeLog addition:
2007-10-10 Didier Verna <didier(a)xemacs.org>
* glyphs.el (init-glyphs): Use more sensible image conversion
rules for tty consoles (don't inline images, explicitely recognize
more image types). Avoid images on stream consoles altogether.
src/ChangeLog addition:
2007-10-10 Didier Verna <didier(a)xemacs.org>
* glyphs.c (potential_pixmap_file_instantiator): Make a difference
between not being able to locate a pixmap file, and not having a
console method to do so.
* glyphs.c (simple_image_type_normalize): Notice that difference,
and don't err when the method is unavailable.
* glyphs.c (xbm_normalize): Ditto.
* glyphs.c (xface_normalize): Ditto.
* glyphs.c (xpm_normalize): Ditto.
* glyphs-shared.c (shared_resource_normalize): Ditto.
* glyphs-x.c (x_locate_pixmap_file): Recognize ~ pathnames as
fully qualified.
XEmacs source patch:
Diff command: cvs -q diff -u -t -b -B -w
Files affected: src/glyphs.c src/glyphs-x.c src/glyphs-shared.c lisp/glyphs.el
Index: lisp/glyphs.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/glyphs.el,v
retrieving revision 1.9
diff -u -u -t -b -B -w -r1.9 glyphs.el
--- lisp/glyphs.el 13 Nov 2005 07:39:28 -0000 1.9
+++ lisp/glyphs.el 10 Oct 2007 08:27:56 -0000
@@ -2,6 +2,7 @@
;; Copyright (C) 1994, 1997 Free Software Foundation, Inc.
;; Copyright (C) 1995, 1996, 2000, 2005 Ben Wing.
+;; Copyright (C) 2007 Didier Verna
;; Author: Chuck Thompson <cthomp(a)cs.uiuc.edu>, Ben Wing <ben(a)xemacs.org>
;; Maintainer: XEmacs Development Team
@@ -1184,24 +1185,33 @@
[jpeg :data nil] 2)))
,@(if (featurep 'png) '(("\\.png\\'" [png :file nil] 2)))
,@(if (featurep 'png) '(("\\`\211PNG" [png :data nil] 2)))
- ("" [string :data nil] 2)
+ ;; No, I don't think we want to inline images... -- dvl
+ ;; ("" [string :data nil] 2)
("" [nothing]))))
;; #### this should really be formatted-string, not string but we
;; don't have it implemented yet
- ;;
- ;; #define could also mean a bitmap as well as a version 1 XPM. Who
- ;; cares. We don't want the file contents getting converted to a
- ;; string in either case which is why the entry is there.
(if (featurep 'tty)
(progn
(set-console-type-image-conversion-list
'tty
- '(("^#define" [string :data "[xpm]"])
- ("\\`X-Face:" [string :data "[xface]"])
+ '(("\\.xpm\\'" [string :data nil] 2)
+ ("\\.xbm\\'" [string :data nil] 2)
+ ;; #define could also mean a bitmap as well as a version 1 XPM. Who
+ ;; cares.
+ ("^#define" [string :data "[xpm]"])
("\\`/\\* XPM \\*/" [string :data "[xpm]"])
- ("\\`GIF87" [string :data "[gif]"])
+ ("\\`X-Face:" [string :data "[xface]"])
+ ("\\.gif\\'" [string :data nil] 2)
+ ("\\`GIF8[79]" [string :data "[gif]"])
+ ("\\.jpe?g\\'" [string :data nil] 2)
("\\`\377\330\340\000\020JFIF" [string :data "[jpeg]"])
- ("" [string :data 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.
+ ("\\`\377\330\377\340\000\020JFIF" [string :data
"[jpeg]"])
+ ("\\.png\\'" [string :data nil] 2)
+ ("\\`\211PNG" [string :data "[png]"])
+ ;; No, I don't think we want to inline images... -- dvl
+ ;;("" [string :data nil] 2)
;; this last one is here for pointers and icons and such --
;; strings are not allowed so they will be ignored.
("" [nothing])))
@@ -1217,6 +1227,10 @@
;; finish initializing hscroll glyph -- created internally
;; because it has a built-in bitmap
(set-glyph-image hscroll-glyph "$" 'global 'tty)))
+
+ ;; For streams, we don't want images at all -- dvl
+ (set-console-type-image-conversion-list 'stream '(("" [nothing])))
+
(set-glyph-image octal-escape-glyph "\\")
(set-glyph-image control-arrow-glyph "^")
Index: src/glyphs-shared.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/glyphs-shared.c,v
retrieving revision 1.8
diff -u -u -t -b -B -w -r1.8 glyphs-shared.c
--- src/glyphs-shared.c 4 Nov 2004 23:06:33 -0000 1.8
+++ src/glyphs-shared.c 10 Oct 2007 08:27:56 -0000
@@ -1,10 +1,10 @@
/* Routines shared between window-system backends for glyph objects.
Copyright (C) 1993, 1994 Free Software Foundation, Inc.
- Copyright (C) 1995 Board of Trustees, University of Illinois.
+ Copyright (C) 1995 Board of Trustees, University of Illinois
Copyright (C) 1995 Tinker Systems
Copyright (C) 1995, 1996, 2001 Ben Wing
Copyright (C) 1995 Sun Microsystems
- Copyright (C) 1998, 1999, 2000 Andy Piper.
+ Copyright (C) 1998, 1999, 2000 Andy Piper
This file is part of XEmacs.
@@ -75,12 +75,15 @@
file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
console_type);
+ if (NILP (file)) /* normalization impossible for the console type */
+ RETURN_UNGCPRO (Qnil);
+
if (CONSP (file)) /* failure locating filename */
signal_double_image_error ("Opening pixmap file",
"no such file or directory",
Fcar (file));
- if (NILP (file)) /* no conversion necessary */
+ if (EQ (file, Qt)) /* no conversion necessary */
RETURN_UNGCPRO (inst);
alist = tagged_vector_to_alist (inst);
Index: src/glyphs-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/glyphs-x.c,v
retrieving revision 1.84
diff -u -u -t -b -B -w -r1.84 glyphs-x.c
--- src/glyphs-x.c 26 Nov 2005 11:46:08 -0000 1.84
+++ src/glyphs-x.c 10 Oct 2007 08:27:56 -0000
@@ -550,16 +550,19 @@
where the file might be located. Return a full pathname if found;
otherwise, return Qnil. */
+/* #### FIXME: when Qnil is returned, the caller can't make a difference
+ #### between a non existing X device, an unreadable file, or an actual
+ #### failure to locate the file, so the issued message is really not
+ #### informative. -- dvl */
static Lisp_Object
x_locate_pixmap_file (Lisp_Object name)
{
/* This function can GC if IN_REDISPLAY is false */
Display *display;
- /* Check non-absolute pathnames with a directory component relative to
- the search path; that's the way Xt does it. */
/* #### Unix-specific */
- if (string_byte (name, 0) == '/' ||
+ if (string_byte (name, 0) == '~' ||
+ string_byte (name, 0) == '/' ||
(string_byte (name, 0) == '.' &&
(string_byte (name, 1) == '/' ||
(string_byte (name, 1) == '.' &&
@@ -571,6 +574,8 @@
return Qnil;
}
+ /* Check non-absolute pathnames with a directory component relative to
+ the search path; that's the way Xt does it. */
{
Lisp_Object defx = get_default_device (Qx);
if (NILP (defx))
Index: src/glyphs.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/glyphs.c,v
retrieving revision 1.56
diff -u -u -t -b -B -w -r1.56 glyphs.c
--- src/glyphs.c 15 Aug 2007 11:06:09 -0000 1.56
+++ src/glyphs.c 10 Oct 2007 08:27:56 -0000
@@ -1,9 +1,10 @@
/* Generic glyph/image implementation + display tables
- Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
+ Copyright (C) 1994, 1995 Board of Trustees, University of Illinois
Copyright (C) 1995 Tinker Systems
Copyright (C) 1995, 1996, 2000, 2001, 2002, 2004, 2005 Ben Wing
Copyright (C) 1995 Sun Microsystems
Copyright (C) 1998, 1999, 2000 Andy Piper
+ Copyright (C) 2007 Didier Verna
This file is part of XEmacs.
@@ -2554,19 +2555,26 @@
if (!NILP (file) && NILP (data))
{
- Lisp_Object retval = MAYBE_LISP_CONTYPE_METH
- (decode_console_type(console_type, ERROR_ME),
- locate_pixmap_file, (file));
+ struct console_methods *meths
+ = decode_console_type(console_type, ERROR_ME);
+
+ if (HAS_CONTYPE_METH_P (meths, locate_pixmap_file))
+ {
+ Lisp_Object retval
+ = CONTYPE_METH (meths, locate_pixmap_file, (file));
if (!NILP (retval))
return retval;
else
return Fcons (file, Qnil); /* should have been file */
}
-
+ else /* method unavailable */
return Qnil;
}
+ return Qt;
+}
+
Lisp_Object
simple_image_type_normalize (Lisp_Object inst, Lisp_Object console_type,
Lisp_Object image_type_tag)
@@ -2589,12 +2597,15 @@
file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
console_type);
+ if (NILP (file)) /* normalization impossible for the console type */
+ RETURN_UNGCPRO (Qnil);
+
if (CONSP (file)) /* failure locating filename */
signal_double_image_error ("Opening pixmap file",
"no such file or directory",
Fcar (file));
- if (NILP (file)) /* no conversion necessary */
+ if (EQ (file, Qt)) /* no conversion necessary */
RETURN_UNGCPRO (inst);
alist = tagged_vector_to_alist (inst);
@@ -2793,17 +2804,20 @@
mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file,
Q_mask_data, console_type);
+ if (NILP (file)) /* normalization impossible for the console type */
+ RETURN_UNGCPRO (Qnil);
+
if (CONSP (file)) /* failure locating filename */
signal_double_image_error ("Opening bitmap file",
"no such file or directory",
Fcar (file));
- if (NILP (file) && NILP (mask_file)) /* no conversion necessary */
+ if (EQ (file, Qt) && EQ (mask_file, Qt)) /* no conversion necessary */
RETURN_UNGCPRO (inst);
alist = tagged_vector_to_alist (inst);
- if (!NILP (file))
+ if (!EQ (file, Qt))
{
int xhot, yhot;
Lisp_Object data = bitmap_to_lisp_data (file, &xhot, &yhot, 0);
@@ -2820,6 +2834,7 @@
alist);
}
+ /* #### FIXME: Hmmm... what about mask being Qt ?? -- dvl */
alist = xbm_mask_file_munging (alist, file, mask_file, console_type);
{
@@ -2878,14 +2893,19 @@
mask_file = potential_pixmap_file_instantiator (inst, Q_mask_file,
Q_mask_data, console_type);
+ if (NILP (file)) /* normalization impossible for the console type */
+ RETURN_UNGCPRO (Qnil);
+
if (CONSP (file)) /* failure locating filename */
signal_double_image_error ("Opening bitmap file",
"no such file or directory",
Fcar (file));
- if (NILP (file) && NILP (mask_file)) /* no conversion necessary */
+ if (EQ (file, Qt) && EQ (mask_file, Qt)) /* no conversion necessary */
RETURN_UNGCPRO (inst);
+
+ /* #### FIXME: and what about file / mask being Qt ? -- dvl */
alist = tagged_vector_to_alist (inst);
{
@@ -3094,6 +3114,9 @@
file = potential_pixmap_file_instantiator (inst, Q_file, Q_data,
console_type);
+ if (NILP (file)) /* normalization impossible for the console type */
+ RETURN_UNGCPRO (Qnil);
+
if (CONSP (file)) /* failure locating filename */
signal_double_image_error ("Opening pixmap file",
"no such file or directory",
@@ -3102,13 +3125,13 @@
color_symbols = find_keyword_in_vector_or_given (inst, Q_color_symbols,
Qunbound);
- if (NILP (file) && !UNBOUNDP (color_symbols))
+ if (EQ (file, Qt) && !UNBOUNDP (color_symbols))
/* no conversion necessary */
RETURN_UNGCPRO (inst);
alist = tagged_vector_to_alist (inst);
- if (!NILP (file))
+ if (!NILP (file) && !EQ (file, Qt))
{
Lisp_Object data = pixmap_to_lisp_data (file, 0);
alist = remassq_no_quit (Q_file, alist);
--
New @-quartet featured CD Review !!
http://www.indie-music.com/modules.php?name=News&file=article&sid...
Didier Verna, didier(a)lrde.epita.fr,
http://www.lrde.epita.fr/~didier
EPITA / LRDE, 14-16 rue Voltaire Tel.+33 (1) 44 08 01 85
94276 Le Kremlin-Bicêtre, France Fax.+33 (1) 53 14 59 22 didier(a)xemacs.org
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches