diff options
| author | Gerd Moellmann | 2001-03-09 18:43:47 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-03-09 18:43:47 +0000 |
| commit | db14cfc5157c723d30f6437b1eca80e25574d094 (patch) | |
| tree | 37faa74472b82d4995b5a70849273c2ae793aa3c /src | |
| parent | 7177d86b4b1036744c67a3c746facf24249d5757 (diff) | |
| download | emacs-db14cfc5157c723d30f6437b1eca80e25574d094.tar.gz emacs-db14cfc5157c723d30f6437b1eca80e25574d094.zip | |
(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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 13 | ||||
| -rw-r--r-- | src/keyboard.c | 35 |
2 files changed, 48 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b2ff4d07973..06dac9fc64e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,18 @@ | |||
| 1 | 2001-03-09 Gerd Moellmann <gerd@gnu.org> | 1 | 2001-03-09 Gerd Moellmann <gerd@gnu.org> |
| 2 | 2 | ||
| 3 | * dispextern.h (string_buffer_position): Add prototype. | ||
| 4 | |||
| 5 | * xdisp.c (string_buffer_position, display_prop_string_p) | ||
| 6 | (single_display_prop_string_p): New functions. | ||
| 7 | |||
| 8 | * xterm.c (note_mouse_highlight): If there's no help-echo on | ||
| 9 | a string, look at the buffer text ``under'' it. | ||
| 10 | |||
| 11 | * keyboard.c (make_lispy_event): Add string info to the event, | ||
| 12 | analogous to what's done on mode lines. | ||
| 13 | (read_key_sequence): For a click on a string, consider `local-map' | ||
| 14 | and `keymap' of that string. | ||
| 15 | |||
| 3 | * keyboard.c (make_lispy_event, make_lispy_movement): Adjust | 16 | * keyboard.c (make_lispy_event, make_lispy_movement): Adjust |
| 4 | calls to buffer_posn_from_coords to new format. | 17 | calls to buffer_posn_from_coords to new format. |
| 5 | 18 | ||
diff --git a/src/keyboard.c b/src/keyboard.c index a73936e9198..3c01af43475 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -4782,6 +4782,10 @@ make_lispy_event (event) | |||
| 4782 | struct display_pos p; | 4782 | struct display_pos p; |
| 4783 | buffer_posn_from_coords (w, &wx, &wy, &object, &p); | 4783 | buffer_posn_from_coords (w, &wx, &wy, &object, &p); |
| 4784 | posn = make_number (CHARPOS (p.pos)); | 4784 | posn = make_number (CHARPOS (p.pos)); |
| 4785 | if (STRINGP (object)) | ||
| 4786 | string_info | ||
| 4787 | = Fcons (object, | ||
| 4788 | make_number (CHARPOS (p.string_pos))); | ||
| 4785 | } | 4789 | } |
| 4786 | } | 4790 | } |
| 4787 | 4791 | ||
| @@ -7769,6 +7773,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 7769 | int can_return_switch_frame; | 7773 | int can_return_switch_frame; |
| 7770 | int fix_current_buffer; | 7774 | int fix_current_buffer; |
| 7771 | { | 7775 | { |
| 7776 | volatile Lisp_Object from_string; | ||
| 7772 | volatile int count = specpdl_ptr - specpdl; | 7777 | volatile int count = specpdl_ptr - specpdl; |
| 7773 | 7778 | ||
| 7774 | /* How many keys there are in the current key sequence. */ | 7779 | /* How many keys there are in the current key sequence. */ |
| @@ -7922,6 +7927,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, | |||
| 7922 | 7927 | ||
| 7923 | orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); | 7928 | orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); |
| 7924 | orig_keymap = get_local_map (PT, current_buffer, Qkeymap); | 7929 | orig_keymap = get_local_map (PT, current_buffer, Qkeymap); |
| 7930 | from_string = Qnil; | ||
| 7925 | 7931 | ||
| 7926 | /* We jump here when the key sequence has been thoroughly changed, and | 7932 | /* We jump here when the key sequence has been thoroughly changed, and |
| 7927 | we need to rescan it starting from the beginning. When we jump here, | 7933 | 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, | |||
| 8326 | 8332 | ||
| 8327 | goto replay_key; | 8333 | goto replay_key; |
| 8328 | } | 8334 | } |
| 8335 | else if (CONSP (POSN_STRING (EVENT_START (key))) | ||
| 8336 | && NILP (from_string)) | ||
| 8337 | { | ||
| 8338 | /* For a click on a string, i.e. overlay string or a | ||
| 8339 | string displayed via the `display' property, | ||
| 8340 | consider `local-map' and `keymap' properties of | ||
| 8341 | that string. */ | ||
| 8342 | Lisp_Object string, pos, map, map2; | ||
| 8343 | |||
| 8344 | string = POSN_STRING (EVENT_START (key)); | ||
| 8345 | pos = XCDR (string); | ||
| 8346 | string = XCAR (string); | ||
| 8347 | if (XINT (pos) >= 0 | ||
| 8348 | && XINT (pos) < XSTRING (string)->size) | ||
| 8349 | { | ||
| 8350 | map = Fget_text_property (pos, Qlocal_map, string); | ||
| 8351 | if (!NILP (map)) | ||
| 8352 | orig_local_map = map; | ||
| 8353 | map2 = Fget_text_property (pos, Qkeymap, string); | ||
| 8354 | if (!NILP (map2)) | ||
| 8355 | orig_keymap = map2; | ||
| 8356 | |||
| 8357 | if (!NILP (map) || !NILP (map2)) | ||
| 8358 | { | ||
| 8359 | from_string = string; | ||
| 8360 | goto replay_sequence; | ||
| 8361 | } | ||
| 8362 | } | ||
| 8363 | } | ||
| 8329 | } | 8364 | } |
| 8330 | else if (CONSP (XCDR (key)) | 8365 | else if (CONSP (XCDR (key)) |
| 8331 | && CONSP (EVENT_START (key)) | 8366 | && CONSP (EVENT_START (key)) |