diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/keymap.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/src/keymap.c b/src/keymap.c index 295b209f06b..a01dee1476b 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -1721,33 +1721,12 @@ means to return the active maps for that window's buffer. */) | |||
| 1721 | /* For a mouse click, get the local text-property keymap | 1721 | /* For a mouse click, get the local text-property keymap |
| 1722 | of the place clicked on, rather than point. */ | 1722 | of the place clicked on, rather than point. */ |
| 1723 | 1723 | ||
| 1724 | if (POSN_INBUFFER_P (position)) | 1724 | local_map = Qnil; |
| 1725 | { | 1725 | keymap = Qnil; |
| 1726 | Lisp_Object pos = POSN_BUFFER_POSN (position); | ||
| 1727 | if (FIXNUMP (pos) | ||
| 1728 | && XFIXNUM (pos) >= BEG && XFIXNUM (pos) <= Z) | ||
| 1729 | { | ||
| 1730 | local_map = get_local_map (XFIXNUM (pos), | ||
| 1731 | current_buffer, Qlocal_map); | ||
| 1732 | |||
| 1733 | keymap = get_local_map (XFIXNUM (pos), | ||
| 1734 | current_buffer, Qkeymap); | ||
| 1735 | } | ||
| 1736 | } | ||
| 1737 | |||
| 1738 | Lisp_Object pos_area = POSN_POSN (position); | ||
| 1739 | if (EQ (pos_area, Qmode_line) || EQ (pos_area, Qheader_line)) | ||
| 1740 | { | ||
| 1741 | /* For clicks on mode line or header line, ignore the maps | ||
| 1742 | we found at POSITION, because properties at point are | ||
| 1743 | not relevant in that case. */ | ||
| 1744 | local_map = Qnil; | ||
| 1745 | keymap = Qnil; | ||
| 1746 | } | ||
| 1747 | 1726 | ||
| 1748 | /* If on a mode line string with a local keymap, or for a | 1727 | /* If on a mode line string with a local keymap, or for a |
| 1749 | click on a string, i.e. overlay string or a string | 1728 | click on a string, i.e. overlay string or a string |
| 1750 | displayed via the `display' property, consider only the | 1729 | displayed via the `display' property, first consider the |
| 1751 | `local-map' and `keymap' properties of that string. */ | 1730 | `local-map' and `keymap' properties of that string. */ |
| 1752 | 1731 | ||
| 1753 | if (CONSP (string) && STRINGP (XCAR (string))) | 1732 | if (CONSP (string) && STRINGP (XCAR (string))) |
| @@ -1763,6 +1742,26 @@ means to return the active maps for that window's buffer. */) | |||
| 1763 | } | 1742 | } |
| 1764 | } | 1743 | } |
| 1765 | 1744 | ||
| 1745 | Lisp_Object buffer_posn = POSN_BUFFER_POSN (position); | ||
| 1746 | /* Then, if the click was in the buffer, get the local | ||
| 1747 | text-property keymap of the place clicked on. */ | ||
| 1748 | |||
| 1749 | if (FIXNUMP (buffer_posn) | ||
| 1750 | && XFIXNUM (buffer_posn) >= BEG && XFIXNUM (buffer_posn) <= Z) | ||
| 1751 | { | ||
| 1752 | /* The properties in POSN_STRING take precedence, if set. */ | ||
| 1753 | if (NILP (local_map)) | ||
| 1754 | local_map = get_local_map (XFIXNUM (buffer_posn), | ||
| 1755 | current_buffer, Qlocal_map); | ||
| 1756 | |||
| 1757 | if (NILP (keymap)) | ||
| 1758 | keymap = get_local_map (XFIXNUM (buffer_posn), | ||
| 1759 | current_buffer, Qkeymap); | ||
| 1760 | } | ||
| 1761 | |||
| 1762 | /* Finally, fall back on the buffer's local map. */ | ||
| 1763 | if (NILP (local_map)) | ||
| 1764 | local_map = BVAR (current_buffer, keymap); | ||
| 1766 | } | 1765 | } |
| 1767 | 1766 | ||
| 1768 | if (!NILP (local_map)) | 1767 | if (!NILP (local_map)) |