Mercurial > hg > xemacs-beta
changeset 4226:9b4442ac18c7
[xemacs-hg @ 2007-10-15 09:55:43 by didierv]
Fix image specifiers related bugs
author | didierv |
---|---|
date | Mon, 15 Oct 2007 09:55:50 +0000 |
parents | e358b6c40407 |
children | dd9c1d5f5319 |
files | lisp/ChangeLog lisp/glyphs.el src/ChangeLog src/glyphs-shared.c src/glyphs-x.c src/glyphs.c |
diffstat | 6 files changed, 107 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Mon Oct 15 06:54:23 2007 +0000 +++ b/lisp/ChangeLog Mon Oct 15 09:55:50 2007 +0000 @@ -1,3 +1,9 @@ +2007-10-15 Didier Verna <didier@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@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@xemacs.org> @@ -52,13 +58,13 @@ * unicode.el (featurep): Comment out the assertion until the issue in 18179.49815.622843.336527@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@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@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@xemacs.org>
--- a/lisp/glyphs.el Mon Oct 15 06:54:23 2007 +0000 +++ b/lisp/glyphs.el Mon Oct 15 09:55:50 2007 +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@cs.uiuc.edu>, Ben Wing <ben@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]))) @@ -1218,6 +1228,10 @@ ;; 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 "^") (set-glyph-image invisible-text-glyph " ...")
--- a/src/ChangeLog Mon Oct 15 06:54:23 2007 +0000 +++ b/src/ChangeLog Mon Oct 15 09:55:50 2007 +0000 @@ -1,3 +1,17 @@ +2007-10-10 Didier Verna <didier@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@xemacs.org> * faces.c (reset_face_cachels): Check for noninteractive mode in
--- a/src/glyphs-shared.c Mon Oct 15 06:54:23 2007 +0000 +++ b/src/glyphs-shared.c Mon Oct 15 09:55:50 2007 +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);
--- a/src/glyphs-x.c Mon Oct 15 06:54:23 2007 +0000 +++ b/src/glyphs-x.c Mon Oct 15 09:55:50 2007 +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))
--- a/src/glyphs.c Mon Oct 15 06:54:23 2007 +0000 +++ b/src/glyphs.c Mon Oct 15 09:55:50 2007 +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);