summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2001-03-09 18:43:47 +0000
committerGerd Moellmann <gerd@gnu.org>2001-03-09 18:43:47 +0000
commitdb14cfc5157c723d30f6437b1eca80e25574d094 (patch)
tree37faa74472b82d4995b5a70849273c2ae793aa3c /src
parent7177d86b4b1036744c67a3c746facf24249d5757 (diff)
downloademacs-db14cfc5157c723d30f6437b1eca80e25574d094.tar.gz
(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/ChangeLog13
-rw-r--r--src/keyboard.c35
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 @@
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.
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)
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))