changeset 4373:713ca3d356b4

Automated merge with file:/Sources/xemacs-21.5-checked-out
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 31 Dec 2007 21:35:20 +0100
parents ebb35ddea76a (current diff) 9fdac4a4ae62 (diff)
children 4939bde48d12
files lisp/ChangeLog
diffstat 22 files changed, 486 insertions(+), 95 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Mon Dec 31 21:34:45 2007 +0100
+++ b/.hgignore	Mon Dec 31 21:35:20 2007 +0100
@@ -44,4 +44,4 @@
 ^src/xemacs\.def(\.in)?$
 ^src/xemacs\.dmp$
 ^src/Emacs\.ad\.h$
-
+^etc/bundled-packages/.*\.tar\.gz$
--- a/ChangeLog	Mon Dec 31 21:34:45 2007 +0100
+++ b/ChangeLog	Mon Dec 31 21:35:20 2007 +0100
@@ -1,3 +1,23 @@
+2007-12-26  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* Makefile.in.in (mkpkgdir): Ensure only one late package directory.
+
+2007-12-26  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* Makefile.in.in (check-available-packages): Say where to install.
+	(mkpkgdir): 
+
+2007-12-23  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* Makefile.in.in (mkpkgdir):
+	(check-available-packages):
+	(install-bootstrap-packages):
+	(install-nonmule-packages):
+	(install-all-packages):
+	New targets supporting bundled packages.
+
+	* .hgignore: Ignore tarballs in etc/bundled-packages/.
+
 2007-12-08  Jerry James  <james@xemacs.org>
 
 	* config.guess:
--- a/Makefile.in.in	Mon Dec 31 21:34:45 2007 +0100
+++ b/Makefile.in.in	Mon Dec 31 21:35:20 2007 +0100
@@ -491,6 +491,58 @@
 #endif
 	  ${sitelispdir}
 
+## Install bundled packages, if present.
+
+package_path = @LATE_PACKAGE_DIRECTORIES@
+pkgsrcdir = ${srcdir}/etc/bundled-packages
+
+## #### Probably we should add a rule for lib-src/make-path here.
+
+check-available-packages:
+	@if test -r ${pkgsrcdir}/bootstrap.tar.gz; \
+	then echo "To install a set of bootstrap packages in"; \
+	     echo "${package_path}/xemacs-packages, type:"; \
+	     echo "  make install-bootstrap-packages"; \
+	fi; \
+	if test -r ${pkgsrcdir}/xemacs-sumo.tar.gz; \
+	then echo "To install the full set of non-mule packages in"; \
+	     echo "${package_path}/xemacs-packages, type:"; \
+	     echo "  make install-nonmule-packages"; \
+	fi; \
+	if test -r ${pkgsrcdir}/xemacs-mule-sumo.tar.gz; \
+	then echo "To install the full set of packages with mule in"; \
+	     echo "${package_path}/mule-packages, type:"; \
+	     echo "  make install-all-packages"; \
+	fi
+
+# The test for a non-trivial path simply checks for the conventional Unix
+# path separator ":".  This is reasonable because this is basically just
+# a convenience feature, anyway.
+
+mkpkgdir: FRC.mkdir ${MAKEPATH}
+	@if test -z ${package_path}; \
+	then echo "Not configured --with-late-packages; no place to install."; \
+		exit -1; \
+	elif echo ${package_path} | grep ":"; \
+	then echo "Configured with multiple late package directories; you decide where to install."; \
+		exit -1; \
+	elif test -e ${package_path}/xemacs-packages \
+		-o -e ${package_path}/mule-packages; \
+	then echo "${package_path} is installed; won't overwrite packages."; \
+		exit -1; \
+	fi
+	${MAKEPATH} ${package_path};
+
+install-bootstrap-packages: mkpkgdir
+	cd ${package_path}; tar xvzf ${pkgsrcdir}/bootstrap.tar.gz
+
+install-nonmule-packages: mkpkgdir
+	cd ${package_path}; tar xvzf ${pkgsrcdir}/xemacs-sumo.tar.gz
+
+install-all-packages: mkpkgdir
+	cd ${package_path}; tar xvzf ${pkgsrcdir}/xemacs-sumo.tar.gz; \
+	cd ${package_path}; tar xvzf ${pkgsrcdir}/xemacs-mule-sumo.tar.gz
+
 ## Delete all the installed files that the `install' target would
 ## create (but not the noninstalled files such as `make all' would
 ## create).
