[PATCH] Update man page for init file, one nroff format error
17 years, 6 months
Shyamal Prasad
etc/ChangeLog addition:
2004-12-03 Shyamal Prasad <shyamal(a)member.fsf.org>
* xemacs.1: Now describe $HOME/.xemacs/init.el as the
preferred init file. Fixed excessive space insertion
in the description of the '-vanilla' option
XEmacs source patch:
Diff command: cvs -q diff -u
Files affected: etc/xemacs.1
Index: etc/xemacs.1
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/etc/xemacs.1,v
retrieving …
[View More]revision 1.13
diff -u -r1.13 xemacs.1
--- etc/xemacs.1 2001/04/12 18:20:52 1.13
+++ etc/xemacs.1 2004/12/04 01:33:45
@@ -147,12 +147,7 @@
.TP
.B \-vanilla
Load no extra files at startup. Equivalent to the combination of
-.B \-q
-,
-.B \-no-site-file
-, and
-.B \-no-early-packages
-\.
+.BR \-q ", " \-no-site-file ", and " \-no-early-packages .
.TP
.BI \-u " user, " \-user " user"
Load
@@ -628,7 +623,8 @@
META-left Make a rectangular selection.
.SH FILES
Lisp code is read at startup from the user's init file,
-\fB$HOME/.emacs\fP.
+\fB$HOME/.xemacs/init.el\fP. If this file does not exist then
+\fB$HOME/.emacs\fP will be read if it is present.
/usr/local/info - files for the Info documentation browser
(a subsystem of
[View Less]
[PATCH] Synch up format-time-string % specifiers with Emacs 21.3.1
17 years, 6 months
Shyamal Prasad
This patch adds % specifiers to format-time-string that are missing in
XEmacs but supported by Emacs 21.3.1
src/ChangeLog addition:
2004-12-08 Shyamal Prasad <shyamal(a)member.fsf.org>
* editfns.c:
* editfns.c (Fformat_time_string):
Added documentation for %z, %g, %G and %V specifiers. This synchs
up the set of % specifiers for format-time-string with Emacs
21.3.1. Make copy of static buffer returned by localtime().
* strftime.c:
* strftime.c (strftime):
Implemented %z, %g,…
[View More] %G and %V in a style similar to existing
implementation of other specifiers.
XEmacs source patch:
Diff command: cvs -q diff -u
Files affected: src/strftime.c src/editfns.c
Index: src/editfns.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/editfns.c,v
retrieving revision 1.51
diff -u -r1.51 editfns.c
--- src/editfns.c 2004/12/06 03:52:03 1.51
+++ src/editfns.c 2004/12/09 02:40:17
@@ -1015,6 +1015,8 @@
%d is replaced by the day of month, zero-padded.
%D is a synonym for "%m/%d/%y".
%e is replaced by the day of month, blank-padded.
+%G is replaced by the year containing the ISO 8601 week
+%g is replaced by the year of the ISO 8601 week within the century (00-99)
%h is a synonym for "%b".
%H is replaced by the hour (00-23).
%I is replaced by the hour (00-12).
@@ -1033,12 +1035,14 @@
%t is a synonym for "\\t".
%T is a synonym for "%H:%M:%S".
%U is replaced by the week of the year (00-53), first day of week is Sunday.
+%V is replaced by the ISO 8601 week number
%w is replaced by the day of week (0-6), Sunday is day 0.
%W is replaced by the week of the year (00-53), first day of week is Monday.
%x is a locale-specific synonym, which defaults to "%D" in the C locale.
%X is a locale-specific synonym, which defaults to "%T" in the C locale.
%y is replaced by the year without century (00-99).
%Y is replaced by the year with century.
+%z is replaced by the time zone as a numeric offset (e.g +0530, -0800 etc.)
%Z is replaced by the time zone abbreviation.
The number of options reflects the `strftime' function.
@@ -1063,13 +1067,15 @@
{
Extbyte *buf = alloca_extbytes (size);
Extbyte *formext;
+ /* make a copy of the static buffer returned by localtime() */
+ struct tm tm = * localtime(&value);
+
*buf = 1;
/* !!#### this use of external here is not totally safe, and
potentially data lossy. */
LISP_STRING_TO_EXTERNAL (format_string, formext, Qnative);
- if (emacs_strftime (buf, size, formext,
- localtime (&value))
+ if (emacs_strftime (buf, size, formext, &tm)
|| !*buf)
return build_ext_string (buf, Qnative);
/* If buffer was too small, make it bigger. */
Index: src/strftime.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/strftime.c,v
retrieving revision 1.6
diff -u -r1.6 strftime.c
--- src/strftime.c 2002/03/29 04:48:37 1.6
+++ src/strftime.c 2004/12/09 02:40:18
@@ -58,6 +58,7 @@
%S second (00..61)
%T time, 24-hour (hh:mm:ss)
%X locale's time representation (%H:%M:%S)
+ %z time zone offset (e.g. +0530, -0800 etc)
%Z time zone (EDT), or nothing if no time zone is determinable
Date fields:
@@ -70,10 +71,13 @@
%d day of month (01..31)
%e day of month ( 1..31)
%D date (mm/dd/yy)
+ %G year corresponding to the ISO 8601 week
+ %g Year of the ISO 8601 week within century (00 - 99)
%h same as %b
%j day of year (001..366)
%m month (01..12)
%U week number of year with Sunday as first day of week (00..53)
+ %V ISO 8601 week number (first week is the earliest one with Thu)
%w day of week (0..6)
%W week number of year with Monday as first day of week (00..53)
%x locale's date representation (mm/dd/yy)
@@ -235,6 +239,30 @@
return dl <= 0 ? 0 : dl / 7 + (dl % 7 != 0);
}
+#ifndef __isleap
+/* Nonzero if YEAR is a leap year (every 4 years,
+ except every 100th isn't, and every 400th is). */
+# define __isleap(year) \
+ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
+#endif
+
+/* The number of days from the first day of the first ISO week of this
+ year to the year day YDAY with week day WDAY. ISO weeks start on
+ Monday; the first ISO week has the year's first Thursday. YDAY may
+ be as small as YDAY_MINIMUM. */
+#define ISO_WEEK_START_WDAY 1 /* Monday */
+#define ISO_WEEK1_WDAY 4 /* Thursday */
+#define YDAY_MINIMUM (-366)
+static int
+iso_week_days (int yday, int wday)
+{
+ /* Add enough to the first operand of % to make it nonnegative. */
+ int big_enough_multiple_of_7 = (-YDAY_MINIMUM / 7 + 2) * 7;
+ return (yday
+ - (yday - wday + ISO_WEEK1_WDAY + big_enough_multiple_of_7) % 7
+ + ISO_WEEK1_WDAY - ISO_WEEK_START_WDAY);
+}
+
#if !defined(HAVE_TM_ZONE) && !defined(HAVE_TZNAME)
char *zone_name (const struct tm *tp);
char *
@@ -362,10 +390,125 @@
length +=
strftime (&string[length], max - length, "%H:%M:%S", tm);
break;
+
+ case 'V':
+ case 'g':
+ case 'G':
+ {
+ int year = tm->tm_year + 1900;
+ int days = iso_week_days (tm->tm_yday, tm->tm_wday);
+
+ if (days < 0)
+ {
+ /* This ISO week belongs to the previous year. */
+ year--;
+ days =
+ iso_week_days (tm->tm_yday + (365 + __isleap (year)),
+ tm->tm_wday);
+ }
+ else
+ {
+ int d =
+ iso_week_days (tm->tm_yday - (365 + __isleap (year)),
+ tm->tm_wday);
+ if (0 <= d)
+ {
+ /* This ISO week belongs to the next year. */
+ year++;
+ days = d;
+ }
+ }
+
+ switch (*format)
+ {
+ /*
+ #### FIXME
+ We really can't assume 1000 <= year <= 9999
+ once time_t gets beyond 32 bits, but it's true
+ of the rest of the code here so get with the
+ program
+ */
+ case 'g':
+ length +=
+ add_num2 (&string[length], year % 100,
+ max - length, pad);
+ break;
+
+ case 'G':
+ add_char (year / 1000 + '0');
+ length += add_num3 (&string[length], year % 1000,
+ max - length, zero);
+ break;
+
+ default:
+ length +=
+ add_num2 (&string[length], days / 7 + 1,
+ max - length, pad);
+ break;
+ }
+ }
+ break;
case 'X':
length +=
strftime (&string[length], max - length, "%H:%M:%S", tm);
break;
+ case 'z':
+ {
+ /*
+ #### FIXME: could use tm->tm_gmtoff if present. Since
+ the other code in xemacs does not do so we follow the
+ leaders (and don't add a autoconf macro to detect
+ its presence).
+ */
+ long int offset;
+ long int minutes;
+ struct tm lt, *ut;
+ time_t utc;
+
+ lt = *tm;
+ utc = mktime(<);
+ ut = gmtime(&utc);
+ /* assume that tm is valid so the others will be too! */
+ assert( utc != (time_t) -1 && ut != NULL );
+
+ /* tm diff code below is based on mktime.c, glibc 2.3.2 */
+ {
+ int lt4, ut4, lt100, ut100, lt400, ut400;
+ int intervening_leap_days, years, days;
+
+ lt4 = (lt.tm_year >> 2) + (1900 >> 2) -
+ ! (lt.tm_year & 3);
+ ut4 = (ut->tm_year >> 2) + (1900 >> 2) -
+ ! (ut->tm_year & 3);
+ lt100 = lt4 / 25 - (lt4 % 25 < 0);
+ ut100 = ut4 / 25 - (ut4 % 25 < 0);
+ lt400 = lt100 >> 2;
+ ut400 = ut100 >> 2;
+ intervening_leap_days =
+ (lt4 - ut4) - (lt100 - ut100) + (lt400 - ut400);
+ years = lt.tm_year - ut->tm_year;
+ days = (365 * years + intervening_leap_days
+ + (lt.tm_yday - ut->tm_yday));
+ offset = (60 * (60 * (24 * days + (lt.tm_hour - ut->tm_hour))
+ + (lt.tm_min - ut->tm_min))
+ + (lt.tm_sec - ut->tm_sec));
+ }
+
+ minutes = offset / ( offset < 0 ? -60 : 60 );
+
+ add_char ((offset < 0 ? '-' : '+'));
+
+ if ( minutes / 600 != 0 )
+ add_char (minutes / 600 + '0');
+ else if ( pad != none )
+ add_char ((pad == zero ? '0' : ' '));
+
+ length +=
+ add_num3 (&string[length],
+ ((minutes / 60 ) % 10) * 100 + (minutes % 60),
+ max - length, pad);
+ break;
+ }
case 'Z':
#ifdef HAVE_TM_ZONE
length += add_str (&string[length], tm->tm_zone, max - length);
[View Less]
[21.5R21.4] [PATCH] Mention ssh warnings in PROBLEMS.
18 years, 11 months
Malcolm Purvis
21.5 RECOMMEND 21.4
Skip Montanaro's recent problems with X11 errors being generated when using X
forwarding over ssh is not the first time that this problem's been raised, so
I think that it's a candidate for the PROBLEMS file.
ChangeLog addition:
2006-04-27 Malcolm Purvis <malcolmp(a)xemacs.org>
* PROBLEMS: Add entry concerning X errors when using ssh.
xemacs-21.5-micro-patches source patch:
Diff command: cvs -q diff -u
Files affected: PROBLEMS
Index: PROBLEMS
==============…
[View More]=====================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/PROBLEMS,v
retrieving revision 1.71
diff -u -r1.71 PROBLEMS
--- PROBLEMS 2005/11/16 12:12:57 1.71
+++ PROBLEMS 2006/04/27 12:59:40
@@ -1005,6 +1005,12 @@
too old. There is a copy of the MIT X11R6 XKeysymDB file in the emacs `etc'
directory. Try using that one.
+*** Lots of warnings generated when displaying via ssh X forwarding.
+
+If you are seeing a significant number of X11 warnings (in particular
+BadWindow errors) when using XEmacs via ssh X forwarding (ssh -X) try
+using a TrustedX11 connection (ssh -Y) instead.
+
*** My X resources used to work, and now some of them are being ignored.
Check the resources in .../etc/Emacs.ad (which is the same as the file
--
Malcolm Purvis <malcolmp(a)xemacs.org>
[View Less]
[PATCH] COPYING update
18 years, 11 months
Jerry James
We still have the FSF's old address in our COPYING files, in both the
21.4 and 21.5 branches. The latest upstream version of COPYING also
recognizes the fact that we are no longer living in the 20th century.
This patch applies to both 21.4 and 21.5.
ChangeLog addition:
2006-04-06 Jerry James <james(a)xemacs.org>
* COPYING: Update to latest upstream version.
xemacs-21.5 source patch:
Diff command: cvs -q diff -uN
Files affected: COPYING
Index: COPYING
==========================…
[View More]=========================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/COPYING,v
retrieving revision 1.1.1.1
diff -d -u -r1.1.1.1 COPYING
--- COPYING 1996/12/18 22:42:14 1.1.1.1
+++ COPYING 2006/04/06 15:00:39
@@ -2,8 +2,7 @@
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place - Suite 330
- Boston, MA 02111-1307, USA.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -292,7 +291,7 @@
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
+ Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -305,16 +304,16 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING. If not, write to
- the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
- Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
--
Jerry James, Assistant Professor james(a)xemacs.org
Computer Science Department http://www.cs.usu.edu/~jerry/
Utah State University
[View Less]
[PATCH] Autodetection of Latin-1 text with high-byte chars in a row
18 years, 11 months
Joachim Schrod
Hello,
As discussed this morning on xemacs-beta, here is a patch to support
Latin-1 encoded files that have several GR chars in a row.
I couldn't test inference with Shift-JIS and BIG5 detection as I don't
have test files with these encodings.
Joachim
src/ChangeLog addition:
2006-02-27 Joachim Schrod <jschrod(a)acm.org>
* mule-coding.c (iso2022_detect): Handle Latin-1 encoded files
that have several high-byte chars in a row.
XEmacs 21.5 source patch:
Diff command: cvs -q -…
[View More]f diff -b -u
Files affected: src/mule-coding.c
Index: src/mule-coding.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/mule-coding.c,v
retrieving revision 1.36
diff -b -u -r1.36 mule-coding.c
--- src/mule-coding.c 2005/11/22 07:19:32 1.36
+++ src/mule-coding.c 2006/02/27 21:30:53
@@ -2927,7 +2927,20 @@
}
else if (data->odd_high_byte_groups > 0 &&
data->even_high_byte_groups > 0)
+ {
+ /* Well, this could be a Latin-1 text, with most high-byte
+ characters single, but sometimes two are together, though
+ this happens not as often. This is common for Western
+ European languages like German, French, Danish, Swedish, etc.
+ Then we would either have a rather small file and
+ even_high_byte_groups would be low.
+ Or we would have a larger file and the ratio of odd to even
+ groups would be very high. */
SET_DET_RESULTS (st, iso2022, DET_SOMEWHAT_UNLIKELY);
+ if (data->even_high_byte_groups <= 3 ||
+ data->odd_high_byte_groups >= 10 * data->even_high_byte_groups)
+ DET_RESULT (st, iso_8_1) = DET_SOMEWHAT_LIKELY;
+ }
else
SET_DET_RESULTS (st, iso2022, DET_AS_LIKELY_AS_UNLIKELY);
}
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Joachim Schrod Email: jschrod(a)acm.org
Roedermark, Germany
[View Less]
[PATCH] Autoload shell-prompt-pattern
18 years, 11 months
Tero Saarni
Hi,
Function telnet in telnet.el is broken currently.
Calling it results in error "Symbol's value as variable is void:
shell-prompt-pattern". The variable has not been autoloaded after this
change:
http://cvs.xemacs.org/viewcvs.cgi/XEmacs/packages/xemacs-packages/xemacs-...
I believe the trivial fix below will help.
--
Tero
--- xemacs-base-orig/shell.el 2004-11-23 06:10:54.000000000 +0200
+++ xemacs-base/shell.el 2006-03-10 18:44:32.000000000 +0200
@@ -132,6 +132,7 @@
:…
[View More]type 'regexp
:group 'shell)
+;;;###autoload
(defcustom shell-prompt-pattern "^[^#$%>\n]*[#$%>] *"
"Regexp to match prompts in the inferior shell.
Defaults to \"^[^#$%>\\n]*[#$%>] *\", which works pretty well.
[View Less]
[COMMIT] Support builtin functions in find-function
18 years, 11 months
Aidan Kehoe
SUPERSEDES 17336.3580.904405.497258(a)parhasard.net
Doesn’t work for ELL modules yet, but I’m not waiting for that to commit,
because I have a feeling if I ever get to it, it’ll be a long time in the
future, and the code is plenty useful as it is.
NOTE: This patch has been committed.
lib-src/ChangeLog addition:
2006-04-29 Aidan Kehoe <kehoea(a)parhasard.net>
* make-docfile.c:
* make-docfile.c (put_filename):
* make-docfile.c (scan_c_file):
* make-docfile.c (scan_lisp_file):
…
[View More]Record file name information for built-in symbols. Based on the
FSF's implementation of same.
lisp/ChangeLog addition:
2006-04-29 Aidan Kehoe <kehoea(a)parhasard.net>
* dumped-lisp.el (preloaded-file-list):
Move loadhist earlier in the preloaded-file list.
* help.el:
* help.el (help-mode-map): Add bindings to find the source code of
a function, notably when that function's in C.
* help.el (describe-function-find-file, describe-symbol-find-file):
Removed. Use symbol-file from loadhist.el instead.
* help.el (frob-help-extents):
* help.el (describe-function-1):
Allow built-in function file names to be hyperlinks.
* help.el (describe-variable):
* help.el (help-find-source-or-scroll-up): New.
* help.el (help-mouse-find-source-or-track): New.
Make describe-function a bit more mouse-friendly, basically.
* loadhist.el (symbol-file):
Support looking up builtin symbols using built-in-symbol-file.
src/ChangeLog addition:
2006-04-29 Aidan Kehoe <kehoea(a)parhasard.net>
* doc.c:
* doc.c (extract_object_file_name):
* doc.c (get_object_file_name):
* doc.c (Fbuilt_in_symbol_file):
Support saving and recovering the source file name of a built-in
symbol (that is, one created in C.)
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: src/doc.c lisp/loadhist.el lisp/help.el lisp/dumped-lisp.el lib-src/make-docfile.c
Index: lib-src/make-docfile.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lib-src/make-docfile.c,v
retrieving revision 1.17
diff -u -u -r1.17 make-docfile.c
--- lib-src/make-docfile.c 2005/02/22 08:05:58 1.17
+++ lib-src/make-docfile.c 2006/04/29 16:02:37
@@ -44,6 +44,7 @@
#include <config.h>
#include <sysfile.h>
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -58,6 +59,7 @@
('0' <= c && c <= '9') || \
(c == '_'))
+static void put_filename (const char *filename);
static int scan_file (const char *filename);
static int read_c_string (FILE *, int, int);
static void write_c_args (FILE *out, const char *func, char *buf, int minargs,
@@ -263,6 +265,30 @@
return err_count > 0;
}
+/* Add a source file name boundary in the output file. */
+static void
+put_filename (const char *filename)
+{
+ const char *tmp;
+
+ /* Why are we cutting this off? */
+ for (tmp = filename; *tmp; tmp++)
+ {
+ if (IS_DIRECTORY_SEP(*tmp))
+ filename = tmp + 1;
+ }
+
+ /* <= because sizeof includes the nul byte at the end. Not quite right,
+ because it should include the length of the symbol + "\037[VF]" instead
+ of simply 10. */
+ assert(sizeof("\037S\n") + strlen(filename) + 10
+ <= DOC_MAX_FILENAME_LENGTH);
+
+ putc (037, outfile);
+ putc ('S', outfile);
+ fprintf (outfile, "%s\n", filename);
+}
+
/* Read file FILENAME and output its doc strings to outfile. */
/* Return 1 if file is not found, 0 if it is found. */
@@ -864,11 +890,14 @@
if (defunflag || defvarflag || c == '"')
{
/* XEmacs change: the original code is in the "else" clause */
+ /* XXX Must modify the documentation file name code to handle
+ ELLCCs */
if (ellcc)
fprintf (outfile, " CDOC%s(\"%s\", \"\\\n",
defvarflag ? "SYM" : "SUBR", globalbuf);
else
{
+ put_filename (filename); /* XEmacs addition */
putc (037, outfile);
putc (defvarflag ? 'V' : 'F', outfile);
fprintf (outfile, "%s\n", globalbuf);
@@ -963,6 +992,10 @@
The NAME and DOCSTRING are output.
NAME is preceded by `F' for a function or `V' for a variable.
An entry is output only if DOCSTRING has \ newline just after the opening "
+
+ Adds the filename a symbol or function was found in before its docstring;
+ there's no need for this with the load-history available, but we do it for
+ consistency with the C parsing code.
*/
static void
@@ -1356,6 +1389,7 @@
In the latter case, the opening quote (and leading
backslash-newline) have already been read. */
+ put_filename (filename); /* XEmacs addition */
putc ('\n', outfile); /* XEmacs addition */
putc (037, outfile);
putc (type, outfile);
Index: lisp/dumped-lisp.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/dumped-lisp.el,v
retrieving revision 1.58
diff -u -u -r1.58 dumped-lisp.el
--- lisp/dumped-lisp.el 2006/04/23 16:11:22 1.58
+++ lisp/dumped-lisp.el 2006/04/29 16:02:39
@@ -92,6 +92,8 @@
; `emacs-user-extension-dir'
"misc"
;; (pureload "profile")
+ "loadhist" ; Must be dumped before loaddefs is loaded
+ ; Used by help.
"help"
;; (pureload "hyper-apropos") Soon...
"files"
@@ -308,7 +310,6 @@
;; "sun-eos-debugger"
;; "sun-eos-debugger-extra"
;; "sun-eos-menubar"))
- "loadhist" ; Must be dumped before loaddefs is loaded
"loaddefs" ; <=== autoloads get loaded here
))
Index: lisp/help.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/help.el,v
retrieving revision 1.47
diff -u -u -r1.47 help.el
--- lisp/help.el 2005/11/16 12:13:02 1.47
+++ lisp/help.el 2006/04/29 16:02:39
@@ -1,4 +1,4 @@
-;;; help.el --- help commands for XEmacs.
+;; help.el --- help commands for XEmacs.
;; Copyright (C) 1985, 1986, 1992-4, 1997 Free Software Foundation, Inc.
;; Copyright (C) 2001, 2002, 2003 Ben Wing.
@@ -41,6 +41,8 @@
;; or run interpreted, but not when the compiled code is loaded.
(eval-when-compile (require 'help-macro))
+(require 'loadhist) ;; For symbol-file.
+
(defgroup help nil
"Support for on-line help systems."
:group 'emacs)
@@ -153,6 +155,8 @@
(define-key help-mode-map "c" 'customize-variable)
(define-key help-mode-map [tab] 'help-next-symbol)
(define-key help-mode-map [(shift tab)] 'help-prev-symbol)
+(define-key help-mode-map [return] 'help-find-source-or-scroll-up)
+(define-key help-mode-map [button2] 'help-mouse-find-source-or-track)
(define-key help-mode-map "n" 'help-next-section)
(define-key help-mode-map "p" 'help-prev-section)
@@ -1091,14 +1095,14 @@
:type 'boolean
:group 'help-appearance)
-(defun describe-symbol-find-file (symbol)
- (loop for (file . load-data) in load-history
- do (when (memq symbol load-data)
- (return file))))
+(define-obsolete-function-alias
+ ;; Moved to using the version in loadhist.el
+ 'describe-function-find-symbol
+ 'symbol-file)
(define-obsolete-function-alias
'describe-function-find-file
- 'describe-symbol-find-file)
+ 'symbol-file)
(defun describe-function (function)
"Display the full documentation of FUNCTION (a symbol).
@@ -1340,6 +1344,7 @@
(when (or var fun)
(let ((ex (make-extent b e)))
(require 'hyper-apropos)
+
(set-extent-property ex 'mouse-face 'highlight)
(set-extent-property ex 'help-symbol sym)
(set-extent-property ex 'face 'hyper-apropos-hyperlink)
@@ -1421,10 +1426,21 @@
(if autoload-file
(princ (format " -- autoloads from \"%s\"\n" autoload-file)))
(or file-name
- (setq file-name (describe-symbol-find-file function)))
- (if file-name
- (princ (format " -- loaded from \"%s\"\n" file-name)))
-;; (terpri)
+ (setq file-name (symbol-file function)))
+ (when file-name
+ (princ " -- loaded from \"")
+ (if (not (bufferp standard-output))
+ (princ file-name)
+ (let ((opoint (point standard-output))
+ e)
+ (require 'hyper-apropos)
+ (princ file-name)
+ (setq e (make-extent opoint (point standard-output)
+ standard-output))
+ (set-extent-property e 'face 'hyper-apropos-hyperlink)
+ (set-extent-property e 'mouse-face 'highlight)
+ (set-extent-property e 'find-function-symbol function)))
+ (princ "\"\n"))
(if describe-function-show-arglist
(let ((arglist (function-arglist function)))
(when arglist
@@ -1469,7 +1485,6 @@
(eq ?\n (aref doc (1- (length doc)))))
(terpri)))))))))
-
;;; [Obnoxious, whining people who complain very LOUDLY on Usenet
;;; are binding this to keys.]
(defun describe-function-arglist (function)
@@ -1590,11 +1605,22 @@
(princ (format "%s" aliases)))
(princ (built-in-variable-doc variable))
(princ ".\n")
- (let ((file-name (describe-symbol-find-file variable)))
- (if file-name
- (princ (format " -- loaded from \"%s\"\n" file-name))))
- (princ "\nValue: ")
(require 'hyper-apropos)
+ (let ((file-name (symbol-file variable))
+ opoint e)
+ (when file-name
+ (princ " -- loaded from \"")
+ (if (not (bufferp standard-output))
+ (princ file-name)
+ (setq opoint (point standard-output))
+ (princ file-name)
+ (setq e (make-extent opoint (point standard-output)
+ standard-output))
+ (set-extent-property e 'face 'hyper-apropos-hyperlink)
+ (set-extent-property e 'mouse-face 'highlight)
+ (set-extent-property e 'find-variable-symbol variable))
+ (princ"\"\n")))
+ (princ "\nValue: ")
(if (not (boundp variable))
(Help-princ-face "void\n" 'hyper-apropos-documentation)
(Help-prin1-face (symbol-value variable)
@@ -1778,5 +1804,29 @@
(if (stringp string)
(with-displaying-help-buffer
(insert string)))))
+
+(defun help-find-source-or-scroll-up (&optional pos)
+ "Follow any cross reference to source code; if none, scroll up. "
+ (interactive "d")
+ (let ((e (extent-at pos nil 'find-function-symbol)))
+ (if e
+ (find-function (extent-property e 'find-function-symbol))
+ (setq e (extent-at pos nil 'find-variable-symbol))
+ (if e
+ (find-variable (extent-property e 'find-variable-symbol))
+ (view-scroll-lines-up 1)))))
+
+(defun help-mouse-find-source-or-track (event)
+ "Follow any cross reference to source code under the mouse;
+if none, call mouse-track. "
+ (interactive "e")
+ (mouse-set-point event)
+ (let ((e (extent-at (point) nil 'find-function-symbol)))
+ (if e
+ (find-function (extent-property e 'find-function-symbol))
+ (setq e (extent-at (point) nil 'find-variable-symbol))
+ (if e
+ (find-variable (extent-property e 'find-variable-symbol))
+ (mouse-track event)))))
;;; help.el ends here
Index: lisp/loadhist.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/loadhist.el,v
retrieving revision 1.6
diff -u -u -r1.6 loadhist.el
--- lisp/loadhist.el 2002/11/18 06:52:28 1.6
+++ lisp/loadhist.el 2006/04/29 16:02:39
@@ -41,9 +41,15 @@
"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."
(interactive "SFind source file for symbol: ") ; XEmacs
- (dolist (entry load-history)
- (when (memq sym (cdr entry))
- (return (car entry)))))
+ (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 build-root "/src/" built-in-file))))))
(defun feature-symbols (feature)
"Return the file and list of symbols associated with a given FEATURE."
Index: src/doc.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/doc.c,v
retrieving revision 1.35
diff -u -u -r1.35 doc.c
--- src/doc.c 2005/10/25 11:16:22 1.35
+++ src/doc.c 2006/04/29 16:02:40
@@ -39,11 +39,128 @@
Lisp_Object QSsubstitute;
-/* Read and return doc string or instructions from open file descriptor FD
- at position POSITION. Does not close the file. Returns string; or if
- error, returns a cons holding the error data to pass to Fsignal.
- NAME_NONRELOC and NAME_RELOC are only used for the error messages. */
+/* Work out what source file a function or variable came from, taking the
+ information from the documentation file. */
+static Lisp_Object
+extract_object_file_name (int fd, EMACS_INT doc_pos,
+ Ibyte *name_nonreloc, Lisp_Object name_reloc,
+ int standard_doc_file)
+{
+ Ibyte buf[DOC_MAX_FILENAME_LENGTH];
+ Ibyte *buffer = buf;
+ int buffer_size = sizeof (buf), space_left;
+ Ibyte *from, *to;
+ REGISTER Ibyte *p = buffer;
+ Lisp_Object return_me;
+ Lisp_Object fdstream = Qnil, instream = Qnil;
+ struct gcpro gcpro1, gcpro2;
+ EMACS_INT position, seenS = 0;
+
+ GCPRO2 (fdstream, instream);
+
+ position = doc_pos > DOC_MAX_FILENAME_LENGTH ?
+ doc_pos - DOC_MAX_FILENAME_LENGTH : 0;
+
+ if (0 > lseek (fd, position, 0))
+ {
+ if (name_nonreloc)
+ name_reloc = build_intstring (name_nonreloc);
+ return_me = list3 (build_msg_string
+ ("Position out of range in doc string file"),
+ name_reloc, make_int (position));
+ goto done;
+ }
+
+ fdstream = make_filedesc_input_stream (fd, 0, -1, 0);
+ Lstream_set_buffering (XLSTREAM (fdstream), LSTREAM_UNBUFFERED, 0);
+ instream =
+ make_coding_input_stream
+ (XLSTREAM (fdstream), standard_doc_file ? Qescape_quoted : Qbinary,
+ CODING_DECODE, 0);
+ Lstream_set_buffering (XLSTREAM (instream), LSTREAM_UNBUFFERED, 0);
+
+ space_left = buffer_size - (p - buffer);
+ while (space_left > 0)
+ {
+ int nread;
+
+ nread = Lstream_read (XLSTREAM (instream), p, space_left);
+ if (nread < 0)
+ {
+ return_me = list1 (build_msg_string
+ ("Read error on documentation file"));
+ goto done;
+ }
+
+ p[nread] = 0;
+
+ if (!nread)
+ break;
+
+ p += nread;
+ space_left = buffer_size - (p - buffer);
+ }
+
+ /* First, search backward for the "\037S" that marks the beginning of the
+ file name, then search forward from that to the newline or to the end
+ of the buffer. */
+ from = p;
+
+ while (from > buf)
+ {
+ --from;
+ if (seenS)
+ {
+ if ('\037' == *from)
+ {
+ /* Got a file name; adjust `from' to point to it, break out of
+ the loop. */
+ from += 2;
+ break;
+ }
+ }
+ /* Is *from 'S' ? */
+ seenS = ('S' == *from);
+ }
+
+ if (buf == from)
+ {
+ /* We've scanned back to the beginning of the buffer without hitting
+ the file name. Either the file name plus the symbol name is longer
+ than DOC_MAX_FILENAME_LENGTH--which shouldn't happen, because it'll
+ trigger an assertion failure in make-docfile, the DOC file is
+ corrupt, or it was produced by a version of make-docfile that
+ doesn't store the file name with the symbol name and docstring. */
+ return_me = list1 (build_msg_string
+ ("Object file name not stored in doc file"));
+ goto done;
+ }
+
+ to = from;
+ /* Search for the end of the file name. */
+ while (++to < p)
+ {
+ if ('\n' == *to || '\037' == *to)
+ {
+ break;
+ }
+ }
+
+ /* Don't require the file name to end in a newline. */
+ return_me = make_string (from, to - from);
+
+ done:
+ if (!NILP (instream))
+ {
+ Lstream_delete (XLSTREAM (instream));
+ Lstream_delete (XLSTREAM (fdstream));
+ }
+
+ UNGCPRO;
+ return return_me;
+}
+
Lisp_Object
unparesseuxify_doc_string (int fd, EMACS_INT position,
Ibyte *name_nonreloc, Lisp_Object name_reloc,
@@ -287,6 +404,150 @@
return Fread (string);
}
+static Lisp_Object
+get_object_file_name (Lisp_Object filepos)
+{
+ REGISTER int fd;
+ REGISTER Ibyte *name_nonreloc = 0;
+ EMACS_INT position;
+ Lisp_Object file, tem;
+ Lisp_Object name_reloc = Qnil;
+ int standard_doc_file = 0;
+
+ if (INTP (filepos))
+ {
+ file = Vinternal_doc_file_name;
+ standard_doc_file = 1;
+ position = XINT (filepos);
+ }
+ else if (CONSP (filepos) && INTP (XCDR (filepos)))
+ {
+ file = XCAR (filepos);
+ position = XINT (XCDR (filepos));
+ if (position < 0)
+ position = - position;
+ }
+ else
+ return Qnil;
+
+ if (!STRINGP (file))
+ return Qnil;
+
+ /* Put the file name in NAME as a C string.
+ If it is relative, combine it with Vdoc_directory. */
+
+ tem = Ffile_name_absolute_p (file);
+ if (NILP (tem))
+ {
+ Bytecount minsize;
+ /* XEmacs: Move this check here. OK if called during loadup to
+ load byte code instructions. */
+ if (!STRINGP (Vdoc_directory))
+ return Qnil;
+
+ minsize = XSTRING_LENGTH (Vdoc_directory);
+ /* sizeof ("../lib-src/") == 12 */
+ if (minsize < 12)
+ minsize = 12;
+ name_nonreloc = alloca_ibytes (minsize + XSTRING_LENGTH (file) + 8);
+ string_join (name_nonreloc, Vdoc_directory, file);
+ }
+ else
+ name_reloc = file;
+
+ fd = qxe_open (name_nonreloc ? name_nonreloc :
+ XSTRING_DATA (name_reloc), O_RDONLY | OPEN_BINARY, 0);
+ if (fd < 0)
+ {
+ if (purify_flag)
+ {
+ /* sizeof ("../lib-src/") == 12 */
+ name_nonreloc = alloca_ibytes (12 + XSTRING_LENGTH (file) + 8);
+ /* Preparing to dump; DOC file is probably not installed.
+ So check in ../lib-src. */
+ qxestrcpy_ascii (name_nonreloc, "../lib-src/");
+ qxestrcat (name_nonreloc, XSTRING_DATA (file));
+
+ fd = qxe_open (name_nonreloc, O_RDONLY | OPEN_BINARY, 0);
+ }
+
+ if (fd < 0)
+ report_file_error ("Cannot open doc string file",
+ name_nonreloc ? build_intstring (name_nonreloc) :
+ name_reloc);
+ }
+
+ tem = extract_object_file_name (fd, position, name_nonreloc, name_reloc,
+ standard_doc_file);
+ retry_close (fd);
+
+ if (!STRINGP (tem))
+ signal_error_1 (Qinvalid_byte_code, tem);
+
+ return tem;
+}
+
+
+static void
+weird_doc (Lisp_Object sym, const CIbyte *weirdness, const CIbyte *type,
+ int pos)
+{
+ if (!strcmp (weirdness, GETTEXT ("duplicate"))) return;
+ message ("Note: Strange doc (%s) for %s %s @ %d",
+ weirdness, type, XSTRING_DATA (XSYMBOL (sym)->name), pos);
+}
+
+DEFUN ("built-in-symbol-file", Fbuilt_in_symbol_file, 1, 1, 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.
+*/
+ (symbol))
+{
+ /* This function can GC */
+ Lisp_Object fun;
+ Lisp_Object filename = Qnil;
+
+ if (EQ(Ffboundp(symbol), Qt))
+ {
+ fun = Findirect_function (symbol);
+
+ if (SUBRP (fun))
+ {
+ if (XSUBR (fun)->doc == 0)
+ return Qnil;
+
+ if ((EMACS_INT) XSUBR (fun)->doc >= 0)
+ {
+ weird_doc (symbol, "No file info available for function",
+ GETTEXT("function"), 0);
+ return Qnil;
+ }
+ el
+
+#ifdef emacs
#if defined (WIN32_NATIVE)
#define PATHNAME_RESOLVE_LINKS(path, pathout) \
--
In the beginning God created the heavens and the earth. And God was a
bug-eyed, hexagonal smurf with a head of electrified hair; and God said:
“Si, mi chiamano Mimi...”
[View Less]
[PATCH 21.5] GCC4.1 lwlib fixes
18 years, 11 months
Jerry James
This patch makes GCC 4.1 shut up when compiling in lwlib on an x86_64
platform. The xlwgauge.c patch is funny. GCC complains about a missing
sentinel, but the gcc docs say that either 0 or NULL is accepted as the
sentinel. It must have something to do with the difference in size
between an int and a pointer on the x86_64 platform, but in that case,
the gcc docs are wrong.
lwlib/ChangeLog addition:
2006-04-24 Jerry James <james(a)xemacs.org>
* lwlib-Xaw.c (…
[View More]lw_debug_print_class_resources): Casting from a
pointer to an int throws away half of the bits on an x86_64
platform. Print as a pointer instead.
* xlwgauge.c (XawGaugeSetValue): Use NULL instead of 0 as the
sentinel to quiet gcc warnings.
* xlwmenu.c: Cast to FcChar8 * as necessary to quiet warnings.
* xlwtabs.c: Ditto.
xemacs-21.5 source patch:
Diff command: cvs -q diff -uN
Files affected: lwlib/xlwtabs.c lwlib/xlwmenu.c lwlib/xlwgauge.c lwlib/lwlib-Xaw.c
Index: lwlib/lwlib-Xaw.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/lwlib-Xaw.c,v
retrieving revision 1.12
diff -d -u -r1.12 lwlib-Xaw.c
--- lwlib/lwlib-Xaw.c 2005/11/26 11:45:59 1.12
+++ lwlib/lwlib-Xaw.c 2006/04/24 17:43:25
@@ -847,8 +847,8 @@
if (!strcmp (rl[i].resource_class, "International"))
{
fprintf (stderr, " Class has an International resource.\n");
- fprintf (stderr, " International resource is %d.\n",
- (int) rl[i].default_addr);
+ fprintf (stderr, " International resource is %p.\n",
+ rl[i].default_addr);
}
}
class_ = class_->core_class.superclass;
Index: lwlib/xlwgauge.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/xlwgauge.c,v
retrieving revision 1.6
diff -d -u -r1.6 xlwgauge.c
--- lwlib/xlwgauge.c 2005/11/10 15:47:33 1.6
+++ lwlib/xlwgauge.c 2006/04/24 17:43:26
@@ -838,7 +838,7 @@
if(( gw->gauge.autoScaleUp && (int) value > gw->gauge.v1) ||
(gw->gauge.autoScaleDown && (int) value < gw->gauge.v1/3 ))
{
- XtVaSetValues(w, XtNvalue, value, 0) ;
+ XtVaSetValues(w, XtNvalue, value, NULL) ;
return ;
}
Index: lwlib/xlwmenu.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/xlwmenu.c,v
retrieving revision 1.39
diff -d -u -r1.39 xlwmenu.c
--- lwlib/xlwmenu.c 2005/12/22 13:58:16 1.39
+++ lwlib/xlwmenu.c 2006/04/24 17:43:26
@@ -333,8 +333,8 @@
# else
#ifdef USE_XFT_MENUBARS
XGlyphInfo glyphinfo;
- XftTextExtents8 (XtDisplay (mw), mw->menu.renderFont, s, strlen (s),
- &glyphinfo);
+ XftTextExtents8 (XtDisplay (mw), mw->menu.renderFont, (FcChar8 *) s,
+ strlen (s), &glyphinfo);
return glyphinfo.xOff;
#else
XCharStruct xcs;
@@ -424,8 +424,8 @@
return rl.width;
# else /* ! USE_XFONTSET */
#ifdef USE_XFT_MENUBARS
- XftTextExtents8 (XtDisplay (mw), mw->menu.renderFont, newchars, j,
- &glyphinfo);
+ XftTextExtents8 (XtDisplay (mw), mw->menu.renderFont, (FcChar8 *) newchars,
+ j, &glyphinfo);
return glyphinfo.xOff;
#else
XTextExtents (mw->menu.font, newchars, j, &drop, &drop, &drop, &xcs);
@@ -756,7 +756,7 @@
XftTextExtents8 (dpy,
xft_font,
- run, len, &glyphinfo);
+ (FcChar8 *) run, len, &glyphinfo);
return glyphinfo.xOff;
}
#endif
@@ -801,8 +801,8 @@
x_xft_text_width (display, renderFont, string, strlen (string)),
renderFont->ascent + renderFont->descent); /* XXX */
/* draw text */
- XftDrawString8 (xftDraw, color, renderFont,
- x, y + mw->menu.font_ascent, string, strlen (string));
+ XftDrawString8 (xftDraw, color, renderFont, x, y + mw->menu.font_ascent,
+ (FcChar8 *) string, strlen (string));
XftDrawDestroy (xftDraw);
# else
# ifdef USE_XFONTSET
@@ -890,10 +890,10 @@
/* draw text */
XftDrawString8 (xftDraw, color, renderFont,
x, y + mw->menu.font_ascent,
- &string[start], end - start);
+ (FcChar8 *) &string[start], end - start);
- XftTextExtents8 (display, renderFont, &string[start], end - start,
- &glyphinfo);
+ XftTextExtents8 (display, renderFont, (FcChar8 *) &string[start],
+ end - start, &glyphinfo);
/* #### should use parent frame's .xftDraw */
XftDrawDestroy (xftDraw);
Index: lwlib/xlwtabs.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/xlwtabs.c,v
retrieving revision 1.6
diff -d -u -r1.6 xlwtabs.c
--- lwlib/xlwtabs.c 2005/11/26 11:46:00 1.6
+++ lwlib/xlwtabs.c 2006/04/24 17:43:26
@@ -1708,8 +1708,8 @@
XGlyphInfo glyphinfo;
XftColor colorDBG;
XftColorAllocName (dpy, visual, cmap, "wheat", &colorDBG);
- XftTextExtents8 (dpy, renderFont, lbl, (int) strlen (lbl),
- &glyphinfo);
+ XftTextExtents8 (dpy, renderFont, (FcChar8 *) lbl,
+ (int) strlen (lbl), &glyphinfo);
/* #### unnecessary? for the moment, give visual extent */
/* draw background rect */
#if 1
@@ -1754,7 +1754,7 @@
}
XftDrawString8 (xftDraw, &color, renderFont,
x+tab->tabs.l_x, y+tab->tabs.l_y,
- lbl, (int) strlen (lbl));
+ (FcChar8 *) lbl, (int) strlen (lbl));
XftDrawDestroy (xftDraw);
#else
XDrawString(dpy,win,gc,
@@ -1988,7 +1988,8 @@
{
#ifdef USE_XFT_TABS
tab->tabs.width += x_xft_text_width (XtDisplay(tw), font,
- lbl, (int)strlen(lbl)) + iw;
+ (FcChar8 *) lbl,
+ (int)strlen(lbl)) + iw;
tab->tabs.l_y = (tw->tabs.tab_height
+ tw->tabs.renderFont->ascent
/* #### how can this subtraction be correct? */
--
Jerry James, Assistant Professor james(a)xemacs.org
Computer Science Department http://www.cs.usu.edu/~jerry/
Utah State University
[View Less]
[PATCH] Support Unicode escapes in the Lisp reader, à la Java
18 years, 11 months
Aidan Kehoe
Comments? Objections?
man/ChangeLog addition:
2006-04-16 Aidan Kehoe <kehoea(a)parhasard.net>
* lispref/objects.texi (Character Type):
Describe support for ?\u and ?\U as character escapes allowing you
to specify the Unicode code point of a character.
src/ChangeLog addition:
2006-04-16 Aidan Kehoe <kehoea(a)parhasard.net>
* lread.c:
* lread.c (read_escape):
Support \uABCD and \U00ABCDEF in character and string constants to
specify an XEmacs character with the …
[View More]corresponding Unicode
mapping.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: src/lread.c man/lispref/objects.texi
Index: man/lispref/objects.texi
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/man/lispref/objects.texi,v
retrieving revision 1.7
diff -u -u -r1.7 objects.texi
--- man/lispref/objects.texi 2003/06/30 09:31:01 1.7
+++ man/lispref/objects.texi 2006/04/16 20:45:05
@@ -510,6 +510,23 @@
For example, character code 193 is a lowercase @samp{a} with an acute
accent, in @sc{iso}-8859-1.)
+@cindex unicode character escape
+ From version 21.5.25 onwards, XEmacs provides a syntax for specifying
+characters by their Unicode code points. @samp{?\uABCD} will give you
+an XEmacs character that maps to the code point @samp{U+ABCD} in
+Unicode-based representations (UTF-8 text files, Unicode-oriented fonts,
+etc.) Just as in the Java language, there is a slightly different syntax
+for specifying characters with code points above @samp{#xFFFF};
+@samp{\U00ABCDEF} will give you an XEmacs character that maps to the
+code point @samp{U+ABCDEF} in Unicode-based representations, if such an
+XEmacs character exists.
+
+ Unlike the Java language, XEmacs doesn't require exactly four or
+exactly eight hexadecimal digits for either syntax; you do not need to
+specify leading zeroes. Also unlike Java, while this syntax is available
+for character literals, and (see later) in strings, it is not available
+elsewhere in your Lisp source code.
+
@ignore @c None of this crap applies to XEmacs.
For use in strings and buffers, you are limited to the control
characters that exist in @sc{ascii}, but for keyboard input purposes,
@@ -614,6 +631,7 @@
@cindex backslash in character constant
@cindex octal character code
@cindex hexadecimal character code
+
Finally, there are two read syntaxes involving character codes.
It is not possible to represent multibyte or wide characters in this
way; the permissible range of codes is from 0 to 255 (@emph{i.e.},
Index: src/lread.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/lread.c,v
retrieving revision 1.76
diff -u -u -r1.76 lread.c
--- src/lread.c 2005/07/12 23:26:49 1.76
+++ src/lread.c 2006/04/16 20:45:06
@@ -208,6 +208,8 @@
static int locate_file_open_or_access_file (Ibyte *fn, int access_mode);
EXFUN (Fread_from_string, 3);
+EXFUN (Funicode_to_char, 2); /* In unicode.c. */
+
/* When errors are signaled, the actual readcharfun should not be used
as an argument if it is an lstream, so that lstreams don't escape
to the Lisp level. */
@@ -1675,6 +1677,9 @@
{
/* This function can GC */
Ichar c = readchar (readcharfun);
+ /* \u allows up to four hex digits, \U up to eight. Default to the
+ behaviour for \u, and change this value in the case that \U is seen. */
+ int unicode_hex_count = 4;
if (c < 0)
signal_error (Qend_of_file, 0, READCHARFUN_MAYBE (readcharfun));
@@ -1791,11 +1796,50 @@
}
return i;
}
+ case 'U':
+ /* Post-Unicode-2.0: Up to eight hex chars */
+ unicode_hex_count = 8;
+ case 'u':
+
+ /* A Unicode escape, as in Java (though we only permit them in strings
+ and characters, not arbitrarily in the source code.) Also, in
+ contrast with Java, the sequence of hex digits doesn't have to be
+ exactly four or eight hexadecimal digits long. */
+ {
+ REGISTER Ichar i = 0;
+ REGISTER int count = 0;
+ Lisp_Object lisp_char;
+ while (++count <= unicode_hex_count)
+ {
+ c = readchar (readcharfun);
+ /* Remember, can't use isdigit(), isalpha() etc. on Ichars */
+ if (c >= '0' && c <= '9') i = (i << 4) + (c - '0');
+ else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10;
+ else if (c >= 'A' && c <= 'F') i = (i << 4) + (c - 'A') + 10;
+ else
+ {
+ unreadchar (readcharfun, c);
+ break;
+ }
+ }
-#ifdef MULE
- /* #### need some way of reading an extended character with
- an escape sequence. */
-#endif
+ /* Okay, we've read the code point, set the expected number of
+ digits back to the default. */
+ unicode_hex_count = 4;
+
+ lisp_char = Funicode_to_char(make_int(i), Qnil);
+ if (EQ(Qnil, lisp_char))
+ {
+ /* This is ugly and horrible and trashes the user's data, but
+ it's what unicode.c does. In the future, unicode-to-char
+ should not return nil. */
+ return make_ichar (Vcharset_japanese_jisx0208, 34 + 128, 46 + 128);
+ }
+ else
+ {
+ return XCHAR(lisp_char);
+ }
+ }
default:
return c;
--
In the beginning God created the heavens and the earth. And God was a
bug-eyed, hexagonal smurf with a head of electrified hair; and God said:
“Si, mi chiamano Mimi...”
[View Less]
[COMMIT] Fix \u problems in packages from my last commit.
18 years, 11 months
Aidan Kehoe
NOTE: This patch has been committed.
xemacs-packages/perl-modes/ChangeLog addition:
2006-04-29 Aidan Kehoe <kehoea(a)parhasard.net>
* cperl-mode.el (cperl-short-docs):
'\u' => '\\u' as it should have been in the first place.
xemacs-packages/semantic/ChangeLog addition:
2006-04-29 Aidan Kehoe <kehoea(a)parhasard.net>
* semantic-java.el (semantic-java-keyword-table):
'\u' => '\\u' as it should have been in the first place.
XEmacs Packages source patch:
Diff …
[View More]command: cvs -q diff -u
Files affected: xemacs-packages/semantic/semantic-java.el xemacs-packages/perl-modes/cperl-mode.el
Index: xemacs-packages/perl-modes/cperl-mode.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/perl-modes/cperl-mode.el,v
retrieving revision 1.9
diff -u -u -r1.9 cperl-mode.el
--- xemacs-packages/perl-modes/cperl-mode.el 2005/04/27 11:16:56 1.9
+++ xemacs-packages/perl-modes/cperl-mode.el 2006/04/29 19:03:15
@@ -7638,7 +7638,7 @@
\\0 Octal char, e.g. \\033.
\\E Case modification terminator. See \\Q, \\L, and \\U.
\\L Lowercase until \\E . See also \l, lc.
-\\U Upcase until \\E . See also \u, uc.
+\\U Upcase until \\E . See also \\u, uc.
\\Q Quote metacharacters until \\E . See also quotemeta.
\\a Alarm character (octal 007).
\\b Backspace character (octal 010).
Index: xemacs-packages/semantic/semantic-java.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/semantic/semantic-java.el,v
retrieving revision 1.5
diff -u -u -r1.5 semantic-java.el
--- xemacs-packages/semantic/semantic-java.el 2003/01/06 12:12:48 1.5
+++ xemacs-packages/semantic/semantic-java.el 2006/04/29 19:03:16
@@ -497,7 +497,7 @@
("byte" summary "Integral primitive type (-128 to 127)")
("case" summary "switch(<expr>) {case <const-expr>: <stmts> ... }")
("catch" summary "try {<stmts>} catch(<parm>) {<stmts>} ... ")
- ("char" summary "Integral primitive type ('\u0000' to '\uffff') (0 to 65535)")
+ ("char" summary "Integral primitive type ('\\u0000' to '\\uffff') (0 to 65535)")
("class" summary "Class declaration: class <name>")
("const" summary "Unused reserved word")
("continue" summary "continue [<label>] ;")
--
In the beginning God created the heavens and the earth. And God was a
bug-eyed, hexagonal smurf with a head of electrified hair; and God said:
“Si, mi chiamano Mimi...”
[View Less]