commit/XEmacs: stephen_at_xemacs: Use %p for subwindow id.
6 years, 11 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/92757c2b8239/
Changeset: 92757c2b8239
User: stephen_at_xemacs
Date: 2017-12-30 10:50:08+00:00
Summary: Use %p for subwindow id.
Affected #: 2 files
diff -r d05b379f53d3c1e372d5a61651d23b4b72d8a208 -r 92757c2b823956466492eb913941e96b2cd65c35 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2017-12-30 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * glyphs.c (print_image_instance): Use %p for subwindow id.
+
2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* config.h.in:
diff -r d05b379f53d3c1e372d5a61651d23b4b72d8a208 -r 92757c2b823956466492eb913941e96b2cd65c35 src/glyphs.c
--- a/src/glyphs.c
+++ b/src/glyphs.c
@@ -1096,7 +1096,7 @@
DEVICE_TYPE_NAME (XDEVICE (FRAME_DEVICE (f))));
}
write_ascstring (printcharfun, "-frame>");
- write_fmt_string (printcharfun, " 0x%0x",
+ write_fmt_string (printcharfun, " %p",
IMAGE_INSTANCE_SUBWINDOW_ID (ii));
break;
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: kehoea: Make WORDS_BIGENDIAN available again,
thank you Jerry James.
6 years, 11 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/d05b379f53d3/
Changeset: d05b379f53d3
User: kehoea
Date: 2017-12-29 14:35:20+00:00
Summary: Make WORDS_BIGENDIAN available again, thank you Jerry James.
src/ChangeLog addition:
2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* config.h.in:
Make WORDS_BIGENDIAN available again, thank you Jerry James.
Affected #: 2 files
diff -r 4dcbe828fa9c12fc65522668c3390cb8d92042c6 -r d05b379f53d3c1e372d5a61651d23b4b72d8a208 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * config.h.in:
+ Make WORDS_BIGENDIAN available again, thank you Jerry James.
+
2017-12-29 Stephen J. Turnbull <stephen(a)xemacs.org>
* event-gtk.c (emacs_gtk_drain_queue):
diff -r 4dcbe828fa9c12fc65522668c3390cb8d92042c6 -r d05b379f53d3c1e372d5a61651d23b4b72d8a208 src/config.h.in
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -312,7 +312,7 @@
#undef STDC_HEADERS
#undef TIME_WITH_SYS_TIME
-/* #undef WORDS_BIGENDIAN */
+#undef WORDS_BIGENDIAN
#undef HAVE_LONG_FILE_NAMES
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: stephen_at_xemacs: Work around gdk_events_pending
lossage.
6 years, 11 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/4dcbe828fa9c/
Changeset: 4dcbe828fa9c
User: stephen_at_xemacs
Date: 2017-12-29 11:45:41+00:00
Summary: Work around gdk_events_pending lossage.
Affected #: 2 files
diff -r 27b87c12a3aba5014f70dcb1b0ebb884c302f6fe -r 4dcbe828fa9c12fc65522668c3390cb8d92042c6 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2017-12-29 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * event-gtk.c (emacs_gtk_drain_queue):
+ Work around gdk_events_pending lossage.
+
2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* doprnt.c (emacs_vsprintf_string):
diff -r 27b87c12a3aba5014f70dcb1b0ebb884c302f6fe -r 4dcbe828fa9c12fc65522668c3390cb8d92042c6 src/event-gtk.c
--- a/src/event-gtk.c
+++ b/src/event-gtk.c
@@ -1699,12 +1699,21 @@
it on the queue, then we go into Fnext_event(), which calls
emacs_gtk_drain_queue(). But gtk_events_pending() will always return
TRUE if there are file-descriptor (aka our process) events
- pending. Using GDK_events_pending() only shows us windowing
- system events.
+ pending.
+ GDK_events_pending() documentation says it only shows us
+ windowing system events, but in GTK3 on Mac OS X "High Sierra" at least
+ it returns true even though gdk_event_peek returns NULL. So we use the
+ the latter.
*/
if (gdk_display_get_default ())
- while (gdk_events_pending ())
- gtk_main_iteration_do (FALSE);
+ {
+ GdkEvent *e = gdk_event_peek();
+ while (e) {
+ gtk_main_iteration_do (FALSE);
+ gdk_event_free(e);
+ e = gdk_event_peek();
+ }
+ }
#ifdef HAVE_TTY
drain_tty_devices ();
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: kehoea: Avoid begin_gc_forbidden(), end_gc_forbidden(),
doprnt.c
6 years, 11 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/27b87c12a3ab/
Changeset: 27b87c12a3ab
User: kehoea
Date: 2017-12-29 10:50:19+00:00
Summary: Avoid begin_gc_forbidden(), end_gc_forbidden(), doprnt.c
src/ChangeLog addition:
2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* doprnt.c (emacs_vsprintf_string):
* doprnt.c (emacs_vasprintf):
There is no need to forbid GC in these functions, the resizing
buffer output stream cannot GC and continue, nor can
write_fmt_string_lisp_va().
Jerry James just showed a backtrace where forbidding GC here
actually caused XEmacs to crash, early in startup when
specpdl_size was unitialised and begin_gc_forbidden() did an
infinite loop.
Affected #: 2 files
diff -r 24f04bada33d560caea25b9f26471e885d17c1a9 -r 27b87c12a3aba5014f70dcb1b0ebb884c302f6fe src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
+2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * doprnt.c (emacs_vsprintf_string):
+ * doprnt.c (emacs_vasprintf):
+ There is no need to forbid GC in these functions, the resizing
+ buffer output stream cannot GC and continue, nor can
+ write_fmt_string_lisp_va().
+ Jerry James just showed a backtrace where forbidding GC here
+ actually caused XEmacs to crash, early in startup when
+ specpdl_size was unitialised and begin_gc_forbidden() did an
+ infinite loop.
+
2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* print.c (output_string):
diff -r 24f04bada33d560caea25b9f26471e885d17c1a9 -r 27b87c12a3aba5014f70dcb1b0ebb884c302f6fe src/doprnt.c
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -3125,17 +3125,15 @@
/* vsprintf()-like replacement. Arguments are interpreted as C
objects--doubles, char *s, EMACS_INTs, etc. Returns a Lisp string. Data
- from Lisp strings is OK because we explicitly inhibit GC. */
+ from Lisp strings is OK because we cannot GC. */
Lisp_Object
emacs_vsprintf_string (const CIbyte *format, va_list vargs)
{
Lisp_Object stream = make_resizing_buffer_output_stream (), obj;
- int count = begin_gc_forbidden ();
write_fmt_string_va (stream, format, vargs);
obj = resizing_buffer_to_lisp_string (XLSTREAM (stream));
Lstream_delete (XLSTREAM (stream));
- end_gc_forbidden (count);
return obj;
}
@@ -3157,14 +3155,13 @@
/* vasprintf() implementation. Arguments are interpreted as C
objects--doubles, char *s, EMACS_INTs, etc. Data from Lisp strings is OK
- because we explicitly inhibit GC. Returns length (not including the
+ because we cannot GC. Returns length (not including the
terminating zero). Stores a pointer to be freed with free() into
*RETVAL_OUT. */
Bytecount
emacs_vasprintf (Ibyte **retval_out, const CIbyte *format, va_list vargs)
{
Lisp_Object stream = make_resizing_buffer_output_stream ();
- int count = begin_gc_forbidden ();
Bytecount len;
write_fmt_string_va (stream, format, vargs);
@@ -3176,8 +3173,6 @@
(*retval_out)[len] = '\0';
Lstream_delete (XLSTREAM (stream));
- end_gc_forbidden (count);
-
return len;
}
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: kehoea: Don't RETURN_UNGCPRO() a non-Lisp_Object value,
output_string().
6 years, 11 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/24f04bada33d/
Changeset: 24f04bada33d
User: kehoea
Date: 2017-12-29 10:25:26+00:00
Summary: Don't RETURN_UNGCPRO() a non-Lisp_Object value, output_string().
src/ChangeLog addition:
2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* print.c (output_string):
Don't RETURN_UNGCPRO() a non-Lisp_Object value, thank you Jerry
James.
Affected #: 2 files
diff -r 93eb43f8b6d24b760029efca495bd831aa270ebb -r 24f04bada33d560caea25b9f26471e885d17c1a9 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * print.c (output_string):
+ Don't RETURN_UNGCPRO() a non-Lisp_Object value, thank you Jerry
+ James.
+
2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* process.c:
diff -r 93eb43f8b6d24b760029efca495bd831aa270ebb -r 24f04bada33d560caea25b9f26471e885d17c1a9 src/print.c
--- a/src/print.c
+++ b/src/print.c
@@ -464,7 +464,8 @@
if (print_unbuffered)
Lstream_flush (XLSTREAM (function));
- RETURN_UNGCPRO (result);
+ UNGCPRO;
+ return result;
}
else if (BUFFERP (function))
{
@@ -476,7 +477,8 @@
buffer_insert_string (XBUFFER (function), nonreloc, reloc, offset, len);
- RETURN_UNGCPRO (len);
+ UNGCPRO;
+ return len;
}
else if (MARKERP (function))
{
@@ -490,7 +492,8 @@
offset, len, -1, 0);
set_byte_marker_position (function,
byte_marker_position (function) + len);
- RETURN_UNGCPRO (len); /* We will have errored on failure. */
+ UNGCPRO;
+ return len; /* We will have errored on failure. */
}
else if (FRAMEP (function))
{
@@ -507,7 +510,8 @@
clear_echo_area_from_print (f, Qnil, 1);
echo_area_append (f, nonreloc, reloc, offset, len, Vprint_message_label);
- RETURN_UNGCPRO (len);
+ UNGCPRO;
+ return len;
}
else if (EQ (function, Qt) || EQ (function, Qnil))
{
@@ -557,7 +561,8 @@
offset += itext_ichar_len (newnonreloc + offset);
}
- RETURN_UNGCPRO (len);
+ UNGCPRO;
+ return len;
}
}
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: kehoea: Add generate_new_process_name() on the model of
#'generate-new-buffer-name
6 years, 11 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/93eb43f8b6d2/
Changeset: 93eb43f8b6d2
User: kehoea
Date: 2017-12-29 10:15:56+00:00
Summary: Add generate_new_process_name() on the model of #'generate-new-buffer-name
2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
* process.c:
* process.c (generate_new_process_name): New.
Function on the model of #'generate-new-buffer-name, returning a
string based on its argument that does not refer to any existing
process.
* process.c (make_process_internal):
Use it, avoid use of SUFFIX, a buffer that was too small for the
use made of it.
Affected #: 2 files
diff -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 -r 93eb43f8b6d24b760029efca495bd831aa270ebb src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
+2017-12-29 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * process.c:
+ * process.c (generate_new_process_name): New.
+ Function on the model of #'generate-new-buffer-name, returning a
+ string based on its argument that does not refer to any existing
+ process.
+ * process.c (make_process_internal):
+ Use it, avoid use of SUFFIX, a buffer that was too small for the
+ use made of it.
+
2017-12-27 Aidan Kehoe <kehoea(a)parhasard.net>
Remove use of Eistring malloc buffers, have the corresponding
diff -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 -r 93eb43f8b6d24b760029efca495bd831aa270ebb src/process.c
--- a/src/process.c
+++ b/src/process.c
@@ -40,6 +40,7 @@
#include "commands.h"
#include "device.h"
#include "events.h"
+#include "extents.h"
#include "file-coding.h"
#include "frame.h"
#include "hash.h"
@@ -507,31 +508,66 @@
report_error_with_errno (Qnetwork_error, reason, data);
}
+static Lisp_Object
+generate_new_process_name (Lisp_Object name)
+{
+ int count = 1;
+ Bytecount clen = XSTRING_LENGTH (name);
+ Bytecount csize = clen + ichar_len ('<') + DECIMAL_PRINT_SIZE (count) +
+ + ichar_len ('>');
+ Ibyte *candidate = alloca_ibytes (csize);
+ Boolint seen;
+
+ memcpy (candidate, XSTRING_DATA (name), clen);
+
+ /* If NAME is already in use, modify it until it is unused. */
+ do
+ {
+ seen = 0;
+ {
+ LIST_LOOP_2 (process, Vprocess_list)
+ {
+ if (XSTRING_LENGTH (XPROCESS (process)->name) == clen
+ && !qxememcmp (candidate,
+ XSTRING_DATA (XPROCESS (process)->name),
+ clen))
+ {
+ seen = 1;
+ break;
+ }
+ }
+ }
+ }
+ while (seen
+ /* The following will always give non-zero, and will only be
+ executed if the current candidate represents an existing
+ process: */
+ && (clen = emacs_snprintf (candidate, csize, "%s<%d>",
+ XSTRING_DATA (name), ++count)));
+
+ if (count == 1)
+ {
+ return name;
+ }
+ else
+ {
+ Lisp_Object result = make_string (candidate, clen);
+ /* copy_string_extents() can't GC. */
+ copy_string_extents (result, name, 0, 0, XSTRING_LENGTH (name));
+ return result;
+ }
+}
+
Lisp_Object
make_process_internal (Lisp_Object name)
{
- Lisp_Object name1;
- int i;
Lisp_Object obj = ALLOC_NORMAL_LISP_OBJECT (process);
Lisp_Process *p = XPROCESS (obj);
#define MARKED_SLOT(x) p->x = Qnil;
#include "process-slots.h"
- /* If name is already in use, modify it until it is unused. */
- name1 = name;
- for (i = 1; ; i++)
- {
- Ascbyte suffix[10];
- Lisp_Object tem = Fget_process (name1);
- if (NILP (tem))
- break;
- sprintf (suffix, "<%d>", i);
- name1 = concat2 (name, build_ascstring (suffix));
- }
- name = name1;
- p->name = name;
-
+ p->name = generate_new_process_name (name);
p->mark = Fmake_marker ();
p->stderr_mark = Fmake_marker ();
p->status_symbol = Qrun;
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: 2 new changesets
6 years, 12 months
Bitbucket
2 new commits in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/714a6e9c1669/
Changeset: 714a6e9c1669
User: kehoea
Date: 2017-12-23 14:57:42+00:00
Summary: Return a Bytecount from write_fmt_string() and friends.
src/ChangeLog addition:
2017-12-23 Aidan Kehoe <kehoea(a)parhasard.net>
* console-msw.c (mswindows_output_console_string):
Return a Bytecount reflecting the number of Ibytes written from
this function.
* doprnt.c (write_string_1_lstream):
* doprnt.c (write_lisp_string_lstream):
Return a Bytecount, not void, in these two functions.
* doprnt.c (doprnt_1):
Use this.
* doprnt.c (write_fmt_string_va):
* doprnt.c (write_fmt_string):
* doprnt.c (write_fmt_string_lisp_va):
* doprnt.c (write_fmt_string_lisp):
* doprnt.c (stderr_out):
* doprnt.c (stdout_out):
* doprnt.c (stderr_out_lisp):
Return a Bytecount in all these functions, not void, pass through
the result from the underlying call.
* lisp.h:
Adjust the declarations for these functions to reflect that they
return a Bytecount.
* print.c (write_string_to_stdio_stream_1):
* print.c (write_string_to_stdio_stream):
* print.c (write_string_to_external_output):
Return the shortest of the results of the writes to the various
destinations here.
* print.c (write_string_to_external_output_va):
* print.c (external_out):
* print.c (output_string):
* print.c (write_lisp_string):
* print.c (write_string_1):
* print.c (write_eistring):
* print.c (debug_out):
* print.c (debug_print):
* print.c (debug_out_lisp):
Return Bytecount values, not void, in all these functions.
Affected #: 5 files
diff -r 296ee062f9f9ce4957f6aa450a2b4ad7fb57935c -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,41 @@
+2017-12-23 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * console-msw.c (mswindows_output_console_string):
+ Return a Bytecount reflecting the number of Ibytes written from
+ this function.
+ * doprnt.c (write_string_1_lstream):
+ * doprnt.c (write_lisp_string_lstream):
+ Return a Bytecount, not void, in these two functions.
+ * doprnt.c (doprnt_1):
+ Use this.
+ * doprnt.c (write_fmt_string_va):
+ * doprnt.c (write_fmt_string):
+ * doprnt.c (write_fmt_string_lisp_va):
+ * doprnt.c (write_fmt_string_lisp):
+ * doprnt.c (stderr_out):
+ * doprnt.c (stdout_out):
+ * doprnt.c (stderr_out_lisp):
+ Return a Bytecount in all these functions, not void, pass through
+ the result from the underlying call.
+ * lisp.h:
+ Adjust the declarations for these functions to reflect that they
+ return a Bytecount.
+ * print.c (write_string_to_stdio_stream_1):
+ * print.c (write_string_to_stdio_stream):
+ * print.c (write_string_to_external_output):
+ Return the shortest of the results of the writes to the various
+ destinations here.
+ * print.c (write_string_to_external_output_va):
+ * print.c (external_out):
+ * print.c (output_string):
+ * print.c (write_lisp_string):
+ * print.c (write_string_1):
+ * print.c (write_eistring):
+ * print.c (debug_out):
+ * print.c (debug_print):
+ * print.c (debug_out_lisp):
+ Return Bytecount values, not void, in all these functions.
+
2017-12-22 Aidan Kehoe <kehoea(a)parhasard.net>
* redisplay-x.c (separate_textual_runs_mule):
diff -r 296ee062f9f9ce4957f6aa450a2b4ad7fb57935c -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 src/console-msw.c
--- a/src/console-msw.c
+++ b/src/console-msw.c
@@ -287,7 +287,7 @@
int mswindows_message_outputted;
-int
+Bytecount
mswindows_output_console_string (const Ibyte *ptr, Bytecount len)
{
DWORD num_written;
@@ -303,15 +303,25 @@
TO_EXTERNAL_FORMAT (DATA, (ptr, len),
ALLOCA, (extptr, extlen),
Qmswindows_tstr);
- return qxeWriteConsole (mswindows_console_buffer, extptr,
- extlen / XETCHAR_SIZE, &num_written, NULL);
+ qxeWriteConsole (mswindows_console_buffer, extptr,
+ extlen / XETCHAR_SIZE, &num_written, NULL);
+
+ if (num_written != (extlen / XETCHAR_SIZE))
+ {
+ TO_INTERNAL_FORMAT (DATA, (extptr, num_written * XETCHAR_SIZE),
+ ALLOCA, (ptr, len), Qmswindows_tstr);
+ }
+
+ return len;
}
- else
+
#ifdef NON_ASCII_INTERNAL_FORMAT
#error Do something here
#endif
- return WriteConsoleA (mswindows_console_buffer, (Chbyte *) ptr, len,
- &num_written, NULL);
+ WriteConsoleA (mswindows_console_buffer, (Chbyte *) ptr, len, &num_written,
+ NULL);
+
+ return (Bytecount) num_written;
}
DEFUN ("mswindows-debugging-output", Fmswindows_debugging_output, 1, 1, 0, /*
diff -r 296ee062f9f9ce4957f6aa450a2b4ad7fb57935c -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 src/doprnt.c
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -780,19 +780,19 @@
break; \
} while (0)
-static void
+static Bytecount
write_string_1_lstream (Lisp_Object stream, const Ibyte *str, Bytecount size)
{
/* This becomes just a jmp _Lstream_write in the assembler. */
- Lstream_write (XLSTREAM (stream), (const void *) str, size);
+ return Lstream_write (XLSTREAM (stream), (const void *) str, size);
}
-static void
+static Bytecount
write_lisp_string_lstream (Lisp_Object stream, Lisp_Object string,
Bytecount offset, Bytecount len)
{
/* And this becomes just a jmp _Lstream_write_with_extents. */
- Lstream_write_with_extents (XLSTREAM (stream), string, offset, len);
+ return Lstream_write_with_extents (XLSTREAM (stream), string, offset, len);
}
/* Append the string of length LEN starting at OFFSET to STREAM. Preserve any
@@ -844,8 +844,9 @@
{
Bytecount result_len = 0, begin;
const Ibyte *newnonreloc = NILP (reloc) ? nonreloc : XSTRING_DATA (reloc);
- void (*write_string_2) (Lisp_Object, const Ibyte *, Bytecount);
- void (*write_lisp_string_2) (Lisp_Object, Lisp_Object, Bytecount, Bytecount);
+ Bytecount (*write_string_2) (Lisp_Object, const Ibyte *, Bytecount);
+ Bytecount (*write_lisp_string_2) (Lisp_Object, Lisp_Object, Bytecount,
+ Bytecount);
text_checking_assert (!(EQ (reloc, format_object)) || NILP (reloc));
@@ -964,14 +965,13 @@
text_checking_assert (realfill <= filllen);
if (realfill)
{
- write_string_2 (stream, filling, realfill);
- result_len += realfill;
+ result_len += write_string_2 (stream, filling, realfill);
fill_cursor = filling;
}
if (NILP (reloc))
{
- write_string_2 (stream, newnonreloc + offset, len);
+ result_len += write_string_2 (stream, newnonreloc + offset, len);
}
else
{
@@ -979,11 +979,9 @@
adjusts it such that its bytecount changes.
2. Copy RELOC's extent information directly to this point in the
output, do not stretch it. */
- write_lisp_string_2 (stream, reloc, offset, len);
+ result_len += write_lisp_string_2 (stream, reloc, offset, len);
}
- result_len += len;
-
/* Padding at end to left-justify ... */
if (left_justify)
{
@@ -1007,8 +1005,7 @@
text_checking_assert (realfill < filllen);
if (realfill)
{
- write_string_2 (stream, filling, realfill);
- result_len += realfill;
+ result_len += write_string_2 (stream, filling, realfill);
}
}
@@ -1026,7 +1023,7 @@
{
if (NILP (reloc))
{
- write_string_2 (stream, newnonreloc + offset, len);
+ result_len += write_string_2 (stream, newnonreloc + offset, len);
}
else
{
@@ -1034,9 +1031,8 @@
adjusts it such that its bytecount changes.
2. Copy RELOC's extent information directly to this point in the
output, do not stretch it. */
- write_lisp_string_2 (stream, reloc, offset, len);
+ result_len += write_lisp_string_2 (stream, reloc, offset, len);
}
- result_len += len;
}
return result_len;
@@ -2868,7 +2864,7 @@
We also do not handle the $ repositioning specs; they make it harder to
determine an upper bound on the number of specs. This can be revised if
necessary, but it is unlikely to be that necessary on the C level. */
-void
+Bytecount
write_fmt_string_va (Lisp_Object stream, const CIbyte *fmt, va_list va)
{
const CIbyte *cursor = fmt;
@@ -2890,7 +2886,7 @@
if (speccount == 1)
{
- write_string_1 (stream, (const Ibyte *) fmt, len);
+ return write_string_1 (stream, (const Ibyte *) fmt, len);
}
else
{
@@ -2907,26 +2903,28 @@
args = alloca_array (printf_arg, nargs);
get_doprnt_c_args (args, nargs, &specs, va);
- emacs_doprnt (stream, (const Ibyte *) fmt, len, Qnil, &specs, NULL,
- args);
+ return emacs_doprnt (stream, (const Ibyte *) fmt, len, Qnil, &specs,
+ NULL, args);
}
}
/* Write a printf-style string to STREAM; see output_string(). Arguments are C
doubles, longs, uints, char *s, etc, rather than uniformly Lisp_Objects. */
-void
+Bytecount
write_fmt_string (Lisp_Object stream, const CIbyte *fmt, ...)
{
va_list va;
+ Bytecount result;
va_start (va, fmt);
- write_fmt_string_va (stream, fmt, va);
+ result = write_fmt_string_va (stream, fmt, va);
va_end (va);
+ return result;
}
/* Write a printf-style string to STREAM, an object accepted by
output_string(), using FMT as the format string, and taking Lisp_Object
arguments from the va_list VA. */
-void
+Bytecount
write_fmt_string_lisp_va (Lisp_Object stream, const CIbyte *fmt, va_list va)
{
Bytecount len = strlen (fmt);
@@ -2936,15 +2934,19 @@
int count = record_unwind_protect_freeing_dynarr (specs);
Lisp_Object *largs = alloca_array (Lisp_Object, nargs);
struct gcpro gcpro1, gcpro2;
+ Bytecount result;
for (ii = 0; ii < nargs; ii++)
largs[ii] = va_arg (va, Lisp_Object);
GCPRO2 (largs[0], stream);
gcpro1.nvars = nargs;
- emacs_doprnt (stream, (const Ibyte *) fmt, len, Qnil, specs, largs, NULL);
+ result = emacs_doprnt (stream, (const Ibyte *) fmt, len, Qnil, specs,
+ largs, NULL);
UNGCPRO;
unbind_to (count);
+
+ return result;
}
/* Write a printf-style string to STREAM, where the arguments are Lisp objects
@@ -2954,7 +2956,7 @@
but write_fmt_string_lisp () itself is called far more often, and since
write_fmt_string_lisp_va is externally visible, the compiler is unlikely to
inline it. */
-void
+Bytecount
write_fmt_string_lisp (Lisp_Object stream, const CIbyte *fmt, ...)
{
Bytecount len = strlen (fmt);
@@ -2965,6 +2967,7 @@
Lisp_Object *largs = alloca_array (Lisp_Object, nargs);
struct gcpro gcpro1, gcpro2;
va_list va;
+ Bytecount result;
va_start (va, fmt);
for (ii = 0; ii < nargs; ii++)
@@ -2973,9 +2976,12 @@
GCPRO2 (largs[0], stream);
gcpro1.nvars = nargs;
- emacs_doprnt (stream, (const Ibyte *) fmt, len, Qnil, specs, largs, NULL);
+ result = emacs_doprnt (stream, (const Ibyte *) fmt, len, Qnil, specs, largs,
+ NULL);
UNGCPRO;
unbind_to (count);
+
+ return result;
}
/* Output portably to stderr or its equivalent (i.e. may be a console
@@ -2993,48 +2999,55 @@
This function is safe to use even when not initialized or when dying --
we don't do conversion in such cases. */
-
-void
+Bytecount
stderr_out (const CIbyte *fmt, ...)
{
+ Bytecount result;
va_list args;
va_start (args, fmt);
if (initialized && !inhibit_non_essential_conversion_operations)
fmt = GETTEXT (fmt);
- write_fmt_string_va (Qexternal_debugging_output, fmt, args);
+ result = write_fmt_string_va (Qexternal_debugging_output, fmt, args);
va_end (args);
+
+ return result;
}
/* Output portably to stdout or its equivalent (i.e. may be a console
window under MS Windows). Works like stderr_out(). */
-void
+Bytecount
stdout_out (const CIbyte *fmt, ...)
{
+ Bytecount result;
va_list args;
va_start (args, fmt);
if (initialized && !inhibit_non_essential_conversion_operations)
fmt = GETTEXT (fmt);
- write_fmt_string_va (Qt, fmt, args);
+ result = write_fmt_string_va (Qt, fmt, args);
va_end (args);
+ return result;
}
/* Write a printf-style string to standard output, where the arguments are
Lisp_Objects. */
-void
+Bytecount
stderr_out_lisp (const CIbyte *fmt, ...)
{
+ Bytecount result;
va_list va;
if (initialized && !inhibit_non_essential_conversion_operations)
fmt = GETTEXT (fmt);
va_start (va, fmt);
- write_fmt_string_lisp_va (Qexternal_debugging_output, fmt, va);
+ result = write_fmt_string_lisp_va (Qexternal_debugging_output, fmt, va);
va_end (va);
+
+ return result;
}
/* Return a Lisp string reflecting FORMAT_NONRELOC and VARGS, where VARGS
diff -r 296ee062f9f9ce4957f6aa450a2b4ad7fb57935c -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 src/lisp.h
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -4770,18 +4770,19 @@
Lisp_Object format_into (Lisp_Object stream, Lisp_Object format_reloc,
int nargs, const Lisp_Object *largs);
-MODULE_API void write_fmt_string (Lisp_Object stream, const CIbyte *fmt, ...)
+MODULE_API Bytecount write_fmt_string (Lisp_Object stream, const CIbyte *fmt,
+ ...)
PRINTF_ARGS (2, 3);
-MODULE_API void write_fmt_string_va (Lisp_Object stream,
- const CIbyte *fmt, va_list);
-MODULE_API void write_fmt_string_lisp (Lisp_Object stream, const CIbyte *fmt,
- ...);
-MODULE_API void write_fmt_string_lisp_va (Lisp_Object stream,
- const CIbyte *fmt, va_list);
-
-void stderr_out (const CIbyte *, ...) PRINTF_ARGS (1, 2);
-void stderr_out_lisp (const CIbyte *, ...);
-void stdout_out (const CIbyte *, ...) PRINTF_ARGS (1, 2);
+MODULE_API Bytecount write_fmt_string_va (Lisp_Object stream,
+ const CIbyte *fmt, va_list);
+MODULE_API Bytecount write_fmt_string_lisp (Lisp_Object stream,
+ const CIbyte *fmt, ...);
+MODULE_API Bytecount write_fmt_string_lisp_va (Lisp_Object stream,
+ const CIbyte *fmt, va_list);
+
+Bytecount stderr_out (const CIbyte *, ...) PRINTF_ARGS (1, 2);
+Bytecount stderr_out_lisp (const CIbyte *, ...);
+Bytecount stdout_out (const CIbyte *, ...) PRINTF_ARGS (1, 2);
Lisp_Object emacs_vsprintf_string_lisp (const CIbyte *format_nonreloc,
va_list vargs);
@@ -5864,8 +5865,8 @@
void debug_p3 (Lisp_Object obj);
void debug_short_backtrace (int);
void debug_backtrace (void);
-MODULE_API void write_lisp_string (Lisp_Object stream, Lisp_Object string,
- Bytecount offset, Bytecount len);
+MODULE_API Bytecount write_lisp_string (Lisp_Object stream, Lisp_Object string,
+ Bytecount offset, Bytecount len);
/* NOTE: Do not call the following with the data of a Lisp_String. Use
write_lisp_string().
@@ -5873,41 +5874,41 @@
If you would like a STREAM value of Qt, Qnil to indicate output to the
selected frame, rather than C's standard output, call
canonicalize_printcharfun () before calling this function. */
-void write_string_1 (Lisp_Object stream, const Ibyte *str, Bytecount size);
+Bytecount write_string_1 (Lisp_Object stream, const Ibyte *str,
+ Bytecount size);
/* Same goes for this function. */
DECLARE_INLINE_HEADER (
-void write_istring (Lisp_Object stream, const Ibyte *str)
-)
-{
- /* This function can GC. We'd like to qxestrlen, but that's not yet
- available in this file. */
- write_string_1 (stream, str, strlen ((const char *) str));
-}
-/* Same goes for this function. */
-DECLARE_INLINE_HEADER (
-void write_cistring (Lisp_Object stream, const CIbyte *str)
+Bytecount write_istring (Lisp_Object stream, const Ibyte *str)
)
{
/* This function can GC. We'd like to qxestrlen, but that's not yet
available in this file. */
- write_string_1 (stream, (const Ibyte *) str,
- strlen ((const char *) str));
+ return write_string_1 (stream, str, strlen ((const char *) str));
}
/* Same goes for this function. */
DECLARE_INLINE_HEADER (
-void write_ascstring (Lisp_Object stream, const Ascbyte *str)
+Bytecount write_cistring (Lisp_Object stream, const CIbyte *str)
+)
+{
+ /* This function can GC. We'd like to qxestrlen, but that's not yet
+ available in this file. */
+ return write_string_1 (stream, (const Ibyte *) str,
+ strlen ((const char *) str));
+}
+/* Same goes for this function. */
+DECLARE_INLINE_HEADER (
+Bytecount write_ascstring (Lisp_Object stream, const Ascbyte *str)
)
{
/* This function can GC. */
- write_string_1 (stream, (const Ibyte *) str,
- strlen ((char *) str));
+ return write_string_1 (stream, (const Ibyte *) str, strlen ((char *) str));
}
-void write_eistring (Lisp_Object stream, const Eistring *ei);
-
-void external_out (int dest, const CIbyte *fmt, ...) PRINTF_ARGS (2, 3);
-void debug_out (const CIbyte *, ...) PRINTF_ARGS (1, 2);
-void debug_out_lisp (const CIbyte *, ...);
+Bytecount write_eistring (Lisp_Object stream, const Eistring *ei);
+
+Bytecount external_out (int dest, const CIbyte *fmt, ...) PRINTF_ARGS (2, 3);
+Bytecount debug_out (const CIbyte *, ...) PRINTF_ARGS (1, 2);
+Bytecount debug_out_lisp (const CIbyte *, ...);
DECLARE_DOESNT_RETURN (fatal (const CIbyte *, ...)) PRINTF_ARGS(1, 2);
/* Internal functions: */
diff -r 296ee062f9f9ce4957f6aa450a2b4ad7fb57935c -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 src/print.c
--- a/src/print.c
+++ b/src/print.c
@@ -158,8 +158,8 @@
FILE *termscript; /* Stdio stream being used for copy of all output. */
-static void write_string_to_alternate_debugging_output (const Ibyte *str,
- Bytecount len);
+static Bytecount write_string_to_alternate_debugging_output (const Ibyte *str,
+ Bytecount len);
/* To avoid consing in debug_prin1, we package up variables we need to bind
into an opaque object. */
@@ -186,17 +186,17 @@
/* Basic function to actually write to a stdio stream or TTY console. */
-static void
+static Bytecount
write_string_to_stdio_stream_1 (FILE *stream, struct console *con,
const Ibyte *ptr, Bytecount len,
int must_flush)
{
Extbyte *extptr = 0;
- Bytecount extlen = 0;
- int output_is_std_handle =
+ Bytecount extlen = 0, result;
+ Boolint output_is_std_handle =
stream ? stream == stdout || stream == stderr :
- CONSOLE_TTY_DATA (con)->is_stdio;
-
+ CONSOLE_TTY_DATA (con)->is_stdio;
+
if (stream || output_is_std_handle)
{
if (initialized && !inhibit_non_essential_conversion_operations)
@@ -229,7 +229,7 @@
else
#endif
{
- retry_fwrite (extptr, 1, extlen, stream);
+ result = retry_fwrite (extptr, 1, extlen, stream);
#ifdef WIN32_NATIVE
/* Q122442 says that pipes are "treated as files, not as
devices", and that this is a feature. Before I found that
@@ -243,7 +243,8 @@
}
else
/* The stream itself does conversion to external format */
- Lstream_write (XLSTREAM (CONSOLE_TTY_DATA (con)->outstream), ptr, len);
+ result = Lstream_write (XLSTREAM (CONSOLE_TTY_DATA (con)->outstream),
+ ptr, len);
if (output_is_std_handle)
{
@@ -254,12 +255,14 @@
}
stdout_needs_newline = (ptr[len - 1] != '\n');
}
+
+ return result;
}
/* Write to a stdio stream or TTY console, first clearing the left side
if necessary. */
-static void
+static Bytecount
write_string_to_stdio_stream (FILE *stream, struct console *con,
const Ibyte *ptr, Bytecount len,
int must_flush)
@@ -274,7 +277,7 @@
stdout_clear_before_next_output = 0;
}
- write_string_to_stdio_stream_1 (stream, con, ptr, len, must_flush);
+ return write_string_to_stdio_stream_1 (stream, con, ptr, len, must_flush);
}
/*
@@ -299,20 +302,35 @@
EXT_PRINT_ALL = 14
};
-static void
+static Bytecount
write_string_to_external_output (const Ibyte *ptr, Bytecount len,
int dest)
{
+ Bytecount result = 0, output;
if (dest & EXT_PRINT_STDOUT)
- write_string_to_stdio_stream (stdout, 0, ptr, len, 1);
+ {
+ output = write_string_to_stdio_stream (stdout, 0, ptr, len, 1);
+ result = min (result, output);
+ }
if (dest & EXT_PRINT_STDERR)
- write_string_to_stdio_stream (stderr, 0, ptr, len, 1);
+ {
+ output = write_string_to_stdio_stream (stderr, 0, ptr, len, 1);
+ result = min (result, output);
+ }
if (dest & EXT_PRINT_ALTERNATE)
- write_string_to_alternate_debugging_output (ptr, len);
+ {
+ output = write_string_to_alternate_debugging_output (ptr, len);
+ result = min (result, output);
+ }
#ifdef WIN32_NATIVE
if (dest & EXT_PRINT_MSWINDOWS)
- write_string_to_mswindows_debugging_output (ptr, len);
+ {
+ output = write_string_to_mswindows_debugging_output (ptr, len);
+ result = min (result, output);
+ }
#endif
+
+ return result;
}
/* This function can be called from fatal_error_signal() and so should make as
@@ -332,7 +350,7 @@
Both emacs_vsnprintf() and write_string_to_external_output_va() will fail
if we run out of stack space. Oh well. */
-static void
+static Bytecount
write_string_to_external_output_va (const CIbyte *fmt, va_list args,
int dest)
{
@@ -347,17 +365,22 @@
write_string_to_external_output (kludge,
min (klen, (Bytecount) sizeof (kludge)),
dest);
+
+ return klen;
}
/* Output portably to print destination as specified by DEST. */
-void
+Bytecount
external_out (int dest, const CIbyte *fmt, ...)
{
+ Bytecount result;
va_list args;
va_start (args, fmt);
- write_string_to_external_output_va (fmt, args, dest);
+ result = write_string_to_external_output_va (fmt, args, dest);
va_end (args);
+
+ return result;
}
DOESNT_RETURN
@@ -391,7 +414,7 @@
Use Qexternal_debugging_output to get output to stderr.
*/
-static void
+static Bytecount
output_string (Lisp_Object function, const Ibyte *nonreloc,
Lisp_Object reloc, Bytecount offset, Bytecount len)
{
@@ -402,22 +425,22 @@
may get confused and an assertion failure in
fixup_internal_substring() may get triggered. */
const Ibyte *newnonreloc;
- struct gcpro gcpro1, gcpro2;
+ Bytecount result;
/* Emacs won't print while GCing, but an external debugger might */
#ifdef NO_PRINT_DURING_GC
- if (gc_in_progress) return;
+ if (gc_in_progress) return 0;
#endif
- /* Perhaps not necessary but probably safer. */
- GCPRO2 (function, reloc);
-
fixup_internal_substring (nonreloc, reloc, offset, &len);
newnonreloc = STRINGP (reloc) ? XSTRING_DATA (reloc) : nonreloc;
if (LSTREAMP (function))
{
+ struct gcpro gcpro1, gcpro2;
+ GCPRO2 (reloc, function);
+
if (STRINGP (reloc))
{
/* We used to inhibit GC here. There's no need, the only Lstreams
@@ -429,24 +452,37 @@
have write_with_extents (), which knows it has been handed a Lisp
string, and can take appropriate action to re-fetch string
data. */
- Lstream_write_with_extents (XLSTREAM (function), reloc, offset,
- len);
+ result = Lstream_write_with_extents (XLSTREAM (function), reloc,
+ offset, len);
}
else
{
- Lstream_write (XLSTREAM (function), newnonreloc + offset, len);
+ result = Lstream_write (XLSTREAM (function), newnonreloc + offset,
+ len);
}
if (print_unbuffered)
Lstream_flush (XLSTREAM (function));
+
+ RETURN_UNGCPRO (result);
}
else if (BUFFERP (function))
{
+ struct gcpro gcpro1;
+
CHECK_LIVE_BUFFER (function);
+
+ GCPRO1 (reloc);
+
buffer_insert_string (XBUFFER (function), nonreloc, reloc, offset, len);
+
+ RETURN_UNGCPRO (len);
}
else if (MARKERP (function))
{
+ struct gcpro gcpro1;
+ GCPRO1 (reloc);
+
buffer_insert_string_1 (XMARKER (function)->buffer,
/* marker_position() will err if marker
doesn't point anywhere. */
@@ -454,22 +490,29 @@
offset, len, -1, 0);
set_byte_marker_position (function,
byte_marker_position (function) + len);
+ RETURN_UNGCPRO (len); /* We will have errored on failure. */
}
else if (FRAMEP (function))
{
/* This gets used by functions not invoking print_prepare(),
such as Fwrite_char, Fterpri, etc.. */
struct frame *f = XFRAME (function);
+ struct gcpro gcpro1;
+
CHECK_LIVE_FRAME (function);
+ GCPRO1 (reloc);
+
if (!EQ (Vprint_message_label, echo_area_status (f)))
clear_echo_area_from_print (f, Qnil, 1);
echo_area_append (f, nonreloc, reloc, offset, len, Vprint_message_label);
+
+ RETURN_UNGCPRO (len);
}
else if (EQ (function, Qt) || EQ (function, Qnil))
{
- write_string_to_stdio_stream (stdout, 0, newnonreloc + offset, len,
- print_unbuffered);
+ return write_string_to_stdio_stream (stdout, 0, newnonreloc + offset,
+ len, print_unbuffered);
}
else if (EQ (function, Qexternal_debugging_output))
{
@@ -477,15 +520,19 @@
having each character passed separately to
`external-debugging-output'. The API says to pass each character
separately because that is the Lisp Way. */
- write_string_to_stdio_stream (stderr, 0, newnonreloc + offset, len,
- print_unbuffered);
+ return write_string_to_stdio_stream (stderr, 0, newnonreloc + offset,
+ len, print_unbuffered);
}
else
{
Bytecount end = offset + len;
+ struct gcpro gcpro1;
+
+ GCPRO1 (reloc);
while (offset < end)
{
+ /* call1() GCPROs FUNCTION. */
call1 (function, make_char (itext_ichar (newnonreloc + offset)));
if (STRINGP (reloc))
@@ -509,9 +556,9 @@
offset += itext_ichar_len (newnonreloc + offset);
}
+
+ RETURN_UNGCPRO (len);
}
-
- UNGCPRO;
}
static int
@@ -645,12 +692,12 @@
/* Write a Lisp string to STREAM, preserving extent data if STREAM can handle
it, and protecting its string data from relocation when appropriate. */
-void
+Bytecount
write_lisp_string (Lisp_Object stream, Lisp_Object string, Bytecount offset,
Bytecount len)
{
/* This function can GC */
- output_string (stream, NULL, string, offset, len);
+ return output_string (stream, NULL, string, offset, len);
}
/* Write internal-format data to STREAM. See output_string() for
@@ -668,18 +715,18 @@
Also note that STREAM should be the result of canonicalize_printcharfun()
(i.e. Qnil means stdout, not Vstandard_output, etc.) */
-void
+Bytecount
write_string_1 (Lisp_Object stream, const Ibyte *str, Bytecount size)
{
/* This function can GC */
text_checking_assert (size >= 0);
- output_string (stream, str, Qnil, 0, size);
+ return output_string (stream, str, Qnil, 0, size);
}
-void
+Bytecount
write_eistring (Lisp_Object stream, const Eistring *ei)
{
- write_string_1 (stream, eidata (ei), eilen (ei));
+ return write_string_1 (stream, eidata (ei), eilen (ei));
}
DEFUN ("write-char", Fwrite_char, 1, 2, 0, /*
@@ -2467,7 +2514,7 @@
return character;
}
-static void
+static Bytecount
write_string_to_alternate_debugging_output (const Ibyte *str, Bytecount len)
{
int extlen;
@@ -2486,7 +2533,7 @@
/* If not yet initialized, just skip it. */
if (alternate_do_string == NULL)
- return;
+ return 0;
if (alternate_do_pointer + extlen >= alternate_do_size)
{
@@ -2497,6 +2544,7 @@
memcpy (alternate_do_string + alternate_do_pointer, extptr, extlen);
alternate_do_pointer += extlen;
alternate_do_string[alternate_do_pointer] = 0;
+ return extlen;
}
@@ -2839,15 +2887,17 @@
/* Printf-style debugging output. */
-void
+Bytecount
debug_out (const CIbyte *fmt, ...)
{
int depth = begin_inhibit_non_essential_conversion_operations ();
+ Bytecount result;
va_list args;
va_start (args, fmt);
- write_string_to_external_output_va (fmt, args, EXT_PRINT_ALL);
+ result = write_string_to_external_output_va (fmt, args, EXT_PRINT_ALL);
va_end (args);
unbind_to (depth);
+ return result;
}
/* Basic entry point: Print out a Lisp object to the debugging output. */
@@ -2855,7 +2905,7 @@
void
debug_print (Lisp_Object debug_print_obj)
{
- external_debug_print (debug_print_obj, EXT_PRINT_ALL);
+ return external_debug_print (debug_print_obj, EXT_PRINT_ALL);
}
/* Printf-style output when the objects being printed are Lisp objects.
@@ -2864,13 +2914,13 @@
debug_out_lisp ("Called foo(%s %s)\n", arg0, arg1)
*/
-void
+Bytecount
debug_out_lisp (const CIbyte *format, ...)
{
/* This function cannot GC, since GC is forbidden */
struct debug_bindings bindings;
int specdepth = debug_print_enter (&bindings);
- Bytecount len;
+ Bytecount len, result;
va_list va;
Ibyte *msgout;
@@ -2878,9 +2928,11 @@
len = emacs_vasprintf_lisp (&msgout, format, va);
va_end (va);
- write_string_to_external_output (msgout, len, EXT_PRINT_ALL);
+ result = write_string_to_external_output (msgout, len, EXT_PRINT_ALL);
xfree (msgout);
unbind_to (specdepth);
+
+ return result;
}
/* Getting tired of typing debug_print() ... */
https://bitbucket.org/xemacs/xemacs/commits/27f66ce6ab71/
Changeset: 27f66ce6ab71
User: kehoea
Date: 2017-12-27 10:49:27+00:00
Summary: Write to Lisp streams instead of Eistrings(), events.c, keymap.c
src/ChangeLog addition:
2017-12-27 Aidan Kehoe <kehoea(a)parhasard.net>
Remove use of Eistring malloc buffers, have the corresponding
functions write to Lisp streams instead, as they were usually
ultimately doing anyway.
* event-Xt.c (emacs_Xt_format_magic_event):
Return a Bytecount here, helpful for its use as part of the
write-to-Lisp-stream infrastructure.
* event-gtk.c (emacs_gtk_format_magic_event):
Ditto.
* event-msw.c (emacs_mswindows_format_magic_event):
Dito.
* event-stream.c:
* event-stream.c (event_stream_format_magic_event):
Ditto.
* event-stream.c (echo_key_event):
Don't use an Eistring for the constructed string to echo the
event, build it directly into command_builder->echo_buf, using a
fixed_buffer Lisp output stream.
* event-tty.c (emacs_tty_format_magic_event):
Return zero, not void.
* events.c (print_event_1): Removed.
This mainly existed to provide a place to declare an Eistring.
* events.c (print_event):
Use write_ascstring() and format_event_object() as appropriate.
* events.c (format_event_object):
Return a Bytecount, and print into a Lisp stream, rather than an
Eistring.
* events.h:
Update the declaration of format_magic_event_cb(),
format_event_object(), event_stream_format_magic_event().
* events.h (struct event_stream):
* gui-x.c (button_item_to_widget_value):
Don't use an Eistring here, use a small Ibyte buffer; there's no
value to generating a long strong.
* gui.c (gui_item_display_flush_right):
Ditto.
* keymap.c:
* keymap.c (EXPOSE_FIXED_BUFFER_INTERNALS):
#define this when #including lstream.h, so where_is_to_Ibyte() can
create a stack-based Lstream object.
* keymap.c (Fsingle_key_description):
Use a resizing_buffer Lisp stream in this function rather than an
Eistring.
* keymap.c (Fwhere_is_internal):
Update the call to where_is_internal().
* keymap.c (where_is_to_Ibyte): Renamed from where_is_to_char().
Updated to use a stack fixed buffer lstream, and to return the
number of bytes that would have been written to the buffer, on the
model of emacs_asnprintf().
* keymap.c (raw_keys_to_keys):
Format into a stream, rather than an Eistring.
* keymap.c (format_raw_keys):
* keymap.c (where_is_recursive_mapper):
When TARGET-BUFFER is non-nil, format into it with
format_raw_keys(). Return the bytecount needed for them.
* lisp.h:
Rename and update the declaration of where_is_to_char() ->
where_is_to_Ibyte().
* lstream.h:
* lstream.h (INIT_STACK_FIXED_BUFFER_OUTPUT_STREAM):
TThere was an issue in the name of the third argument to this
macro, correct it.
* menubar-gtk.c (menu_descriptor_to_widget_1):
Limit the printed name of this callback to 64 characters.
Affected #: 14 files
diff -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,70 @@
+2017-12-27 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ Remove use of Eistring malloc buffers, have the corresponding
+ functions write to Lisp streams instead, as they were usually
+ ultimately doing anyway.
+
+ * event-Xt.c (emacs_Xt_format_magic_event):
+ Return a Bytecount here, helpful for its use as part of the
+ write-to-Lisp-stream infrastructure.
+ * event-gtk.c (emacs_gtk_format_magic_event):
+ Ditto.
+ * event-msw.c (emacs_mswindows_format_magic_event):
+ Dito.
+ * event-stream.c:
+ * event-stream.c (event_stream_format_magic_event):
+ Ditto.
+ * event-stream.c (echo_key_event):
+ Don't use an Eistring for the constructed string to echo the
+ event, build it directly into command_builder->echo_buf, using a
+ fixed_buffer Lisp output stream.
+ * event-tty.c (emacs_tty_format_magic_event):
+ Return zero, not void.
+ * events.c (print_event_1): Removed.
+ This mainly existed to provide a place to declare an Eistring.
+ * events.c (print_event):
+ Use write_ascstring() and format_event_object() as appropriate.
+ * events.c (format_event_object):
+ Return a Bytecount, and print into a Lisp stream, rather than an
+ Eistring.
+ * events.h:
+ Update the declaration of format_magic_event_cb(),
+ format_event_object(), event_stream_format_magic_event().
+ * events.h (struct event_stream):
+ * gui-x.c (button_item_to_widget_value):
+ Don't use an Eistring here, use a small Ibyte buffer; there's no
+ value to generating a long strong.
+ * gui.c (gui_item_display_flush_right):
+ Ditto.
+ * keymap.c:
+ * keymap.c (EXPOSE_FIXED_BUFFER_INTERNALS):
+ #define this when #including lstream.h, so where_is_to_Ibyte() can
+ create a stack-based Lstream object.
+ * keymap.c (Fsingle_key_description):
+ Use a resizing_buffer Lisp stream in this function rather than an
+ Eistring.
+ * keymap.c (Fwhere_is_internal):
+ Update the call to where_is_internal().
+ * keymap.c (where_is_to_Ibyte): Renamed from where_is_to_char().
+ Updated to use a stack fixed buffer lstream, and to return the
+ number of bytes that would have been written to the buffer, on the
+ model of emacs_asnprintf().
+ * keymap.c (raw_keys_to_keys):
+ Format into a stream, rather than an Eistring.
+ * keymap.c (format_raw_keys):
+ * keymap.c (where_is_recursive_mapper):
+ When TARGET-BUFFER is non-nil, format into it with
+ format_raw_keys(). Return the bytecount needed for them.
+ * lisp.h:
+ Rename and update the declaration of where_is_to_char() ->
+ where_is_to_Ibyte().
+ * lstream.h:
+ * lstream.h (INIT_STACK_FIXED_BUFFER_OUTPUT_STREAM):
+ TThere was an issue in the name of the third argument to this
+ macro, correct it.
+ * menubar-gtk.c (menu_descriptor_to_widget_1):
+ Limit the printed name of this callback to 64 characters.
+
2017-12-23 Aidan Kehoe <kehoea(a)parhasard.net>
* console-msw.c (mswindows_output_console_string):
diff -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 src/event-Xt.c
--- a/src/event-Xt.c
+++ b/src/event-Xt.c
@@ -2837,13 +2837,17 @@
event. */
}
-static void
+static Bytecount
emacs_Xt_format_magic_event (Lisp_Event *event, Lisp_Object pstream)
{
Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (event));
if (CONSOLE_X_P (XCONSOLE (console)))
- write_ascstring
- (pstream, x_event_name ((EVENT_MAGIC_X_EVENT (event)).type));
+ {
+ return write_ascstring
+ (pstream, x_event_name ((EVENT_MAGIC_X_EVENT (event)).type));
+ }
+
+ return 0;
}
static int
diff -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 src/event-gtk.c
--- a/src/event-gtk.c
+++ b/src/event-gtk.c
@@ -310,14 +310,17 @@
enqueue_dispatch_event (emacs_event);
}
-static void
+static Bytecount
emacs_gtk_format_magic_event (Lisp_Event *emacs_event, Lisp_Object pstream)
{
Lisp_Object console = CDFW_CONSOLE (EVENT_CHANNEL (emacs_event));
if (CONSOLE_GTK_P (XCONSOLE (console)))
- write_cistring
- (pstream,
- gtk_event_name (EVENT_MAGIC_GDK_EVENT (emacs_event).type));
+ {
+ return write_cistring
+ (pstream,
+ gtk_event_name (EVENT_MAGIC_GDK_EVENT (emacs_event).type));
+ }
+ return 0;
}
static int
diff -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 src/event-msw.c
--- a/src/event-msw.c
+++ b/src/event-msw.c
@@ -4279,11 +4279,14 @@
Fdeallocate_event (event);
}
-static void
+static Bytecount
emacs_mswindows_format_magic_event (Lisp_Event *emacs_event,
Lisp_Object pstream)
{
-#define FROB(msg) case msg: write_ascstring (pstream, "type=" #msg); break
+ Bytecount result = 0;
+#define FROB(msg) case msg: \
+ result += write_ascstring (pstream, "type=" #msg); \
+ break
switch (EVENT_MAGIC_MSWINDOWS_EVENT (emacs_event))
{
@@ -4300,9 +4303,11 @@
if (!NILP (EVENT_CHANNEL (emacs_event)))
{
- write_ascstring (pstream, " ");
- print_internal (EVENT_CHANNEL (emacs_event), pstream, 1);
+ result += write_fmt_string (pstream, " %S",
+ EVENT_CHANNEL (emacs_event));
}
+
+ return result;
}
static int
diff -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 src/event-stream.c
--- a/src/event-stream.c
+++ b/src/event-stream.c
@@ -75,6 +75,8 @@
#include <config.h>
#include "lisp.h"
+#define EXPOSE_FIXED_BUFFER_INTERNALS 1
+#include "lstream.h"
#include "blocktype.h"
#include "buffer.h"
#include "commands.h"
@@ -85,7 +87,6 @@
#include "frame-impl.h"
#include "insdel.h" /* for buffer_reset_changes */
#include "keymap.h"
-#include "lstream.h"
#include "macros.h" /* for defining_keyboard_macro */
#include "menubar.h" /* #### for evil kludges. */
#include "process.h"
@@ -481,11 +482,11 @@
event_stream->handle_magic_event_cb (event);
}
-void
+Bytecount
event_stream_format_magic_event (Lisp_Event *event, Lisp_Object pstream)
{
check_event_stream_ok ();
- event_stream->format_magic_event_cb (event, pstream);
+ return event_stream->format_magic_event_cb (event, pstream);
}
int
@@ -644,9 +645,9 @@
Lisp_Object event)
{
/* This function can GC */
- DECLARE_EISTRING_MALLOC (buf);
Bytecount buf_fill_pointer = command_builder->echo_buf_fill_pointer;
- Bytecount len;
+ Bytecount len = 0;
+ DECLARE_STACK_FIXED_BUFFER_LSTREAM (stream);
if (buf_fill_pointer < 0)
{
@@ -654,28 +655,35 @@
clear_echo_area (selected_frame (), Qnil, 0);
}
- format_event_object (buf, event, 1);
- len = eilen (buf);
-
- if (NILP (command_builder->echo_buf) ||
- (len + buf_fill_pointer + 3 > XSTRING_LENGTH (command_builder->echo_buf)))
+ if (NILP (command_builder->echo_buf))
{
- eifree (buf);
return;
}
- eicat_ascii (buf, " - ");
-
- memcpy (XSTRING_DATA (command_builder->echo_buf) + buf_fill_pointer,
- eidata (buf), eilen (buf));
+ INIT_STACK_FIXED_BUFFER_OUTPUT_STREAM
+ (stream, XSTRING_DATA (command_builder->echo_buf) + buf_fill_pointer,
+ XSTRING_LENGTH (command_builder->echo_buf) - buf_fill_pointer);
+
+ len += format_event_object (stream, event, 1);
+
+ if (len + buf_fill_pointer + 3 > XSTRING_LENGTH (command_builder->echo_buf))
+ {
+ memset (XSTRING_DATA (command_builder->echo_buf) + buf_fill_pointer, 0,
+ XSTRING_LENGTH (command_builder->echo_buf) - buf_fill_pointer);
+ return; /* Not enough space. */
+ }
+
+ write_ascstring (stream, " - ");
+
init_string_ascii_begin (command_builder->echo_buf);
bump_string_modiff (command_builder->echo_buf);
sledgehammer_check_ascii_begin (command_builder->echo_buf);
- command_builder->echo_buf_end = buf_fill_pointer + eilen (buf);
+ command_builder->echo_buf_end
+ = buf_fill_pointer + len + qxestrlen ((const Ibyte *) " - ");
/* Including the first space of the trailing " - ". */
- command_builder->echo_buf_fill_pointer = buf_fill_pointer + len + 1;
- eifree (buf);
+ command_builder->echo_buf_fill_pointer = buf_fill_pointer + len
+ + ichar_len (' ');
}
static void
diff -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 src/event-tty.c
--- a/src/event-tty.c
+++ b/src/event-tty.c
@@ -247,11 +247,12 @@
}
}
-static void
+static Bytecount
emacs_tty_format_magic_event (Lisp_Event *UNUSED (emacs_event),
Lisp_Object UNUSED (pstream))
{
/* Nothing to do currently */
+ return 0;
}
static int
diff -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 src/events.c
--- a/src/events.c
+++ b/src/events.c
@@ -288,16 +288,6 @@
}
static void
-print_event_1 (const Ascbyte *str, Lisp_Object obj, Lisp_Object printcharfun)
-{
- DECLARE_EISTRING_MALLOC (ei);
- write_ascstring (printcharfun, str);
- format_event_object (ei, obj, 0);
- write_eistring (printcharfun, ei);
- eifree (ei);
-}
-
-static void
print_event (Lisp_Object obj, Lisp_Object printcharfun,
int UNUSED (escapeflag))
{
@@ -307,17 +297,21 @@
switch (XEVENT (obj)->event_type)
{
case key_press_event:
- print_event_1 ("#<keypress-event ", obj, printcharfun);
+ write_ascstring (printcharfun, "#<keypress-event ");
+ format_event_object (printcharfun, obj, 0);
break;
case button_press_event:
- print_event_1 ("#<buttondown-event ", obj, printcharfun);
+ write_ascstring (printcharfun, "#<buttondown-event ");
+ format_event_object (printcharfun, obj, 0);
break;
case button_release_event:
- print_event_1 ("#<buttonup-event ", obj, printcharfun);
+ write_ascstring (printcharfun, "#<buttonup-event ");
+ format_event_object (printcharfun, obj, 0);
break;
case magic_event:
case magic_eval_event:
- print_event_1 ("#<magic-event ", obj, printcharfun);
+ write_ascstring (printcharfun, "#<magic-event ");
+ format_event_object (printcharfun, obj, 0);
break;
case pointer_motion_event:
{
@@ -327,39 +321,37 @@
Vy = Fevent_y_pixel (obj);
assert (FIXNUMP (Vy));
write_fmt_string (printcharfun, "#<motion-event %ld, %ld",
- (long) XFIXNUM (Vx), (long) XFIXNUM (Vy));
+ XFIXNUM (Vx), XFIXNUM (Vy));
break;
}
case process_event:
- write_fmt_string_lisp (printcharfun, "#<process-event %S",
- XEVENT_PROCESS_PROCESS (obj));
- break;
+ write_fmt_string_lisp (printcharfun, "#<process-event %S",
+ XEVENT_PROCESS_PROCESS (obj));
+ break;
case timeout_event:
- write_fmt_string_lisp (printcharfun, "#<timeout-event %S",
- XEVENT_TIMEOUT_OBJECT (obj));
- break;
+ write_fmt_string_lisp (printcharfun, "#<timeout-event %S",
+ XEVENT_TIMEOUT_OBJECT (obj));
+ break;
case empty_event:
- write_ascstring (printcharfun, "#<empty-event");
- break;
+ write_ascstring (printcharfun, "#<empty-event");
+ break;
case misc_user_event:
- write_fmt_string_lisp (printcharfun, "#<misc-user-event (%S",
- XEVENT_MISC_USER_FUNCTION (obj));
- write_fmt_string_lisp (printcharfun, " %S)",
- XEVENT_MISC_USER_OBJECT (obj));
- break;
+ write_fmt_string_lisp (printcharfun, "#<misc-user-event (%S %S)",
+ XEVENT_MISC_USER_FUNCTION (obj),
+ XEVENT_MISC_USER_OBJECT (obj));
+ break;
case eval_event:
- write_fmt_string_lisp (printcharfun, "#<eval-event (%S",
- XEVENT_EVAL_FUNCTION (obj));
- write_fmt_string_lisp (printcharfun, " %S)",
- XEVENT_EVAL_OBJECT (obj));
- break;
+ write_fmt_string_lisp (printcharfun, "#<eval-event (%S %S)",
+ XEVENT_EVAL_FUNCTION (obj),
+ XEVENT_EVAL_OBJECT (obj));
+ break;
case dead_event:
- write_ascstring (printcharfun, "#<DEALLOCATED-EVENT");
- break;
+ write_ascstring (printcharfun, "#<DEALLOCATED-EVENT");
+ break;
default:
- write_ascstring (printcharfun, "#<UNKNOWN-EVENT-TYPE");
- break;
- }
+ write_ascstring (printcharfun, "#<UNKNOWN-EVENT-TYPE");
+ break;
+ }
write_fmt_string (printcharfun, " 0x%x>", LISP_OBJECT_UID (obj));
}
@@ -1491,15 +1483,16 @@
}
-/* Concatenate a string description of EVENT onto the end of BUF. If
- BRIEF, use short forms for keys, e.g. C- instead of control-. */
-
-void
-format_event_object (Eistring *buf, Lisp_Object event, int brief)
+/* Write a string description of EVENT to PRINTCHARFUN. If BRIEF is
+ non-zero, use short forms for keys, e.g. C- instead of control-. */
+Bytecount
+format_event_object (Lisp_Object printcharfun, Lisp_Object event,
+ Boolint brief)
{
- int mouse_p = 0;
+ Boolint mouse_p = 0;
int mod = 0;
Lisp_Object key;
+ Bytecount result = 0;
switch (XEVENT_TYPE (event))
{
@@ -1512,7 +1505,7 @@
mod & (XEMACS_MOD_CONTROL | XEMACS_MOD_META | XEMACS_MOD_SUPER |
XEMACS_MOD_HYPER))
{
- int k = XCHAR (key);
+ Ichar k = XCHAR (key);
if (k >= 'a' && k <= 'z')
key = make_char (k - ('a' - 'A'));
else if (k >= 'A' && k <= 'Z')
@@ -1532,33 +1525,48 @@
}
case magic_event:
{
- Lisp_Object stream;
- struct gcpro gcpro1;
- GCPRO1 (stream);
-
- stream = make_resizing_buffer_output_stream ();
- event_stream_format_magic_event (XEVENT (event), stream);
- Lstream_flush (XLSTREAM (stream));
- eicat_raw (buf, resizing_buffer_stream_ptr (XLSTREAM (stream)),
- Lstream_byte_count (XLSTREAM (stream)));
- Lstream_delete (XLSTREAM (stream));
- UNGCPRO;
- return;
+ return event_stream_format_magic_event (XEVENT (event),
+ printcharfun);
+ }
+ case magic_eval_event:
+ {
+ return write_ascstring (printcharfun, "magic-eval");
+ }
+ case pointer_motion_event:
+ {
+ return write_ascstring (printcharfun, "motion");
+ }
+ case misc_user_event:
+ {
+ return write_ascstring (printcharfun, "misc-user");
}
- case magic_eval_event: eicat_ascii (buf, "magic-eval"); return;
- case pointer_motion_event: eicat_ascii (buf, "motion"); return;
- case misc_user_event: eicat_ascii (buf, "misc-user"); return;
- case eval_event: eicat_ascii (buf, "eval"); return;
- case process_event: eicat_ascii (buf, "process"); return;
- case timeout_event: eicat_ascii (buf, "timeout"); return;
- case empty_event: eicat_ascii (buf, "empty"); return;
- case dead_event: eicat_ascii (buf, "DEAD-EVENT"); return;
+ case eval_event:
+ {
+ return write_ascstring (printcharfun, "eval");
+ }
+ case process_event:
+ {
+ return write_ascstring (printcharfun, "process");
+ }
+ case timeout_event:
+ {
+ return write_ascstring (printcharfun, "timeout");
+ }
+ case empty_event:
+ {
+ return write_ascstring (printcharfun, "empty");
+ }
+ case dead_event:
+ {
+ return write_ascstring (printcharfun, "DEAD-EVENT");
+ }
default:
ABORT ();
- return;
+ return 0;
}
-#define modprint(x,y) \
- do { if (brief) eicat_ascii (buf, (y)); else eicat_ascii (buf, (x)); } while (0)
+#define modprint(x,y) \
+ do { if (brief) result += write_ascstring (printcharfun, (y)); \
+ else result += write_ascstring (printcharfun, (x)); } while (0)
if (mod & XEMACS_MOD_CONTROL) modprint ("control-", "C-");
if (mod & XEMACS_MOD_META) modprint ("meta-", "M-");
if (mod & XEMACS_MOD_SUPER) modprint ("super-", "S-");
@@ -1567,14 +1575,18 @@
if (mod & XEMACS_MOD_SHIFT) modprint ("shift-", "Sh-");
if (mouse_p)
{
- eicat_ascii (buf, "button");
+ result += write_ascstring (printcharfun, "button");
--mouse_p;
}
#undef modprint
if (CHARP (key))
- eicat_ch (buf, XCHAR (key));
+ {
+ Ibyte str[MAX_ICHAR_LEN];
+ result += write_string_1 (printcharfun, str,
+ set_itext_ichar (str, XCHAR (key)));
+ }
else if (SYMBOLP (key))
{
const Ascbyte *str = 0;
@@ -1589,14 +1601,21 @@
else if (EQ (key, QKbackspace)) str = "BS";
}
if (str)
- eicat_ascii (buf, str);
+ {
+ result += write_ascstring (printcharfun, str);
+ }
else
- eicat_lstr (buf, XSYMBOL (key)->name);
+ {
+ result += write_lisp_string (printcharfun, XSYMBOL (key)->name, 0,
+ XSTRING_LENGTH (XSYMBOL (key)->name));
+ }
}
else
ABORT ();
if (mouse_p)
- eicat_ascii (buf, "up");
+ result += write_ascstring (printcharfun, "up");
+
+ return result;
}
void
diff -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 src/events.h
--- a/src/events.h
+++ b/src/events.h
@@ -44,7 +44,7 @@
int (*event_pending_p) (int);
void (*next_event_cb) (Lisp_Event *);
void (*handle_magic_event_cb) (Lisp_Event *);
- void (*format_magic_event_cb) (Lisp_Event *, Lisp_Object pstream);
+ Bytecount (*format_magic_event_cb) (Lisp_Event *, Lisp_Object pstream);
int (*compare_magic_event_cb) (Lisp_Event *, Lisp_Event *);
Hashcode (*hash_magic_event_cb)(Lisp_Event *);
int (*add_timeout_cb) (EMACS_TIME);
@@ -956,8 +956,8 @@
} character_to_event_meta_behavior;
/* from events.c */
-void format_event_object (Eistring *buf, Lisp_Object event, int brief);
-/*void format_event_data_object (Eistring *buf, Lisp_Object data, int brief);*/
+Bytecount format_event_object (Lisp_Object printcharfun, Lisp_Object event,
+ Boolint brief);
void character_to_event (Ichar, Lisp_Event *, struct console *,
character_to_event_meta_behavior meta_flag,
int do_backspace_mapping);
@@ -1004,7 +1004,8 @@
Lisp_Object dequeue_dispatch_event (void);
void enqueue_magic_eval_event (void (*fun) (Lisp_Object), Lisp_Object object);
void event_stream_handle_magic_event (Lisp_Event *event);
-void event_stream_format_magic_event (Lisp_Event *event, Lisp_Object pstream);
+Bytecount event_stream_format_magic_event (Lisp_Event *event,
+ Lisp_Object pstream);
int event_stream_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2);
Hashcode event_stream_hash_magic_event (Lisp_Event *e);
void event_stream_select_console (struct console *con);
diff -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 src/gui-x.c
--- a/src/gui-x.c
+++ b/src/gui-x.c
@@ -487,14 +487,16 @@
}
else if (SYMBOLP (pgui->callback)) /* Show the binding of this command. */
{
- DECLARE_EISTRING_MALLOC (buf);
+ Ibyte buf[64];
/* #### Warning, dependency here on current_buffer and point */
- where_is_to_char (pgui->callback, buf);
- if (eilen (buf) > 0)
- wv->key = ITEXT_TO_EXTERNAL_MALLOC (eidata (buf), Qlwlib_encoding);
+ Bytecount blen = where_is_to_Ibyte (pgui->callback, buf, sizeof (buf));
+ if (blen > 0)
+ {
+ TO_EXTERNAL_FORMAT (DATA, (buf, blen), C_STRING_MALLOC, wv->key,
+ Qlwlib_encoding);
+ }
else
wv->key = 0;
- eifree (buf);
}
CHECK_SYMBOL (pgui->style);
diff -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 src/gui.c
--- a/src/gui.c
+++ b/src/gui.c
@@ -550,13 +550,13 @@
/* See if we can derive keys out of callback symbol */
if (SYMBOLP (pgui_item->callback))
{
- DECLARE_EISTRING_MALLOC (buf);
- Lisp_Object str;
-
- where_is_to_char (pgui_item->callback, buf);
- str = eimake_string (buf);
- eifree (buf);
- return str;
+ Ibyte buf[64];
+ Bytecount blen
+ = where_is_to_Ibyte (pgui_item->callback, buf, sizeof (buf));
+ if (blen > 0)
+ {
+ return make_string (buf, blen);
+ }
}
/* No keys - no right flush display */
diff -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 src/keymap.c
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -27,6 +27,8 @@
#include <config.h>
#include "lisp.h"
+#define EXPOSE_FIXED_BUFFER_INTERNALS 1
+#include "lstream.h"
#include "buffer.h"
#include "bytecode.h"
#include "console-impl.h"
@@ -3564,14 +3566,13 @@
*/
(key))
{
+ Lisp_Object stream = make_resizing_buffer_output_stream ();
+
if (SYMBOLP (key))
key = Fcons (key, Qnil); /* sleaze sleaze */
if (EVENTP (key) || CHAR_OR_CHAR_INTP (key))
{
- DECLARE_EISTRING_MALLOC (buf);
- Lisp_Object str;
-
if (!EVENTP (key))
{
Lisp_Object event = Fmake_event (Qnil, Qnil);
@@ -3579,51 +3580,47 @@
character_to_event (XCHAR (key), XEVENT (event),
XCONSOLE (Vselected_console),
high_bit_is_meta, 1);
- format_event_object (buf, event, 1);
+ format_event_object (stream, event, 1);
Fdeallocate_event (event);
}
else
- format_event_object (buf, key, 1);
- str = eimake_string (buf);
- eifree (buf);
- return str;
+ format_event_object (stream, key, 1);
+
+ return resizing_buffer_to_lisp_string (XLSTREAM (stream));
}
if (CONSP (key))
{
- DECLARE_EISTRING (bufp);
-
EXTERNAL_LIST_LOOP_3 (keysym, key, rest)
{
- if (EQ (keysym, Qcontrol)) eicat_ascii (bufp, "C-");
- else if (EQ (keysym, Qctrl)) eicat_ascii (bufp, "C-");
- else if (EQ (keysym, Qmeta)) eicat_ascii (bufp, "M-");
- else if (EQ (keysym, Qsuper)) eicat_ascii (bufp, "S-");
- else if (EQ (keysym, Qhyper)) eicat_ascii (bufp, "H-");
- else if (EQ (keysym, Qalt)) eicat_ascii (bufp, "A-");
- else if (EQ (keysym, Qshift)) eicat_ascii (bufp, "Sh-");
+ if (EQ (keysym, Qcontrol)) write_ascstring (stream, "C-");
+ else if (EQ (keysym, Qctrl)) write_ascstring (stream, "C-");
+ else if (EQ (keysym, Qmeta)) write_ascstring (stream, "M-");
+ else if (EQ (keysym, Qsuper)) write_ascstring (stream, "S-");
+ else if (EQ (keysym, Qhyper)) write_ascstring (stream, "H-");
+ else if (EQ (keysym, Qalt)) write_ascstring (stream, "A-");
+ else if (EQ (keysym, Qshift)) write_ascstring (stream, "Sh-");
else if (CHAR_OR_CHAR_INTP (keysym))
- eicat_ch (bufp, XCHAR_OR_CHAR_INT (keysym));
+ {
+ Ibyte str[MAX_ICHAR_LEN];
+
+ write_string_1 (stream, str,
+ set_itext_ichar (str,
+ XCHAR_OR_CHAR_INT (keysym)));
+ }
else
{
CHECK_SYMBOL (keysym);
-#if 0 /* This is bogus */
- if (EQ (keysym, QKlinefeed)) eicat_ascii (bufp, "LFD");
- else if (EQ (keysym, QKtab)) eicat_ascii (bufp, "TAB");
- else if (EQ (keysym, QKreturn)) eicat_ascii (bufp, "RET");
- else if (EQ (keysym, QKescape)) eicat_ascii (bufp, "ESC");
- else if (EQ (keysym, QKdelete)) eicat_ascii (bufp, "DEL");
- else if (EQ (keysym, QKspace)) eicat_ascii (bufp, "SPC");
- else if (EQ (keysym, QKbackspace)) eicat_ascii (bufp, "BS");
- else
-#endif
- eicat_lstr (bufp, XSYMBOL (keysym)->name);
+ write_lisp_string (stream, XSYMBOL (keysym)->name, 0,
+ XSTRING_LENGTH (XSYMBOL (keysym)->name));
if (!NILP (XCDR (rest)))
invalid_argument ("Invalid key description", key);
}
}
- return eimake_string (bufp);
+
+ return resizing_buffer_to_lisp_string (XLSTREAM (stream));
}
+
return Fsingle_key_description
(wrong_type_argument (intern ("char-or-event-p"), key));
}
@@ -3742,7 +3739,7 @@
static Lisp_Object
where_is_internal (Lisp_Object definition, Lisp_Object *maps, int nmaps,
- Lisp_Object firstonly, Eistring *target_buffer);
+ Lisp_Object firstonly, Lisp_Object target_buffer);
DEFUN ("where-is-internal", Fwhere_is_internal, 1, 5, 0, /*
Return list of keys that invoke DEFINITION in KEYMAPS.
@@ -3813,22 +3810,23 @@
return Qnil;
}
- return where_is_internal (definition, gubbish, nmaps, firstonly, 0);
+ return where_is_internal (definition, gubbish, nmaps, firstonly, Qnil);
}
/* This function is like
(key-description (where-is-internal definition nil t))
- except that it writes its output into a (char *) buffer that you
- provide; it doesn't cons (or allocate memory) at all, so it's
- very fast. This is used by menubar.c.
- */
-void
-where_is_to_char (Lisp_Object definition, Eistring *buffer)
+
+ except that it writes its output into an (Ibyte *) buffer that you
+ provide; it doesn't allocate heap memory for this, so it's fast. This is
+ used by GUI code when generating menu entries. */
+Bytecount
+where_is_to_Ibyte (Lisp_Object definition, Ibyte *buffer, Bytecount bufsize)
{
/* This function can GC */
- Lisp_Object maps[100];
+ Lisp_Object maps[100], result;
Lisp_Object *gubbish = maps;
int nmaps;
+ DECLARE_STACK_FIXED_BUFFER_LSTREAM (stream);
/* Get keymaps as an array */
nmaps = get_relevant_keymaps (Qnil, Qnil, countof (maps), gubbish);
@@ -3838,10 +3836,38 @@
nmaps = get_relevant_keymaps (Qnil, Qnil, nmaps, gubbish);
}
- where_is_internal (definition, maps, nmaps, Qt, buffer);
+ INIT_STACK_FIXED_BUFFER_OUTPUT_STREAM (stream, buffer, bufsize);
+
+ result = where_is_internal (definition, maps, nmaps, Qt, stream);
+
+ if (NILP (result))
+ {
+ return 0;
+ }
+
+ if (XFIXNUM (result) >= bufsize)
+ {
+ Ibyte *bufp = buffer + bufsize;
+ unsigned jj = 0;
+
+ while (jj < sizeof (" ..."))
+ {
+ DEC_IBYTEPTR (bufp);
+ jj++;
+ }
+
+ bufp += set_itext_ichar (bufp, ' ');
+ bufp += set_itext_ichar (bufp, '.');
+ bufp += set_itext_ichar (bufp, '.');
+ bufp += set_itext_ichar (bufp, '.');
+ bufp += set_itext_ichar (bufp, 0);
+ return bufp - ichar_len (0) - buffer;
+ }
+
+ return XREALFIXNUM (result); /* Return the amount of space it would have
+ taken, on the model of snprintf(). */
}
-
static Lisp_Object
raw_keys_to_keys (Lisp_Key_Data *keys, int count)
{
@@ -3851,11 +3877,11 @@
return result;
}
-
-static void
-format_raw_keys (Lisp_Key_Data *keys, int count, Eistring *buf)
+static Bytecount
+format_raw_keys (Lisp_Key_Data *keys, int count, Lisp_Object stream)
{
int i;
+ Bytecount result = 0;
Lisp_Object event = Fmake_event (Qnil, Qnil);
XSET_EVENT_TYPE (event, key_press_event);
XSET_EVENT_CHANNEL (event, Vselected_console);
@@ -3863,11 +3889,15 @@
{
XSET_EVENT_KEY_KEYSYM (event, keys[i].keysym);
XSET_EVENT_KEY_MODIFIERS (event, KEY_DATA_MODIFIERS (&keys[i]));
- format_event_object (buf, event, 1);
+ result += format_event_object (stream, event, 1);
if (i < count - 1)
- eicat_ascii (buf, " ");
+ {
+ result += write_ascstring (stream, " ");
+ }
}
Fdeallocate_event (event);
+
+ return result;
}
@@ -3887,7 +3917,7 @@
(keys_so_far is a global buffer and the keys_count arg says how much
of it we're currently interested in.)
- If target_buffer is provided, then we write a key-description into it,
+ If target_buffer is non-nil, then we write a key-description into it,
to avoid consing a string. This only works with firstonly on.
*/
@@ -3899,7 +3929,7 @@
int firstonly;
int keys_count;
int modifiers_so_far;
- Eistring *target_buffer;
+ Lisp_Object target_buffer;
Lisp_Key_Data *keys_so_far;
int keys_so_far_total_size;
int keys_so_far_malloced;
@@ -3916,7 +3946,7 @@
const int firstonly = c->firstonly;
const int keys_count = c->keys_count;
const int modifiers_so_far = c->modifiers_so_far;
- Eistring *target_buffer = c->target_buffer;
+ Lisp_Object target_buffer = c->target_buffer;
Lisp_Object keys = Fgethash (definition,
XKEYMAP (map)->inverse_table,
Qnil);
@@ -3957,11 +3987,14 @@
}
/* OK, the key is for real */
- if (target_buffer)
+ if (!NILP (target_buffer))
{
+ Bytecount blen
+ = format_raw_keys (so_far, keys_count + 1, target_buffer);
+ /* Don't include the trailing ?\x00 in the bytecount. */
+ write_string_1 (target_buffer, (const Ibyte *) "\0", 1);
assert (firstonly);
- format_raw_keys (so_far, keys_count + 1, target_buffer);
- return Qone;
+ return make_fixnum (blen);
}
else if (firstonly)
return raw_keys_to_keys (so_far, keys_count + 1);
@@ -4072,7 +4105,7 @@
static Lisp_Object
where_is_internal (Lisp_Object definition, Lisp_Object *maps, int nmaps,
- Lisp_Object firstonly, Eistring *target_buffer)
+ Lisp_Object firstonly, Lisp_Object target_buffer)
{
/* This function can GC */
Lisp_Object result = Qnil;
diff -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 src/lisp.h
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -5663,7 +5663,7 @@
EXFUN (Fmake_sparse_keymap, 1);
EXFUN (Fset_keymap_parents, 2);
-void where_is_to_char (Lisp_Object, Eistring *);
+Bytecount where_is_to_Ibyte (Lisp_Object, Ibyte *, Bytecount);
/* Defined in lread.c */
EXFUN (Fread, 1);
diff -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 src/lstream.h
--- a/src/lstream.h
+++ b/src/lstream.h
@@ -572,7 +572,7 @@
} lname##u; \
Lisp_Object lname = wrap_pointer_1 (&(lname##u.l)) \
-#define INIT_STACK_FIXED_BUFFER_OUTPUT_STREAM(lname, buf, size) do \
+#define INIT_STACK_FIXED_BUFFER_OUTPUT_STREAM(lname, buf, bsize) do \
{ \
memset (lname##u.s, 0, max (sizeof (lname##u.s), \
sizeof (lname##u.l))); \
@@ -583,7 +583,7 @@
lname##u.l.flags = LSTR_IS_OPEN; \
lname##u.l.flags |= LSTR_WRITE; \
FIXED_BUFFER_STREAM_DATA (&(lname##u.l))->outbuf = buf; \
- FIXED_BUFFER_STREAM_DATA (&(lname##u.l))->size = size; \
+ FIXED_BUFFER_STREAM_DATA (&(lname##u.l))->size = bsize; \
} while (0)
#endif
diff -r 714a6e9c1669a4ed929d87438abe9886a1c77f81 -r 27f66ce6ab71265a93bc8c1bf642225f41b2a701 src/menubar-gtk.c
--- a/src/menubar-gtk.c
+++ b/src/menubar-gtk.c
@@ -736,20 +736,19 @@
}
else if (SYMBOLP (callback))
{
- DECLARE_EISTRING_MALLOC (buf);
-
+ Ibyte buf[64];
/* #### Warning, dependency here on current_buffer and point */
- where_is_to_char (callback, buf);
+ Bytecount blen
+ = where_is_to_Ibyte (callback, buf, sizeof (buf));
- if (eilen (buf) > 0)
- keys = eimake_string (buf);
+ if (blen > 0)
+ {
+ keys = make_string (buf, blen);
+ }
else
{
-
keys = Qnil;
}
-
- eifree (buf);
}
}
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: kehoea: Check for a leading * before deleting it,
#'hyper-apropos-grok-variables
6 years, 12 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/296ee062f9f9/
Changeset: 296ee062f9f9
User: kehoea
Date: 2017-12-25 11:34:22+00:00
Summary: Check for a leading * before deleting it, #'hyper-apropos-grok-variables
lisp/ChangeLog addition:
2017-12-25 Aidan Kehoe <kehoea(a)parhasard.net>
* hyper-apropos.el (hyper-apropos-grok-variables):
User variables' docstrings do not necessarily start with *, check
for one before removing the first character from the output.
Affected #: 2 files
diff -r 75597c755b6716ef4ffa782f37650dd48792d6ea -r 296ee062f9f9ce4957f6aa450a2b4ad7fb57935c lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2017-12-25 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * hyper-apropos.el (hyper-apropos-grok-variables):
+ User variables' docstrings do not necessarily start with *, check
+ for one before removing the first character from the output.
+
2017-12-24 Aidan Kehoe <kehoea(a)parhasard.net>
* test-harness.el (test-harness-from-buffer):
diff -r 75597c755b6716ef4ffa782f37650dd48792d6ea -r 296ee062f9f9ce4957f6aa450a2b4ad7fb57935c lisp/hyper-apropos.el
--- a/lisp/hyper-apropos.el
+++ b/lisp/hyper-apropos.el
@@ -380,7 +380,13 @@
(string-match "\\`\n+" doc))
(setq doc (substring doc (match-end 0))))
(insert-face (if doc
- (concat " - " (subseq doc (if userp 1 0)
+ (concat " - " (subseq doc
+ (or
+ (and userp
+ (position ?* doc
+ :test-not
+ #'eq))
+ 0)
(position ?\n doc)))
" - Not documented.")
'hyper-apropos-documentation)))
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: kehoea: Call `Skip-Test-Unless' correctly,
mule-test.el.
6 years, 12 months
Bitbucket
1 new commit in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/75597c755b67/
Changeset: 75597c755b67
User: kehoea
Date: 2017-12-24 14:16:37+00:00
Summary: Call `Skip-Test-Unless' correctly, mule-test.el.
lisp/ChangeLog addition:
2017-12-24 Aidan Kehoe <kehoea(a)parhasard.net>
* test-harness.el (test-harness-from-buffer):
Error in `Skip-Test-Unless' if BODY is not specified.
tests/ChangeLog addition:
2017-12-24 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/mule-tests.el:
Call Skip-Test-Unless correctly for #'test-chars, thank you
Stephen Turnbull.
Affected #: 4 files
diff -r b5c15ce519c23670ffba7da0c365f5044e137d90 -r 75597c755b6716ef4ffa782f37650dd48792d6ea lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2017-12-24 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * test-harness.el (test-harness-from-buffer):
+ Error in `Skip-Test-Unless' if BODY is not specified.
+
2017-12-22 Aidan Kehoe <kehoea(a)parhasard.net>
* descr-text.el (describe-char-unicodedata-file):
diff -r b5c15ce519c23670ffba7da0c365f5044e137d90 -r 75597c755b6716ef4ffa782f37650dd48792d6ea lisp/test-harness.el
--- a/lisp/test-harness.el
+++ b/lisp/test-harness.el
@@ -379,6 +379,7 @@
REASON is a description of the condition failure, and must be unique (it
is used as a hash key). DESCRIPTION describes the tests that were skipped.
BODY is a sequence of expressions and may contain several tests."
+ (or body (error 'syntax-error "BODY omitted in `skip-test-unless'"))
`(if (not ,condition)
(let ((count (gethash ,reason skipped-test-reasons)))
(puthash ,reason (if (null count) 1 (1+ count))
diff -r b5c15ce519c23670ffba7da0c365f5044e137d90 -r 75597c755b6716ef4ffa782f37650dd48792d6ea tests/ChangeLog
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,9 @@
+2017-12-24 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * automated/mule-tests.el:
+ Call Skip-Test-Unless correctly for #'test-chars, thank you
+ Stephen Turnbull.
+
2017-12-02 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/keymap-tests.el:
diff -r b5c15ce519c23670ffba7da0c365f5044e137d90 -r 75597c755b6716ef4ffa782f37650dd48792d6ea tests/automated/mule-tests.el
--- a/tests/automated/mule-tests.el
+++ b/tests/automated/mule-tests.el
@@ -85,6 +85,7 @@
;; and the string means I run out of memory when I attempt to run this.
(<= char-code-limit #x200000)
"CHAR-CODE-LIMIT is impractically large"
+ "check that all existing characters can be inserted into a buffer"
;; Run #'test-chars in byte-compiled mode only.
(and (compiled-function-p (symbol-function 'test-chars)) (test-chars t)))
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
commit/XEmacs: 2 new changesets
7 years
Bitbucket
2 new commits in XEmacs:
https://bitbucket.org/xemacs/xemacs/commits/ee0c60ee6616/
Changeset: ee0c60ee6616
User: kehoea
Date: 2017-12-22 21:28:32+00:00
Summary: Don't crash in redisplay with Ethiopic and error-checking.
src/ChangeLog addition:
2017-12-22 Aidan Kehoe <kehoea(a)parhasard.net>
* redisplay-x.c (separate_textual_runs_mule):
The output of a charset's CCL program is just two octets, it is
incorrect and buggy to transform it to an "external charset
codepoint", something that will usually error in redisplay. Remove
this unicode-internal change from Ben.
Affected #: 2 files
diff -r 46efc7173defd0f4f41bd8f3819970c4876c551a -r ee0c60ee6616be2b917712a649809b8f6e5e2d06 src/ChangeLog
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2017-12-22 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * redisplay-x.c (separate_textual_runs_mule):
+ The output of a charset's CCL program is just two octets, it is
+ incorrect and buggy to transform it to an "external charset
+ codepoint", something that will usually error in redisplay. Remove
+ this unicode-internal change from Ben.
+
2017-12-20 Aidan Kehoe <kehoea(a)parhasard.net>
Use Lisp characters as the keysym for event objects reflecting
diff -r 46efc7173defd0f4f41bd8f3819970c4876c551a -r ee0c60ee6616be2b917712a649809b8f6e5e2d06 src/redisplay-x.c
--- a/src/redisplay-x.c
+++ b/src/redisplay-x.c
@@ -357,9 +357,6 @@
ccl_driver (&char_converter, 0, buf, 0, 0, 0, CCL_MODE_ENCODING);
byte1 = char_converter.reg[1];
byte2 = char_converter.reg[2];
- get_external_charset_codepoint (charset, make_fixnum (byte1),
- make_fixnum (byte2),
- &byte1, &byte2, 1);
}
else if (EQ (charset, Vcharset_ascii) && byte2 != CANT_DISPLAY_CHAR)
{
https://bitbucket.org/xemacs/xemacs/commits/b5c15ce519c2/
Changeset: b5c15ce519c2
User: kehoea
Date: 2017-12-22 21:39:11+00:00
Summary: Use the UnicodeData.txt installed with TeX if available, descr-text.el
lisp/ChangeLog addition:
2017-12-22 Aidan Kehoe <kehoea(a)parhasard.net>
* descr-text.el (describe-char-unicodedata-file):
The UnicodeData.txt installed with Perl no longer serves our
needs. Use that installed by TeX instead, if available.
Affected #: 2 files
diff -r ee0c60ee6616be2b917712a649809b8f6e5e2d06 -r b5c15ce519c23670ffba7da0c365f5044e137d90 lisp/ChangeLog
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2017-12-22 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * descr-text.el (describe-char-unicodedata-file):
+ The UnicodeData.txt installed with Perl no longer serves our
+ needs. Use that installed by TeX instead, if available.
+
2017-12-22 Aidan Kehoe <kehoea(a)parhasard.net>
* compose.el: Rename from x-compose.el, it's not
diff -r ee0c60ee6616be2b917712a649809b8f6e5e2d06 -r b5c15ce519c23670ffba7da0c365f5044e137d90 lisp/descr-text.el
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -208,31 +208,20 @@
(describe-property-list properties)))))
(defcustom describe-char-unicodedata-file
- ;; XEmacs change; initialise this by default, using Perl.
- (let ((have-perl
+ ;; XEmacs change; initialise this by default, using TeX.
+ (let ((have-kpsewhich
(member-if
#'(lambda (path)
- (file-exists-p (format "%s%cperl" path directory-sep-char)))
+ (file-exists-p (format "%s%ckpsewhich" path directory-sep-char)))
exec-path))
- installprivlib res)
- (when have-perl
- (setq installprivlib
+ path)
+ (when have-kpsewhich
+ (setq path
(with-string-as-buffer-contents ""
- (shell-command "perl -V:installprivlib" t)
- ;; 1+ because buffer offsets start at one.
- (delete-region 1 (1+ (length "installprivlib='")))
- ;; Delete the final newline, semicolon and quotation mark.
- (delete-region (- (point-max) 3) (point-max))))
- (cond
- ((file-exists-p
- (setq res
- (format "%s%cunicore%cUnicodeData.txt"
- installprivlib directory-sep-char directory-sep-char))))
- ((file-exists-p
- (setq res
- (format "%s%cunicode%cUnicodeData.txt"
- installprivlib directory-sep-char directory-sep-char)))))
- res))
+ (shell-command "kpsewhich UnicodeData.txt" t)
+ ;; Delete the final newline
+ (delete-region (- (point-max) 1) (point-max))))
+ (if (file-exists-p path) path)))
"Location of Unicode data file.
This is the UnicodeData.txt file from the Unicode Consortium, used for
diagnostics. If it is non-nil `describe-char' will print data
Repository URL: https://bitbucket.org/xemacs/xemacs/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.