CVS update by didierv xemacs/src ...

xemacs-cvs at xemacs.org xemacs-cvs at xemacs.org
Mon Oct 15 05:55:52 EDT 2007


  User: didierv 
  Date: 07/10/15 11:55:52

  Modified:    xemacs/src ChangeLog glyphs-shared.c glyphs-x.c glyphs.c
Log:
Fix image specifiers related bugs

Revision  Changes    Path
1.850     +22 -16    XEmacs/xemacs/lisp/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/ChangeLog,v
retrieving revision 1.849
retrieving revision 1.850
diff -u -p -r1.849 -r1.850
--- ChangeLog	2007/10/13 14:08:26	1.849
+++ ChangeLog	2007/10/15 09:55:43	1.850
@@ -1,3 +1,9 @@
+2007-10-15  Didier Verna  <didier at 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.
+
 2007-10-13  Aidan Kehoe  <kehoea at parhasard.net>
 
 	* cmdloop.el (yes-or-no-p):
@@ -11,36 +17,36 @@
 	that is useless and leads to stack overflows without Mule. Delete
 	'iso-8859-2 as an alias on non-Mule
 	* faces.el (face-font-instance):
-	Only call get-charset if it's bound. 
+	Only call get-charset if it's bound.
 	* faces.el (xpm-color-symbols):
-	Only modify xpm-color-symbols if it's bound. 
+	Only modify xpm-color-symbols if it's bound.
 	* map-ynp.el (map-y-or-n-p):
-	Check that #'get-dialog-box-response is bound before calling it. 
+	Check that #'get-dialog-box-response is bound before calling it.
 	* menubar.el:
 	List #'menu-split-long-menu as an autoload, for those builds that
 	don't use it at runtime but nonetheless have to compile code that
-	uses it. 
+	uses it.
 	* minibuf.el (mouse-read-file-name-1):
-	Only use scrollbar-width if it's bound. 
+	Only use scrollbar-width if it's bound.
 	* obsolete.el:
 	Only provide #'add-meu-item, #'add-menu,
 	#'package-get-download-menu if the menubar feature is available at
-	runtime. 
+	runtime.
 	* obsolete.el (find-non-ascii-charset-string):
-	Only call #'charset-in-string if it's bound; else give nil. 
+	Only call #'charset-in-string if it's bound; else give nil.
 	* obsolete.el (find-non-ascii-charset-region):
-	Only call #'charset-in-region if it's bound; else give nil. 
+	Only call #'charset-in-region if it's bound; else give nil.
 	* select.el (activate-region-as-selection):
-	Only call #'mouse-track-rectangle-p if it's bound. 
+	Only call #'mouse-track-rectangle-p if it's bound.
 	* select.el (select-make-extent-for-selection):
-	Ditto. 
+	Ditto.
 	* simple.el (zmacs-make-extent-for-region):
-	Only call #'default-mouse-track-next-move-rect if it's bound. 
+	Only call #'default-mouse-track-next-move-rect if it's bound.
 	* simple.el (zmacs-activate-region):
 	Use and-boundp rather than (and (boundp ...))) when checking for a
-	variable. 
+	variable.
 	* unicode.el (featurep):
-	Don't bind res, which is not used, in the loop. 
+	Don't bind res, which is not used, in the loop.
 
 2007-10-06  Stephen J. Turnbull  <stephen at xemacs.org>
 
@@ -52,13 +58,13 @@
 	* unicode.el (featurep):
 	Comment out the assertion until the issue in
 	18179.49815.622843.336527 at parhasard.net is fixed.  This doesn't
-	remove any functionality, just a check. 
+	remove any functionality, just a check.
 
 2007-10-02  Aidan Kehoe  <kehoea at parhasard.net>
 
 	* code-files.el (insert-file-contents):
 	Document that START and END are zero-based, in contrast to buffer
-	offsets, and give an example of their use. 
+	offsets, and give an example of their use.
 
 2007-09-09  Aidan Kehoe  <kehoea at parhasard.net>
 
@@ -75,7 +81,7 @@
 	region.
 	* unicode.el (unicode-error-translate-region) New.
 	Translate the error octets in a region to the corresponding
-	ASCII, control-1 and latin-1 characters. 
+	ASCII, control-1 and latin-1 characters.
 
 2007-10-02  Didier Verna  <didier at xemacs.org>
 



1.10      +23 -9     XEmacs/xemacs/lisp/glyphs.el

Index: glyphs.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/glyphs.el,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -r1.9 -r1.10
--- glyphs.el	2005/11/13 07:39:28	1.9
+++ glyphs.el	2007/10/15 09:55:44	1.10
@@ -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 at cs.uiuc.edu>, Ben Wing <ben at xemacs.org>
 ;; Maintainer: XEmacs Development Team
@@ -1184,24 +1185,33 @@ If unspecified in a particular domain, `
 				 [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 @@ If unspecified in a particular domain, `
 	;; 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 "^")



1.1103    +14 -0     XEmacs/xemacs/src/ChangeLog

Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.1102
retrieving revision 1.1103
diff -u -p -r1.1102 -r1.1103
--- ChangeLog	2007/10/03 21:31:10	1.1102
+++ ChangeLog	2007/10/15 09:55:48	1.1103
@@ -1,3 +1,17 @@
+2007-10-10  Didier Verna  <didier at 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.
+
 2007-10-03  Didier Verna  <didier at xemacs.org>
 
 	* faces.c (reset_face_cachels): Check for noninteractive mode in



1.9       +6 -3      XEmacs/xemacs/src/glyphs-shared.c

Index: glyphs-shared.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/glyphs-shared.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -p -r1.8 -r1.9
--- glyphs-shared.c	2004/11/04 23:06:33	1.8
+++ glyphs-shared.c	2007/10/15 09:55:49	1.9
@@ -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 @@ shared_resource_normalize (Lisp_Object i
   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);



1.85      +8 -3      XEmacs/xemacs/src/glyphs-x.c

Index: glyphs-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/glyphs-x.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -p -r1.84 -r1.85
--- glyphs-x.c	2005/11/26 11:46:08	1.84
+++ glyphs-x.c	2007/10/15 09:55:50	1.85
@@ -550,16 +550,19 @@ Lisp_Object Vx_bitmap_file_path;
    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 @@ x_locate_pixmap_file (Lisp_Object name)
 	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))



1.57      +34 -11    XEmacs/xemacs/src/glyphs.c

Index: glyphs.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/glyphs.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -p -r1.56 -r1.57
--- glyphs.c	2007/08/15 11:06:09	1.56
+++ glyphs.c	2007/10/15 09:55:50	1.57
@@ -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 @@ potential_pixmap_file_instantiator (Lisp
 
   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 @@ simple_image_type_normalize (Lisp_Object
   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 @@ xbm_normalize (Lisp_Object inst, Lisp_Ob
   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 @@ xbm_normalize (Lisp_Object inst, Lisp_Ob
 		       alist);
     }
 
+  /* #### FIXME: Hmmm... what about mask being Qt ?? -- dvl */
   alist = xbm_mask_file_munging (alist, file, mask_file, console_type);
 
   {
@@ -2878,14 +2893,19 @@ xface_normalize (Lisp_Object inst, Lisp_
   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 @@ xpm_normalize (Lisp_Object inst, Lisp_Ob
   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 @@ xpm_normalize (Lisp_Object inst, Lisp_Ob
   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);





More information about the XEmacs-CVS mailing list