--- a/etc/ChangeLog	Mon Dec 31 21:34:45 2007 +0100
+++ b/etc/ChangeLog	Mon Dec 31 21:35:20 2007 +0100
@@ -1,3 +1,12 @@
+2007-12-26  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* bundled-packages/README: Document restriction on --with-late-packages.
+
+2007-12-23  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* bundled-packages/README: Documentation for bundled packages.
+	* bundled-packages/test.sh: Test suite for bundled packages.
+
 2007-11-22  Vin Shelton  <acs@xemacs.org>
 
 	* photos/vin.png:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/bundled-packages/README	Mon Dec 31 21:35:20 2007 +0100
@@ -0,0 +1,71 @@
+Package distributions may be placed in this directory.
+If present and a package-path is configured, packages can be installed
+using the top-level Makefile.
+
+To configure the package path, use the --with-late-packages option to
+configure, which specifies a single directory in which to install the
+xemacs-packages and mule-packages hierarchies provided.  If this is null,
+or contains a Unix-style search path (i.e., a colon is present in the
+argument of the --with-late-packages option), you will have to install
+the packages by hand.
+
+To find out if a distribution includes bundled packages, type
+
+    make check-available-packages
+
+There are three Make targets that may be available depending on the package
+sets supplied.
+
+    make install-bootstrap-packages
+        Install a selected set of packages sufficient to support
+        downloading and installing packages via the M-x list-packages
+        interface.  Chose this if you want to be able to install the
+        latest version of each package immediately.
+
+    make install-nomule-packages
+        Install the full distribution of packages that do not require a
+        Mule-enabled XEmacs.  Choose this package if you don't have a
+        Mule-enabled XEmacs and want the convenience of a single-command
+        installation.  You can add or update packages via M-x list-packages
+        at any time.
+
+    make install-all-packages
+        Install the full distribution of packages, including those requiring
+        a Mule-enabled XEmacs.  Choose this package if you have a Mule-
+        enabled XEmacs and want the convenience of a single-command
+        installation.  You can add or update packages via M-x list-packages
+        at any time.
+
+DISTRIBUTOR'S NOTE: you may choose what packages you wish to include in
+bootstrap.tar.gz, but to make list-packages work you need to include at
+least xemacs-base, dired, and efs.  The tarball should unpack directly as
+an xemacs-packages tree (and optionaly, a mule-packages tree.  Also, if
+either of xemacs-sumo.tar.gz or xemacs-mule-sumo.tar.gz is provided, the
+other should be as well.
+
+If packages are not available with the distribution, you can get them at
+
+    ftp://ftp.xemacs.org/pub/xemacs/packages/xemacs-sumo.tar.gz
+    ftp://ftp.xemacs.org/pub/xemacs/packages/xemacs-mule-sumo.tar.gz
+    http://turnbull.sk.tsukuba.ac.jp/Tools/XEmacs/bootstrap.tar.gz
+
+and place them in the same directory as this file.  You can also make your
+own bootstrap.tar.gz by creating a directory xemacs-packages, then
+untarring the packages of your choice into that directory, and tarring the
+whole thing up with "tar czf bootstrap.tar.gz xemacs-packages".  (If you
+wish to include mule-packages, you should place them in mule-packages as
+a sibling of xemacs-packages.)
+
+This facility currently does not support installations which configure
+the --with-early-packages, --with-late-packages, or --with-last-packages
+options.
+
+This facility currently will not overwrite an existing package
+installation, not even if a whole hierarchy (usually the mule-packages)
+is missing.  In particular, you cannot use this feature to add the
+mule-packages to a package installation which lacks them, even if the
+hierarchy is missing, or the xemacs-packages hierarchy was installed
+this way.  Nor can you "upgrade" a bootstrap installation to a full
+installation.  If you wish to do any of these things you will need to
+remove the existing hierarchies.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/etc/bundled-packages/test.sh	Mon Dec 31 21:35:20 2007 +0100
@@ -0,0 +1,105 @@
+# tests for the bundled packages feature
+
+# usage: sh etc/bundled-packages/tests.sh [TMP_TEST_DIR]
+
+# Always run this script from the top directory of the source tree.
+# You need a mv that supports the -v for verbose flag, and a mkdir that
+# supports the -p flag to make parents.
+# Output from this script is preceded by 4 stars (****).
+
+# This test script is probably more fragile than the build process, but if
+# it runs to completion things are probably OK.
+
+# configure the installation target
+
+if test -z "$1"; then
+ TMP_TEST_DIR=/tmp/test/bundled-packages
+else
+ TMP_TEST_DIR=$1
+fi
+
+srcdir=`pwd`
+blddir=${TMP_TEST_DIR}/build
+pkgdir=${TMP_TEST_DIR}/lib/xemacs
+
+echo "**** srcdir = ${srcdir}"
+echo "**** blddir = ${blddir}"
+echo "**** pkgdir = ${pkgdir}"
+
+if test -e "${pkgdir}"; then
+ echo "**** pkgdir (${pkgdir}) exists; bailing out."
+ exit -1
+fi
+
+# mv existing tarballs out of harm's way and make a fake one
+
+echo "**** Moving existing tarballs to etc/bundled-packages/saved."
+mkdir -p etc/bundled-packages/saved
+cd etc/bundled-packages
+echo "**** 'mv' may error because there are no files to move.  It's harmless."
+mv -v *.tar.gz saved/
+cd ../..
+
+# configure in a temporary directory
+
+if test -e ${blddir}; then
+ echo "**** blddir (${blddir}) exists; bailing out."
+ exit -1
+fi
+mkdir -p ${blddir}
+cd ${blddir}
+echo "**** Running 'configure'.  This takes *several minutes*."
+echo "**** Redirecting configure output to ${blddir}/beta.err."
+${srcdir}/configure >beta.err 2>&1
+
+# test check-available-packages
+
+echo "**** This test should produce no error and no output."
+make check-available-packages
+cd ${srcdir}/etc/bundled-packages
+echo "**** This test should explain how to install bootstrap packages."
+echo "This file pretends to be a bootstrap hierarchy." > xemacs-packages
+tar czf bootstrap.tar.gz xemacs-packages
+rm xemacs-packages
+cd ${blddir}
+make check-available-packages
+echo "**** This test should explain how to install all three."
+cd ${srcdir}/etc/bundled-packages
+echo "This file pretends to be a xemacs-packages hierarchy." > xemacs-packages
+echo "This file pretends to be a mule-packages hierarchy." > mule-packages
+tar czf xemacs-sumo.tar.gz xemacs-packages
+tar czf xemacs-mule-sumo.tar.gz mule-packages
+rm xemacs-packages mule-packages
+cd ${blddir}
+make check-available-packages
+
+# test installation without package path given
+
+echo "**** Make the 'make-path' utility needed by the installation routine."
+make -C lib-src make-path
+echo "**** This test should error because --with-late-packages wasn't given."
+make install-bootstrap-packages
+
+# test installation with package path given
+
+echo "**** Running 'configure'.  This takes *several minutes*."
+echo "**** Redirecting configure output to ${blddir}/beta.err."
+${srcdir}/configure --with-late-packages=${pkgdir} >beta.err 2>&1
+echo "**** Make the 'make-path' utility needed by the installation routine."
+make -C lib-src make-path
+echo "**** Test install-bootstrap-packages."
+make install-bootstrap-packages
+echo "**** The following should list xemacs-packages in the right place."
+ls ${pkgdir}/*
+
+#### no tests below this line ####
+
+# put tarballs back and clean up
+
+cd ${srcdir}/etc/bundled-packages
+rm *.tar.gz
+echo "**** 'mv' may error because there are no files to move.  It's harmless."
+mv -v saved/*.tar.gz ../
+rmdir saved
+rm -rf ${blddir} ${pkgdir}
+exit 0
--- a/lisp/ChangeLog	Mon Dec 31 21:34:45 2007 +0100
+++ b/lisp/ChangeLog	Mon Dec 31 21:35:20 2007 +0100
@@ -10,6 +10,52 @@
 	* behavior.el (behavior-menu-filter):
 	Byte compile the lambdas in the generated menu. 
 
+2007-12-30  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* iso8859-1.el: (provide 'iso8859-1) again, because one file uses
+	it in the packages.
+
+2007-12-30  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* subr.el (with-case-table): New.
+	Idea and implementation taken from GNU's code of April 2007,
+	before GPL V3 was implied. Thank you GNU. 
+	* iso8859-1.el (ascii-case-table): New. 
+	Idea taken from GNU.
+	* iso8859-1.el :
+	Change Jamie's implicit compile-time call to a macro literal into
+	something comprehensible to and maintainable by mortals, using to
+	cl.el's #'loop.
+	* iso8859-1.el (ctl-arrow):
+	Initialise it to something more comprehensible. 
+
+2007-12-30  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* loadhist.el (symbol-file):
+	Accept a new TYPE argument, compatible with GNU, saying
+	whether function or variable definitions should be searched for.
+	Implement the functionality for autoloads, handling TYPE
+	correctly. 
+	Pass the TYPE argument to built-in-symbol-file correctly.
+	Document that TYPE is not implemented for non-autoloaded Lisp
+	definitions. Our load-history doesn't have the relevant metadata. 
+
+2007-12-25  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* glyphs.el (init-glyphs):
+	Revert part of Didier's 2007-10-15 commit, which broke
+	#'make-image-specifier with string arguments, and more noticeably
+	truncation-glyph, continuation-glyph, octal-escape-glyph,
+	control-arrow-glyph. 
+
+2007-12-23  Mike Sperber  <mike@xemacs.org>
+
+	* font.el (xft-font-create-object): Use
+	`fc-pattern-get-or-compute-size' instead of
+	`fc-pattern-get-size'.
+
+	* fontconfig.el (fc-pattern-get-or-compute-size): Add.
+
 2007-12-22  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	Factor out lists of operators specially treated by `make-autoload'.
--- a/lisp/font.el	Mon Dec 31 21:34:45 2007 +0100
+++ b/lisp/font.el	Mon Dec 31 21:35:20 2007 +0100
@@ -813,7 +813,7 @@
 	 (pattern (fc-font-match device (fc-name-parse name)))
 	 (font-obj (make-font))
 	 (family (fc-pattern-get-family pattern 0))
-	 (size (fc-pattern-get-size pattern 0))
+	 (size (fc-pattern-get-or-compute-size pattern 0))
 	 (weight (fc-pattern-get-weight pattern 0)))
     (set-font-family font-obj 
 		     (and (not (equal family 'fc-result-no-match)) 
--- a/lisp/fontconfig.el	Mon Dec 31 21:34:45 2007 +0100
+++ b/lisp/fontconfig.el	Mon Dec 31 21:35:20 2007 +0100
@@ -350,6 +350,21 @@
   (let ((pair (assoc str fc-font-name-weight-mapping-string-reverse)))
     (if pair (cdr pair))))
 
+(defun fc-pattern-get-or-compute-size (pattern id)
+  "Get the size from `pattern' associated with `id' or try to compute it.
+Returns 'fc-result-no-match if unsucessful."
+  ;;  Many font patterns don't have a "size" property, but do have a
+  ;;  "dpi" and a "pixelsize" property".
+  (let ((maybe (fc-pattern-get-size pattern id)))
+    (if (not (eq maybe 'fc-result-no-match))
+	maybe
+      (let ((dpi (fc-pattern-get-dpi pattern id))
+	    (pixelsize (fc-pattern-get-pixelsize pattern id)))
+	(if (and (numberp dpi)
+		 (numberp pixelsize))
+	    (* pixelsize (/ 72 dpi))
+	  'fc-result-no-match)))))
+
 (defun fc-copy-pattern-partial (pattern attribute-list)
   "Return a copy of PATTERN restricted to ATTRIBUTE-LIST.
 
--- a/lisp/glyphs.el	Mon Dec 31 21:34:45 2007 +0100
+++ b/lisp/glyphs.el	Mon Dec 31 21:35:20 2007 +0100
@@ -1185,8 +1185,7 @@
 				 [jpeg :data nil] 2)))
        ,@(if (featurep 'png) '(("\\.png\\'" [png :file nil] 2)))
        ,@(if (featurep 'png) '(("\\`\211PNG" [png :data nil] 2)))
-       ;; No, I don't think we want to inline images... -- dvl
-       ;; ("" [string :data nil] 2)
+       ("" [string :data nil] 2)
        ("" [nothing]))))
   ;; #### this should really be formatted-string, not string but we
   ;; don't have it implemented yet
@@ -1210,8 +1209,7 @@
            ("\\`\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)
+           ("" [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])))
--- a/lisp/iso8859-1.el	Mon Dec 31 21:34:45 2007 +0100
+++ b/lisp/iso8859-1.el	Mon Dec 31 21:35:20 2007 +0100
@@ -28,71 +28,63 @@
 
 ;;; Commentary:
 
-;; created by jwz, 19-aug-92.
 ;; Sets the case table for the ISO-8859/1 character set.
-;; Used to set the syntax table. 
+;; Provides ascii-case-table, for use in environments where multilingual
+;; case-insensitive processing is inappropriate.
 
 ;;; Code:
 
-(defconst iso8859/1-case-table nil
-  "The case table for ISO-8859/1 characters.")
-
-;;; This macro expands into
-;;;  (setq iso8859/1-case-table (purecopy '("..." nil nil nil)))
-;;; doing the computation of the case table at compile-time.
+(defvar ascii-case-table
+  (loop
+    for lower from (char-int ?a) to (char-int ?z)
+    and upper from (char-int ?A) to (char-int ?Z)
+    with table = (make-case-table)
+    do (put-case-table-pair (coerce lower 'character)
+                            (coerce upper 'character)
+                            table)
+    finally return table)
+  "Case table for the ASCII character set.")
 
-((macro
-  . (lambda (&rest pairs)
-      (let ((downcase (make-string 256 0))
-	    (i 0))
-	(while (< i 256)
-	  (aset downcase i (if (and (>= i ?A) (<= i ?Z)) (+ i 32) i))
-	  (setq i (1+ i)))
-	(while pairs
-	  (aset downcase (car (car pairs)) (car (cdr (car pairs))))
-	  (setq pairs (cdr pairs)))
-	(cons 'setq
-	      (cons 'iso8859/1-case-table
-		    (list
-		     (list 'quote
-			   (list downcase nil nil nil))))))))
- 
- (?\300  ?\340)		; Agrave
- (?\301  ?\341)		; Aacute
- (?\302  ?\342)		; Acircumflex
- (?\303  ?\343)		; Atilde
- (?\304  ?\344)		; Adiaeresis
- (?\305  ?\345)		; Aring
- (?\306  ?\346)		; AE
- (?\307  ?\347)		; Ccedilla
- (?\310  ?\350)		; Egrave
- (?\311  ?\351)		; Eacute
- (?\312  ?\352)		; Ecircumflex
- (?\313  ?\353)		; Ediaeresis
- (?\314  ?\354)		; Igrave
- (?\315  ?\355)		; Iacute
- (?\316  ?\356)		; Icircumflex
- (?\317  ?\357)		; Idiaeresis
- (?\320  ?\360)		; ETH
- (?\321  ?\361)		; Ntilde
- (?\322  ?\362)		; Ograve
- (?\323  ?\363)		; Oacute
- (?\324  ?\364)		; Ocircumflex
- (?\325  ?\365)		; Otilde
- (?\326  ?\366)		; Odiaeresis
- (?\330  ?\370)		; Ooblique
- (?\331  ?\371)		; Ugrave
- (?\332  ?\372)		; Uacute
- (?\333  ?\373)		; Ucircumflex
- (?\334  ?\374)		; Udiaeresis
- (?\335  ?\375)		; Yacute
- (?\336  ?\376)		; THORN
- )
+(loop
+  for (upper lower)
+  in '((?\xC0 ?\xE0) ;; A WITH GRAVE
+       (?\xC1 ?\xE1) ;; A WITH ACUTE
+       (?\xC2 ?\xE2) ;; A WITH CIRCUMFLEX
+       (?\xC3 ?\xE3) ;; A WITH TILDE
+       (?\xC4 ?\xE4) ;; A WITH DIAERESIS
+       (?\xC5 ?\xE5) ;; A WITH RING ABOVE
+       (?\xC6 ?\xE6) ;; AE
+       (?\xC7 ?\xE7) ;; C WITH CEDILLA
+       (?\xC8 ?\xE8) ;; E WITH GRAVE
+       (?\xC9 ?\xE9) ;; E WITH ACUTE
+       (?\xCA ?\xEA) ;; E WITH CIRCUMFLEX
+       (?\xCB ?\xEB) ;; E WITH DIAERESIS
+       (?\xCC ?\xEC) ;; I WITH GRAVE
+       (?\xCD ?\xED) ;; I WITH ACUTE
+       (?\xCE ?\xEE) ;; I WITH CIRCUMFLEX
+       (?\xCF ?\xEF) ;; I WITH DIAERESIS
+       (?\xD0 ?\xF0) ;; ETH
+       (?\xD1 ?\xF1) ;; N WITH TILDE
+       (?\xD2 ?\xF2) ;; O WITH GRAVE
+       (?\xD3 ?\xF3) ;; O WITH ACUTE
+       (?\xD4 ?\xF4) ;; O WITH CIRCUMFLEX
+       (?\xD5 ?\xF5) ;; O WITH TILDE
+       (?\xD6 ?\xF6) ;; O WITH DIAERESIS
+       (?\xD8 ?\xF8) ;; O WITH STROKE
+       (?\xD9 ?\xF9) ;; U WITH GRAVE
+       (?\xDA ?\xFA) ;; U WITH ACUTE
+       (?\xDB ?\xFB) ;; U WITH CIRCUMFLEX
+       (?\xDC ?\xFC) ;; U WITH DIAERESIS
+       (?\xDD ?\xFD) ;; Y WITH ACUTE
+       (?\xDE ?\xFE)) ;; THORN
+  with case-table = (standard-case-table)
+  do (put-case-table-pair upper lower case-table))
 
-(set-standard-case-table (mapcar 'copy-sequence iso8859/1-case-table))
+;; Everything Latin-1 and above should be displayed as its character value
+;; by default.
+(setq-default ctl-arrow #xA0)
 
-(setq-default ctl-arrow 'iso-8859/1)
-
-(provide 'iso8859-1)
+;; Shouldn't be necessary, but one file in the packages uses it:
+(provide 'iso8859-1) 
 
 ;;; iso8859-1.el ends here
--- a/lisp/loadhist.el	Mon Dec 31 21:34:45 2007 +0100
+++ b/lisp/loadhist.el	Mon Dec 31 21:35:20 2007 +0100
@@ -25,6 +25,8 @@
 
 ;;; Synched up with: FSF 20.2.
 
+;; #### Sync this file! 
+
 ;;; Commentary:
 
 ;; This file is dumped with XEmacs.
@@ -37,19 +39,36 @@
 ;; load-history is a list of entries that look like this:
 ;; ("outline" outline-regexp ... (require . wid-edit) ... (provide . outline) ...)
 
-(defun symbol-file (sym)
+(defun symbol-file (sym &optional type)
   "Return the input source from which SYM was loaded.
-This is a file name, or nil if the source was a buffer with no associated file."
+This is a file name, or nil if the source was a buffer with no associated file.
+
+If TYPE is nil or omitted, any kind of definition is acceptable.
+If TYPE is `defun', then function, subr, special form or macro definitions
+are acceptable.
+If TYPE is `defvar', then variable definitions are acceptable.
+
+#### For the moment the difference is not implemented for non-autoloaded
+Lisp symbols."
   (interactive "SFind source file for symbol: ") ; XEmacs
   (block look-up-symbol-file
-    (dolist (entry load-history)
-      (when (memq sym (cdr entry))
-	(return-from look-up-symbol-file (car entry))))
-    (when (or (and (boundp sym) (built-in-variable-type sym))
-	      (and (fboundp sym) (subrp (symbol-function sym))))
-      (let ((built-in-file (built-in-symbol-file sym)))
-	(if built-in-file
-	    (concat source-directory "/src/" built-in-file))))))
+    (let (built-in-file autoload-cons)
+      (when (and 
+             (eq 'autoload
+                 (car-safe (setq autoload-cons
+                                 (and (fboundp sym)
+                                      (symbol-function sym)))))
+             (or (and (or (null type) (eq 'defvar type))
+                      (eq (fifth autoload-cons) 'keymap))
+                 (and (or (null type) (eq 'defvar type))
+                    (memq (fifth autoload-cons) '(nil macro)))))
+        (return-from look-up-symbol-file
+          (locate-library (second autoload-cons))))
+      (dolist (entry load-history)
+        (when (memq sym (cdr entry))
+          (return-from look-up-symbol-file (car entry))))
+      (setq built-in-file (built-in-symbol-file sym type))
+      (if built-in-file (concat source-directory "/src/" built-in-file)))))
 
 (defun feature-symbols (feature)
   "Return the file and list of symbols associated with a given FEATURE."
--- a/lisp/subr.el	Mon Dec 31 21:34:45 2007 +0100
+++ b/lisp/subr.el	Mon Dec 31 21:35:20 2007 +0100
@@ -579,6 +579,19 @@
 ; 	 . ,body)
 ;      (combine-after-change-execute)))
 
+(defmacro with-case-table (table &rest body)
+  "Execute the forms in BODY with TABLE as the current case table.
+The value returned is the value of the last form in BODY."
+  (declare (indent 1) (debug t))
+  (let ((old-case-table (make-symbol "table"))
+	(old-buffer (make-symbol "buffer")))
+    `(let ((,old-case-table (current-case-table))
+	   (,old-buffer (current-buffer)))
+       (unwind-protect
+	   (progn (set-case-table ,table)
+		  ,@body)
+	 (with-current-buffer ,old-buffer
+	   (set-case-table ,old-case-table))))))
 
 (defvar delay-mode-hooks nil
   "If non-nil, `run-mode-hooks' should delay running the hooks.")
--- a/src/ChangeLog	Mon Dec 31 21:34:45 2007 +0100
+++ b/src/ChangeLog	Mon Dec 31 21:35:20 2007 +0100
@@ -1,3 +1,24 @@
+2007-12-30  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* doc.c (Fbuilt_in_symbol_file):
+	Take a new TYPE argument, specifying whether the function or
+	variable definition of the symbol should be searched for.
+	Handle built-in macros correctly.
+
+2007-12-24  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* event-xlike-inc.c (x_keysym_to_character): 
+	* event-xlike-inc.c (gtk_keysym_to_character):
+	Unify the typed character if possible, following the current value
+	for the unicode precedence list. 
+
+2007-12-24  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* symbols.c (Fintern_soft): 
+	Provide a new optional third argument, DEFAULT, for those who want
+	to check if "nil" is a symbol or not. (More realistically, general
+	code that may get handed "nil" should probably use this argument.)
+
 2007-12-23  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* objects-tty.c (tty_find_charset_font): 
--- a/src/doc.c	Mon Dec 31 21:34:45 2007 +0100
+++ b/src/doc.c	Mon Dec 31 21:35:20 2007 +0100
@@ -37,7 +37,7 @@
 
 Lisp_Object Vinternal_doc_file_name;
 
-Lisp_Object QSsubstitute;
+Lisp_Object QSsubstitute, Qdefvar;
 
 /* Work out what source file a function or variable came from, taking the
    information from the documentation file. */
@@ -499,21 +499,28 @@
            weirdness, type, XSTRING_DATA (XSYMBOL (sym)->name), pos);
 }
 
