Mercurial > hg > xemacs-beta
comparison src/minibuf.c @ 5803:b79e1e02bf01
Preserve extent information in the command builder code.
src/ChangeLog addition:
2014-07-14 Aidan Kehoe <kehoea@parhasard.net>
* event-stream.c:
* event-stream.c (mark_command_builder):
* event-stream.c (finalize_command_builder): Removed.
* event-stream.c (allocate_command_builder):
* event-stream.c (free_command_builder): Removed. Use
free_normal_lisp_object() instead.
* event-stream.c (echo_key_event):
* event-stream.c (regenerate_echo_keys_from_this_command_keys):
Detach all extents here.
* event-stream.c (maybe_echo_keys):
* event-stream.c (reset_key_echo):
* event-stream.c (execute_help_form):
* event-stream.c (Fnext_event):
* event-stream.c (command_builder_find_leaf_no_jit_binding):
* event-stream.c (command_builder_find_leaf):
* event-stream.c (lookup_command_event):
* events.h (struct command_builder):
Move the command builder's echo_buf to being a Lisp string rather
than a malloced Ibyte array. This allows passing through extent
information, which was previously dropped. It also simplifies the
allocation and release code for the command builder.
Rename echo_buf_index to echo_buf_fill_pointer, better reflecting
its function.
Don't rely on zero-termination (something not particularly
compatible with Lisp-level code) when showing a substring of
echo_buf that differs from that designated by
echo_buf_fill_pointer, keep a separate counter instead and use
that.
* minibuf.c:
* minibuf.c (echo_area_append):
Use the new START and END keyword arguments to #'append-message,
rather than consing a new string for basically every #'next-event
prompt displayed.
test/ChangeLog addition:
2014-07-14 Aidan Kehoe <kehoea@parhasard.net>
* automated/extent-tests.el:
Check that extent information is passed through to the echo area
correctly with #'next-event's PROMPT argument.
lisp/ChangeLog addition:
2014-07-14 Aidan Kehoe <kehoea@parhasard.net>
* simple.el (raw-append-message):
Use #'write-sequence in this, take its START and END keyword
arguments, so our callers don't have to cons as much.
* simple.el (append-message):
Pass through START and END here.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Mon, 14 Jul 2014 13:42:42 +0100 |
parents | daf5accfe973 |
children |
comparison
equal
deleted
inserted
replaced
5802:236e4afc565d | 5803:b79e1e02bf01 |
---|---|
32 #include "console-stream.h" | 32 #include "console-stream.h" |
33 #include "events.h" | 33 #include "events.h" |
34 #include "frame-impl.h" | 34 #include "frame-impl.h" |
35 #include "insdel.h" | 35 #include "insdel.h" |
36 #include "redisplay.h" | 36 #include "redisplay.h" |
37 #include "text.h" | |
37 #include "window-impl.h" | 38 #include "window-impl.h" |
38 #include "elhash.h" | 39 #include "elhash.h" |
39 | 40 |
40 /* Depth in minibuffer invocations. */ | 41 /* Depth in minibuffer invocations. */ |
41 int minibuf_level; | 42 int minibuf_level; |
840 echo_area_append (struct frame *f, const Ibyte *nonreloc, Lisp_Object reloc, | 841 echo_area_append (struct frame *f, const Ibyte *nonreloc, Lisp_Object reloc, |
841 Bytecount offset, Bytecount length, | 842 Bytecount offset, Bytecount length, |
842 Lisp_Object label) | 843 Lisp_Object label) |
843 { | 844 { |
844 /* This function can call lisp */ | 845 /* This function can call lisp */ |
845 Lisp_Object obj; | |
846 struct gcpro gcpro1; | |
847 Lisp_Object frame; | |
848 | |
849 /* There is an inlining bug in egcs-20000131 c++ that can be worked | 846 /* There is an inlining bug in egcs-20000131 c++ that can be worked |
850 around as follows: */ | 847 around as follows: */ |
851 #if defined (__GNUC__) && defined (__cplusplus) | 848 #if defined (__GNUC__) && defined (__cplusplus) |
852 alloca (4); | 849 alloca (4); |
853 #endif | 850 #endif |
862 | 859 |
863 /* also check it here, in case the string was really blank. */ | 860 /* also check it here, in case the string was really blank. */ |
864 if (length == 0) | 861 if (length == 0) |
865 return; | 862 return; |
866 | 863 |
867 if (!NILP (Ffboundp (Qappend_message))) | 864 if (!UNBOUNDP (XSYMBOL_FUNCTION (Qappend_message))) |
868 { | 865 { |
869 if (STRINGP (reloc) && offset == 0 && length == XSTRING_LENGTH (reloc)) | 866 Lisp_Object obj |
870 obj = reloc; | 867 = STRINGP (reloc) ? reloc : make_string (nonreloc + offset, length); |
871 else | 868 Lisp_Object args[] = { Qappend_message, label, obj, wrap_frame (f), |
872 { | 869 EQ (label, Qprint) ? Qt : Qnil, Q_start, Qzero, |
873 if (STRINGP (reloc)) | 870 Q_end, Qnil }; |
874 nonreloc = XSTRING_DATA (reloc); | 871 struct gcpro gcpro1; |
875 obj = make_string (nonreloc + offset, length); | 872 |
876 } | 873 if (STRINGP (reloc) |
877 | 874 && (offset != 0 || length != XSTRING_LENGTH (reloc))) |
878 frame = wrap_frame (f); | 875 { |
879 GCPRO1 (obj); | 876 assert (EQ (args[5], Q_start)); |
880 call4 (Qappend_message, label, obj, frame, | 877 args[6] = make_fixnum (string_index_byte_to_char (reloc, offset)); |
881 EQ (label, Qprint) ? Qt : Qnil); | 878 assert (EQ (args[7], Q_end)); |
879 args[8] | |
880 = make_fixnum (string_index_byte_to_char (reloc, offset + length)); | |
881 } | |
882 GCPRO1 (args[0]); | |
883 gcpro1.nvars = countof (args); | |
884 Ffuncall (countof (args), args); | |
882 UNGCPRO; | 885 UNGCPRO; |
883 } | 886 } |
884 else | 887 else |
885 { | 888 { |
886 if (STRINGP (reloc)) | 889 if (STRINGP (reloc)) |