From xemacs-m  Mon Mar 24 00:57:08 1997
Received: from crystal.WonderWorks.COM (crystal.WonderWorks.com [192.203.206.1])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id AAA16903
	for <xemacs-beta@xemacs.org>; Mon, 24 Mar 1997 00:56:55 -0600 (CST)
Received: by crystal.WonderWorks.COM 
	id QQcifj01139; Mon, 24 Mar 1997 01:56:43 -0500 (EST)
Date: Mon, 24 Mar 1997 01:56:43 -0500 (EST)
Message-Id: <QQcifj01139.199703240656@crystal.WonderWorks.COM>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: Kyle Jones <kyle_jones@wonderworks.com>
To: xemacs-beta@xemacs.org
Subject: [PATCH] 20.1-b9: new specifier type: display-table
In-Reply-To: <kigafnuccdc.fsf@jagor.srce.hr>
References: <199703232320.RAA09285@xemacs.org>
	<kig2096dw5l.fsf@jagor.srce.hr>
	<QQcieh24204.199703232353@crystal.WonderWorks.COM>
	<kigvi6icfsp.fsf@jagor.srce.hr>
	<QQciek24962.199703240040@crystal.WonderWorks.COM>
	<kigafnuccdc.fsf@jagor.srce.hr>
X-Mailer: VM 6.23 under 20.1 XEmacs Lucid (beta9)
X-Face: /cA45WHG7jWq>(O3&Z57Y<"WsX5ddc,4c#w0F*zrV#=M
        0@~@,s;b,aMtR5Sqs"+nU.z^CSFQ9t`z2>W,S,]:[+2^
        Nbf6v4g>!&,7R4Ot4Wg{&tm=WX7P["9%a)_da48-^tGy
        ,qz]Z,Zz\{E.,]'EO+F)@$KtF&V

Hrvoje Niksic writes:
 > Kyle Jones <kyle_jones@wonderworks.com> writes:
 > 
 > > set-specifier tries to munge all kind of abominable things into
 > > the form add-spec-list-to-specifier wants to see.
 > [...]
 > > canonicalization function several layers down leaves the
 > > partially canonicalized list alone instead of converting it into
 > > a full rock-n-roll, tagged instantiator list.
 > 
 > Yup, I begin to see what's going on.  How about documenting this
 > lossage in the manual (and maybe in the docstring of `set-specifier').
 > There will probably be other people bitten by this in the future.

Simpler to just fix it, at least for current-display-table.

The following patch, Meerschweinchen, adds a new specifier type,
display-table.  It is used in current-display-table and for the
face display-table property.  With this change, set-specifier can
now be used on current-display-table and on face display-table
properties.

===================================================================
RCS file: src/emacsfns.h,v
retrieving revision 1.1
diff -c -r1.1 src/emacsfns.h
*** 1.1	1997/03/24 06:48:23
--- src/emacsfns.h	1997/03/24 06:48:46
***************
*** 1303,1308 ****
--- 1303,1309 ----
  extern Lisp_Object Qformatted_string;
  extern Lisp_Object Qicon;
  extern Lisp_Object Qconst_glyph_variable;
+ extern Lisp_Object Qdisplay_table;
  Error_behavior decode_error_behavior_flag (Lisp_Object no_error);
  Lisp_Object encode_error_behavior_flag (Error_behavior errb);
  
===================================================================
RCS file: src/faces.c,v
retrieving revision 1.1
diff -c -r1.1 src/faces.c
*** 1.1	1997/03/24 05:55:38
--- src/faces.c	1997/03/24 06:01:28
***************
*** 825,832 ****
    set_font_attached_to (f->font, face, Qfont);
    f->background_pixmap = Fmake_specifier (Qimage);
    set_image_attached_to (f->background_pixmap, face, Qbackground_pixmap);
!   /* #### need a special display-table specifier */
!   f->display_table = Fmake_specifier (Qgeneric);
    f->underline = Fmake_specifier (Qface_boolean);
    set_face_boolean_attached_to (f->underline, face, Qunderline);
    f->strikethru = Fmake_specifier (Qface_boolean);
--- 825,831 ----
    set_font_attached_to (f->font, face, Qfont);
    f->background_pixmap = Fmake_specifier (Qimage);
    set_image_attached_to (f->background_pixmap, face, Qbackground_pixmap);
!   f->display_table = Fmake_specifier (Qdisplay_table);
    f->underline = Fmake_specifier (Qface_boolean);
    set_face_boolean_attached_to (f->underline, face, Qunderline);
    f->strikethru = Fmake_specifier (Qface_boolean);
===================================================================
RCS file: src/glyphs.c,v
retrieving revision 1.1
diff -c -r1.1 src/glyphs.c
*** 1.1	1997/03/24 02:56:20
--- src/glyphs.c	1997/03/24 05:00:38
***************
*** 54,59 ****
--- 54,60 ----
  Lisp_Object Qmono_pixmap, Qcolor_pixmap, Qsubwindow;
  
  Lisp_Object Vcurrent_display_table;
+ Lisp_Object Qdisplay_table;
  
  Lisp_Object Vtruncation_glyph, Vcontinuation_glyph, Voctal_escape_glyph;
  Lisp_Object Vcontrol_arrow_glyph, Vinvisible_text_glyph, Vhscroll_glyph;
***************
*** 2939,2945 ****
  nil means display the character in the default fashion.
  Faces can have their own, overriding display table.
  */ );
!   Vcurrent_display_table = Fmake_specifier (Qgeneric);
    set_specifier_fallback (Vcurrent_display_table,
  			  list1 (Fcons (Qnil, Qnil)));
    set_specifier_caching (Vcurrent_display_table,
--- 2940,2946 ----
  nil means display the character in the default fashion.
  Faces can have their own, overriding display table.
  */ );
!   Vcurrent_display_table = Fmake_specifier (Qdisplay_table);
    set_specifier_fallback (Vcurrent_display_table,
  			  list1 (Fcons (Qnil, Qnil)));
    set_specifier_caching (Vcurrent_display_table,
===================================================================
RCS file: src/specifier.c,v
retrieving revision 1.1
diff -c -r1.1 src/specifier.c
*** 1.1	1997/03/24 04:14:44
--- src/specifier.c	1997/03/24 05:30:15
***************
*** 35,40 ****
--- 35,41 ----
  #include "opaque.h"
  #include "specifier.h"
  #include "window.h"
+ #include "glyphs.h"  /* for DISP_TABLE_SIZE definition */
  
  Lisp_Object Qspecifierp;
  Lisp_Object Qprepend, Qappend, Qremove_tag_set_prepend, Qremove_tag_set_append;
***************
*** 2877,2882 ****
--- 2878,2906 ----
    return (BOOLEAN_SPECIFIERP (object) ? Qt : Qnil);
  }
  
+ /************************************************************************/
+ /*                        Display table specifier type                  */
+ /************************************************************************/
+ 
+ DEFINE_SPECIFIER_TYPE (display_table);
+ 
+ void
+ display_table_validate(instantiator)
+ {
+   if (!NILP(instantiator) &&
+       (!VECTORP (instantiator) ||
+        XVECTOR (instantiator)->size != DISP_TABLE_SIZE))
+     dead_wrong_type_argument(display_table_specifier_methods->predicate_symbol, instantiator);
+   return;
+ }
+ DEFUN ("display-table-specifier-p", Fdisplay_table_specifier_p, 1, 1, 0, /*
+ Return non-nil if OBJECT is an display-table specifier.
+ */
+        (object))
+ {
+   return (DISPLAYTABLE_SPECIFIERP (object) ? Qt : Qnil);
+ }
+ 
  
  /************************************************************************/
  /*                           Initialization                             */
***************
*** 2977,2982 ****
--- 3001,3011 ----
    INITIALIZE_SPECIFIER_TYPE (boolean, "boolean", "boolean-specifier-p");
  
    SPECIFIER_HAS_METHOD (boolean, validate);
+ 
+   INITIALIZE_SPECIFIER_TYPE (display_table, "display-table",
+ 			     "display-table-p");
+ 
+   SPECIFIER_HAS_METHOD (display_table, validate);
  }
  
  void
===================================================================
RCS file: src/specifier.h,v
retrieving revision 1.1
diff -c -r1.1 src/specifier.h
*** 1.1	1997/03/24 04:39:00
--- src/specifier.h	1997/03/24 04:39:44
***************
*** 311,314 ****
--- 311,321 ----
  #define CHECK_BOOLEAN_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, boolean)
  #define CONCHECK_BOOLEAN_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, boolean)
  
+ DECLARE_SPECIFIER_TYPE (display_table);
+ #define XDISPLAYTABLE_SPECIFIER(x) XSPECIFIER_TYPE (x, display_table)
+ #define XSETDISPLAYTABLE_SPECIFIER(x, p) XSETSPECIFIER_TYPE (x, p, display_table)
+ #define DISPLAYTABLE_SPECIFIERP(x) SPECIFIER_TYPEP (x, display_table)
+ #define CHECK_DISPLAYTABLE_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, display_table)
+ #define CONCHECK_DISPLAYTABLE_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, display_table)
+ 
  #endif /* _XEMACS_SPECIFIER_H_ */

