diff options
| author | Karl Heuer | 1995-05-02 23:06:11 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-05-02 23:06:11 +0000 |
| commit | 0f7a5fda790a610fe0365479eed19b6a92a13092 (patch) | |
| tree | c77546620454e5aef6a55d80516cad20f4b8c5c7 /src | |
| parent | 60f4dd23c351b4554d77edb2986854ffc43a842f (diff) | |
| download | emacs-0f7a5fda790a610fe0365479eed19b6a92a13092.tar.gz emacs-0f7a5fda790a610fe0365479eed19b6a92a13092.zip | |
(get_local_map): Use Fget_char_property, so that
overlay properties will be considered as well as text properties.
Diffstat (limited to 'src')
| -rw-r--r-- | src/intervals.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/intervals.c b/src/intervals.c index 26fcfd9e701..bf51d14d1cd 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -1762,24 +1762,34 @@ get_local_map (position, buffer) | |||
| 1762 | register int position; | 1762 | register int position; |
| 1763 | register struct buffer *buffer; | 1763 | register struct buffer *buffer; |
| 1764 | { | 1764 | { |
| 1765 | register INTERVAL interval; | 1765 | Lisp_Object prop, tem, lispy_position, lispy_buffer; |
| 1766 | Lisp_Object prop, tem; | 1766 | int old_begv, old_zv; |
| 1767 | |||
| 1768 | if (NULL_INTERVAL_P (BUF_INTERVALS (buffer))) | ||
| 1769 | return buffer->keymap; | ||
| 1770 | 1767 | ||
| 1771 | /* Perhaps we should just change `position' to the limit. */ | 1768 | /* Perhaps we should just change `position' to the limit. */ |
| 1772 | if (position > BUF_Z (buffer) || position < BUF_BEG (buffer)) | 1769 | if (position > BUF_Z (buffer) || position < BUF_BEG (buffer)) |
| 1773 | abort (); | 1770 | abort (); |
| 1774 | 1771 | ||
| 1775 | interval = find_interval (BUF_INTERVALS (buffer), position); | 1772 | /* Ignore narrowing, so that a local map continues to be valid even if |
| 1776 | prop = textget (interval->plist, Qlocal_map); | 1773 | the visible region contains no characters and hence no properties. */ |
| 1777 | if (NILP (prop)) | 1774 | old_begv = BUF_BEGV (buffer); |
| 1778 | return buffer->keymap; | 1775 | old_zv = BUF_ZV (buffer); |
| 1776 | BUF_BEGV (buffer) = BUF_BEG (buffer); | ||
| 1777 | BUF_ZV (buffer) = BUF_Z (buffer); | ||
| 1778 | |||
| 1779 | /* There are no properties at the end of the buffer, so in that case | ||
| 1780 | check for a local map on the last character of the buffer instead. */ | ||
| 1781 | if (position == BUF_Z (buffer) && BUF_Z (buffer) > BUF_BEG (buffer)) | ||
| 1782 | --position; | ||
| 1783 | XSETFASTINT (lispy_position, position); | ||
| 1784 | XSETBUFFER (lispy_buffer, buffer); | ||
| 1785 | prop = Fget_char_property (lispy_position, Qlocal_map, lispy_buffer); | ||
| 1786 | |||
| 1787 | BUF_BEGV (buffer) = old_begv; | ||
| 1788 | BUF_ZV (buffer) = old_zv; | ||
| 1779 | 1789 | ||
| 1780 | /* Use the local map only if it is valid. */ | 1790 | /* Use the local map only if it is valid. */ |
| 1781 | tem = Fkeymapp (prop); | 1791 | if (!NILP (prop) |
| 1782 | if (!NILP (tem)) | 1792 | && (tem = Fkeymapp (prop), !NILP (tem))) |
| 1783 | return prop; | 1793 | return prop; |
| 1784 | 1794 | ||
| 1785 | return buffer->keymap; | 1795 | return buffer->keymap; |