1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-24 15:22:26 -07:00

(make_lispy_event): Add string info to the event,

analogous to what's done on mode lines.
(read_key_sequence): For a click on a string, consider `local-map'
and `keymap' of that string.
This commit is contained in:
Gerd Moellmann 2001-03-09 18:43:47 +00:00
parent 7177d86b4b
commit db14cfc515
2 changed files with 48 additions and 0 deletions

View file

@ -1,5 +1,18 @@
2001-03-09 Gerd Moellmann <gerd@gnu.org>
* dispextern.h (string_buffer_position): Add prototype.
* xdisp.c (string_buffer_position, display_prop_string_p)
(single_display_prop_string_p): New functions.
* xterm.c (note_mouse_highlight): If there's no help-echo on
a string, look at the buffer text ``under'' it.
* keyboard.c (make_lispy_event): Add string info to the event,
analogous to what's done on mode lines.
(read_key_sequence): For a click on a string, consider `local-map'
and `keymap' of that string.
* keyboard.c (make_lispy_event, make_lispy_movement): Adjust
calls to buffer_posn_from_coords to new format.

View file

@ -4782,6 +4782,10 @@ make_lispy_event (event)
struct display_pos p;
buffer_posn_from_coords (w, &wx, &wy, &object, &p);
posn = make_number (CHARPOS (p.pos));
if (STRINGP (object))
string_info
= Fcons (object,
make_number (CHARPOS (p.string_pos)));
}
}
@ -7769,6 +7773,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
int can_return_switch_frame;
int fix_current_buffer;
{
volatile Lisp_Object from_string;
volatile int count = specpdl_ptr - specpdl;
/* How many keys there are in the current key sequence. */
@ -7922,6 +7927,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
orig_local_map = get_local_map (PT, current_buffer, Qlocal_map);
orig_keymap = get_local_map (PT, current_buffer, Qkeymap);
from_string = Qnil;
/* We jump here when the key sequence has been thoroughly changed, and
we need to rescan it starting from the beginning. When we jump here,
@ -8326,6 +8332,35 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
goto replay_key;
}
else if (CONSP (POSN_STRING (EVENT_START (key)))
&& NILP (from_string))
{
/* For a click on a string, i.e. overlay string or a
string displayed via the `display' property,
consider `local-map' and `keymap' properties of
that string. */
Lisp_Object string, pos, map, map2;
string = POSN_STRING (EVENT_START (key));
pos = XCDR (string);
string = XCAR (string);
if (XINT (pos) >= 0
&& XINT (pos) < XSTRING (string)->size)
{
map = Fget_text_property (pos, Qlocal_map, string);
if (!NILP (map))
orig_local_map = map;
map2 = Fget_text_property (pos, Qkeymap, string);
if (!NILP (map2))
orig_keymap = map2;
if (!NILP (map) || !NILP (map2))
{
from_string = string;
goto replay_sequence;
}
}
}
}
else if (CONSP (XCDR (key))
&& CONSP (EVENT_START (key))