-DEFUN ("built-in-symbol-file", Fbuilt_in_symbol_file, 1, 1, 0, /*
+DEFUN ("built-in-symbol-file", Fbuilt_in_symbol_file, 1, 2, 0, /*
 Return the C source file built-in symbol SYM comes from. 
 Don't use this.  Use the more general `symbol-file' (q.v.) instead. 
+
+If TYPE is nil or omitted, any kind of definition is acceptable. 
+If TYPE is `defun', then function, subr, special form or macro definitions
+are acceptable.
+If TYPE is `defvar', then variable definitions are acceptable.
 */
-       (symbol))
+       (symbol, type))
 {
   /* This function can GC */
   Lisp_Object fun;
   Lisp_Object filename = Qnil;
 
-  if (EQ(Ffboundp(symbol), Qt))
+  if (EQ(Ffboundp(symbol), Qt) && (EQ(type, Qnil) || EQ(type, Qdefun)))
     {
       fun = Findirect_function (symbol);
 
-      if (SUBRP (fun))
+      if (SUBRP (fun) || (CONSP(fun) && (EQ (Qmacro, Fcar_safe (fun)))
+                          && (fun = Fcdr_safe (fun))
+                          && (SUBRP (fun))))
 	{
 	  if (XSUBR (fun)->doc == 0)
 	    return Qnil;
@@ -529,7 +536,7 @@
 	      (make_int (- (EMACS_INT) XSUBR (fun)->doc));
 	}
     }
-  else if (EQ(Fboundp(symbol), Qt))
+  else if (EQ(Fboundp(symbol), Qt) && (EQ(type, Qnil) || EQ(type, Qdefvar)))
     {
       Lisp_Object doc_offset = Fget (symbol, Qvariable_documentation, Qnil);
 
@@ -1273,6 +1280,8 @@
   DEFSUBR (Fsnarf_documentation);
   DEFSUBR (Fverify_documentation);
   DEFSUBR (Fsubstitute_command_keys);
+
+  DEFSYMBOL (Qdefvar);
 }
 
 void
--- a/src/event-xlike-inc.c	Mon Dec 31 21:34:45 2007 +0100
+++ b/src/event-xlike-inc.c	Mon Dec 31 21:35:20 2007 +0100
@@ -708,7 +708,15 @@
     return Qnil;
 
 #ifdef MULE
-  return make_char (make_ichar (charset, code, 0));
+  {
+    Lisp_Object unified = Funicode_to_char
+      (Fchar_to_unicode (make_char (make_ichar (charset, code, 0))), Qnil);
+    if (!NILP (unified))
+      {
+        return unified;
+      }
+    return make_char (make_ichar (charset, code, 0));
+  }
 #else
   return make_char (code + 0x80);
 #endif
--- a/src/keymap.c	Mon Dec 31 21:34:45 2007 +0100
+++ b/src/keymap.c	Mon Dec 31 21:35:20 2007 +0100
@@ -1388,7 +1388,7 @@
 	  DECLARE_EISTRING (temp);
 	  eicpy_raw (temp, name, qxestrlen (name));
 	  eisetch_char (temp, 2, '-');
-	  *keysym = Fintern_soft (eimake_string (temp), Qnil);
+	  *keysym = Fintern_soft (eimake_string (temp), Qnil, Qnil);
 	}
       else if (EQ (*keysym, QLFD))
 	*keysym = QKlinefeed;
