[comp.sys.sgi] GNU Emacs, Xdefaults, and version 3.3.1 of Irix

BRUC@DINO.SQUIBB.COM ("Bob Bruccoleri 683-6165", 609) (01/12/91)

I have discovered the problem which caused GNU Emacs 18.55 to fail
to read the .Xdefaults file under Irix 3.3.1. 

GNU Emacs uses XGetDefault to get defaults from the Resource Manager.
Under Irix 3.2.1 which was presumably using X11R3, it worked fine. Under
Irix 3.3.1 which is presumably using the X11R4 version, all the calls
were returning NULL. I fetched the X11R4 distribution, and lo and
behold, the order of the last two arguments is different than either the
documentation or the prototype in /usr/include/X11/Xlib.h indicate. 

I fixed my problem by simply reversing the order of the last two arguments
in the all calls to XGetDefault in the two x11*.c source files.

The problem with the prototypes in Xlib.h is corrected in the first fix 
file for X11R4. There does not appear to be any correction to the
documentation. At the end of this message, I've enclosed pieces of the
relevant files.

It certainly is handy to be able to examine the source code for X.

+-----------------------------------------+----------------------------+
|        Robert E. Bruccoleri, Ph.D.      | Macromolecular Modeling    |
| Hat 1: Research Leader                  | Bristol-Myers Squibb       |
| Hat 2: Interim Internet Network Manager | Pharmaceutical Research    |
| Hat 3: Whatever is Necessary            | Institute                  |
|        bruc@dino.squibb.com             | P.O. Box 4000              |
|        (609) 683-6165                   | Princeton, NJ 08543 USA    |
+-----------------------------------------+----------------------------+

--------------------Piece of XGetDflt.c---------------------------------
/*
 * $XConsortium: XGetDflt.c,v 1.19 89/12/11 19:09:21 rws Exp $
 */

/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.

                        All Rights Reserved

Permission to use, copy, modify, and distribute this software and its 
documentation for any purpose and without fee is hereby granted, 
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in 
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.  

DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

******************************************************************/

#if NeedFunctionPrototypes
char *XGetDefault(
	Display *dpy,			/* display for defaults.... */
	register const char *name,	/* name of option program wants */
	char const *prog)		/* name of program for option	*/
#else
char *XGetDefault(dpy, prog, name)
	Display *dpy;			/* display for defaults.... */
	register char *name;		/* name of option program wants */
	char *prog;			/* name of program for option	*/
#endif
{					/* to get, for example, "font"  */

------------------------Piece of Xlib.h---------------------------------

extern char *XGetDefault(
#if NeedFunctionPrototypes
    Display*		/* display */,
    const char*		/* program */,
    const char*		/* option */		  
#endif
);

-------------------------Irix 3.3.1 Man Page ----------------------------



     XGetDefault(3X11)   X Version 11 (Release 4)    XGetDefault(3X11)



     NAME
          XGetDefault, XResourceManagerString - get X program defaults

     SYNTAX
          char *XGetDefault(display, program, option)
                Display *display;
                char *program;
                char *option;

          char *XResourceManagerString(display)
                  Display *display;

     ARGUMENTS
          display   Specifies the connection to the X server.

          option    Specifies the option name.

          program   Specifies the program name for the Xlib defaults
                    (usually argv[0] of the main program).

     DESCRIPTION
          The XGetDefault function returns the value NULL if the
          option name specified in this argument does not exist for
          the program.  The strings returned by XGetDefault are owned
          by Xlib and should not be modified or freed by the client.

          The XResourceManagerString returns the RESOURCE_MANAGER
          property from the server's root window of screen zero, which
          was returned when the connection was opened using
          XOpenDisplay.  Note that the property value must be in a
          format that is acceptable to XrmGetStringDatabase.

     SEE ALSO
          XOpenDisplay(3X11), XrmGetSearchList(3X11),
          XrmMergeDatabases(3X11)
          Xlib - C Language X Interface

scotth@corp.sgi.com (Scott Henry) (01/14/91)

In article <D7161ABF289F00011B@dino.squibb.com> BRUC@DINO.SQUIBB.COM ("Bob Bruccoleri  683-6165", 609) writes:

bruc> Does anyone have any suggestions? Are there any ways of debugging
bruc> XGetDefault to see why it's failing? Thanks.

The solution I use is to punt: I'm using epoch3.2, which is a version of
GNU Emacs v18.55 patched to support X11 a lot better (and exclusively, so
keep a copy of emacs around for those dial-up sessions...). As best I can
tell, except for the lack of terminfo support, it is a strict superset of
v18.55. I believe that it is available by anonymous ftp from cs.uiuc.edu.
It compiles out-of-the-box on Irix 3.3.1. Make sure that patch1 gets
installed, as it fixes some important bugs.

After doing some investigation, here is what I think happened to X
resources in emacs: The emacs X support was originally written for X10,
which was later hacked up to support X11R1. As X11 evolved, there have
been some compatibility issues from one release to the next, and I
strongly suspect that it was X11R3 (supplied with Irix 3.2.*) -> X11R4
(Irix 3.3.*) xlib changes that did in emacs X resources support. I suspect
that linking with the 3.2 xlib might fix the problem (though that's one
thing I didn't try).


--
 Scott Henry <scotth@sgi.com> / Traveller on Dragon Wings
 Information Services,       / Help! My disclaimer is missing!
 Silicon Graphics, Inc      / Politicians no baka!