--- a/src/lisp.h	Mon Dec 31 21:34:45 2007 +0100
+++ b/src/lisp.h	Mon Dec 31 21:35:20 2007 +0100
@@ -5067,7 +5067,7 @@
 EXFUN (Ffboundp, 1);
 EXFUN (Ffset, 2);
 EXFUN (Fintern, 2);
-EXFUN (Fintern_soft, 2);
+EXFUN (Fintern_soft, 3);
 EXFUN (Fkill_local_variable, 1);
 EXFUN (Fset, 2);
 EXFUN (Fset_default, 2);
--- a/src/symbols.c	Mon Dec 31 21:34:45 2007 +0100
+++ b/src/symbols.c	Mon Dec 31 21:35:20 2007 +0100
@@ -256,17 +256,17 @@
   return object;
 }
 
-DEFUN ("intern-soft", Fintern_soft, 1, 2, 0, /*
+DEFUN ("intern-soft", Fintern_soft, 1, 3, 0, /*
 Return the canonical symbol named NAME, or nil if none exists.
 NAME may be a string or a symbol.  If it is a symbol, that exact
 symbol is searched for.
 Optional second argument OBARRAY specifies the obarray to use;
 it defaults to the value of the variable `obarray'.
+Optional third argument DEFAULT says what Lisp object to return if there is
+no canonical symbol named NAME, and defaults to nil. 
 */
-       (name, obarray))
+       (name, obarray, default_))
 {
-  /* #### Bug!  (intern-soft "nil") returns nil.  Perhaps we should
-     add a DEFAULT-IF-NOT-FOUND arg, like in get.  */
   Lisp_Object tem;
   Lisp_Object string;
 
@@ -283,7 +283,7 @@
 
   tem = oblookup (obarray, XSTRING_DATA (string), XSTRING_LENGTH (string));
   if (INTP (tem) || (SYMBOLP (name) && !EQ (name, tem)))
-    return Qnil;
+    return default_;
   else
     return tem;
 }
--- a/tests/ChangeLog	Mon Dec 31 21:34:45 2007 +0100
+++ b/tests/ChangeLog	Mon Dec 31 21:35:20 2007 +0100
@@ -1,3 +1,11 @@
+2007-12-29  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* automated/test-harness.el (test-harness-test-compiled):
+	Improve docstring.
+
+	* automated/weak-tests.el (test-harness-test-compiled):
+	Remove debugging code.
+
 2007-12-21  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* reproduce-crashes.el: Renamed from reproduce-bugs.el.  Update to-do.
--- a/tests/automated/test-harness.el	Mon Dec 31 21:34:45 2007 +0100
+++ b/tests/automated/test-harness.el	Mon Dec 31 21:35:20 2007 +0100
@@ -71,7 +71,17 @@
 (defvar unexpected-test-file-failures)
 
 (defvar test-harness-test-compiled nil
-  "Non-nil means the test code was compiled before execution.")
+  "Non-nil means the test code was compiled before execution.
+
+You probably should not make tests depend on compilation.
+However, it can be useful to conditionally change messages based on whether
+the code was compiled or not.  For example, the case that motivated the
+implementation of this variable:
+
+\(when test-harness-test-compiled
+  ;; this ha-a-ack depends on the failing compiled test coming last
+  \(setq test-harness-failure-tag
+	\"KNOWN BUG - fix reverted; after 2003-10-31 notify stephen\n\"))")
 
 (defvar test-harness-verbose
   (and (not noninteractive) (> (device-baud-rate) search-slow-speed))
--- a/tests/automated/weak-tests.el	Mon Dec 31 21:34:45 2007 +0100
+++ b/tests/automated/weak-tests.el	Mon Dec 31 21:35:20 2007 +0100
@@ -36,11 +36,6 @@
      (push (file-name-directory load-file-name) load-path)
      (require 'test-harness))))
 
-(when test-harness-test-compiled
-  ;; this ha-a-ack depends on the compiled test coming last
-  (setq test-harness-failure-tag
-	"KNOWN BUG - fix reverted; after 2003-10-31 bitch at stephen\n"))
-
 (garbage-collect)
 
 ;; tests for weak-boxes