diff options
| author | Richard M. Stallman | 1993-07-07 18:40:35 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-07-07 18:40:35 +0000 |
| commit | 07f15dfd8b60549b3cd5a5ee6558126e0116cca0 (patch) | |
| tree | 869401ba93b93f6874d9681f97d01d39b8a2cb45 /src/keymap.c | |
| parent | e6a4a267ff8b2d413820bb539dc144ec786967ed (diff) | |
| download | emacs-07f15dfd8b60549b3cd5a5ee6558126e0116cca0.tar.gz emacs-07f15dfd8b60549b3cd5a5ee6558126e0116cca0.zip | |
(describe_map_tree): When inserting TITLE, mention PREFIX.
Insert newline at end, if inserted anything else.
(describe_buffer_bindings): Corresponding changes.
For minor mode maps, build up a title string,
then let describe_map_tree insert it.
Diffstat (limited to 'src/keymap.c')
| -rw-r--r-- | src/keymap.c | 51 |
1 files changed, 39 insertions, 12 deletions
diff --git a/src/keymap.c b/src/keymap.c index f1af4e4103e..8f61faa529c 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -1735,18 +1735,32 @@ nominal alternate\n\ | |||
| 1735 | /* Print the minor mode maps. */ | 1735 | /* Print the minor mode maps. */ |
| 1736 | for (i = 0; i < nmaps; i++) | 1736 | for (i = 0; i < nmaps; i++) |
| 1737 | { | 1737 | { |
| 1738 | /* Tht title for a minor mode keymap | ||
| 1739 | is constructed at run time. | ||
| 1740 | We let describe_map_tree do the actual insertion | ||
| 1741 | because it takes care of other features when doing so. */ | ||
| 1742 | char *title = (char *) alloca (40 + XSYMBOL (modes[i])->name->size); | ||
| 1743 | char *p = title; | ||
| 1744 | |||
| 1738 | if (XTYPE (modes[i]) == Lisp_Symbol) | 1745 | if (XTYPE (modes[i]) == Lisp_Symbol) |
| 1739 | { | 1746 | { |
| 1740 | insert_char ('`'); | 1747 | *p++ = '`'; |
| 1741 | insert_string (XSYMBOL (modes[i])->name->data); | 1748 | bcopy (XSYMBOL (modes[i])->name->data, p, |
| 1742 | insert_char ('\''); | 1749 | XSYMBOL (modes[i])->name->size); |
| 1750 | p += XSYMBOL (modes[i])->name->size; | ||
| 1751 | *p++ = '\''; | ||
| 1743 | } | 1752 | } |
| 1744 | else | 1753 | else |
| 1745 | insert_string ("Strangely Named"); | 1754 | { |
| 1746 | insert_string (" Minor Mode Bindings:\n"); | 1755 | bcopy ("Strangely Named", p, sizeof ("Strangely Named")); |
| 1747 | describe_map_tree (maps[i], 0, shadow, prefix, 0); | 1756 | p += sizeof ("Strangely Named"); |
| 1757 | } | ||
| 1758 | bcopy (" Minor Mode Bindings", p, sizeof (" Minor Mode Bindings")); | ||
| 1759 | p += sizeof (" Minor Mode Bindings"); | ||
| 1760 | *p = 0; | ||
| 1761 | |||
| 1762 | describe_map_tree (maps[i], 0, shadow, prefix, title); | ||
| 1748 | shadow = Fcons (maps[i], shadow); | 1763 | shadow = Fcons (maps[i], shadow); |
| 1749 | insert_char ('\n'); | ||
| 1750 | } | 1764 | } |
| 1751 | } | 1765 | } |
| 1752 | 1766 | ||
| @@ -1755,13 +1769,12 @@ nominal alternate\n\ | |||
| 1755 | if (!NILP (start1)) | 1769 | if (!NILP (start1)) |
| 1756 | { | 1770 | { |
| 1757 | describe_map_tree (start1, 0, shadow, prefix, | 1771 | describe_map_tree (start1, 0, shadow, prefix, |
| 1758 | "Major Mode Bindings:\n"); | 1772 | "Major Mode Bindings"); |
| 1759 | shadow = Fcons (start1, shadow); | 1773 | shadow = Fcons (start1, shadow); |
| 1760 | insert_string ("\n"); | ||
| 1761 | } | 1774 | } |
| 1762 | 1775 | ||
| 1763 | describe_map_tree (current_global_map, 0, shadow, prefix, | 1776 | describe_map_tree (current_global_map, 0, shadow, prefix, |
| 1764 | "Global Bindings:\n"); | 1777 | "Global Bindings"); |
| 1765 | 1778 | ||
| 1766 | Fset_buffer (descbuf); | 1779 | Fset_buffer (descbuf); |
| 1767 | return Qnil; | 1780 | return Qnil; |
| @@ -1774,7 +1787,8 @@ nominal alternate\n\ | |||
| 1774 | If SHADOW is non-nil, it is a list of maps; | 1787 | If SHADOW is non-nil, it is a list of maps; |
| 1775 | don't mention keys which would be shadowed by any of them. | 1788 | don't mention keys which would be shadowed by any of them. |
| 1776 | PREFIX, if non-nil, says mention only keys that start with PREFIX. | 1789 | PREFIX, if non-nil, says mention only keys that start with PREFIX. |
| 1777 | TITLE, if not 0, is a string to insert at the beginning. */ | 1790 | TITLE, if not 0, is a string to insert at the beginning. |
| 1791 | TITLE should not end with a colon or a newline; we supply that. */ | ||
| 1778 | 1792 | ||
| 1779 | void | 1793 | void |
| 1780 | describe_map_tree (startmap, partial, shadow, prefix, title) | 1794 | describe_map_tree (startmap, partial, shadow, prefix, title) |
| @@ -1784,6 +1798,7 @@ describe_map_tree (startmap, partial, shadow, prefix, title) | |||
| 1784 | { | 1798 | { |
| 1785 | Lisp_Object maps; | 1799 | Lisp_Object maps; |
| 1786 | struct gcpro gcpro1; | 1800 | struct gcpro gcpro1; |
| 1801 | int something = 0; | ||
| 1787 | char *key_heading | 1802 | char *key_heading |
| 1788 | = "\ | 1803 | = "\ |
| 1789 | key binding\n\ | 1804 | key binding\n\ |
| @@ -1795,8 +1810,17 @@ key binding\n\ | |||
| 1795 | if (!NILP (maps)) | 1810 | if (!NILP (maps)) |
| 1796 | { | 1811 | { |
| 1797 | if (title) | 1812 | if (title) |
| 1798 | insert_string (title); | 1813 | { |
| 1814 | insert_string (title); | ||
| 1815 | if (!NILP (prefix)) | ||
| 1816 | { | ||
| 1817 | insert_string (" Starting With "); | ||
| 1818 | insert1 (Fkey_description (prefix)); | ||
| 1819 | } | ||
| 1820 | insert_string (":\n"); | ||
| 1821 | } | ||
| 1799 | insert_string (key_heading); | 1822 | insert_string (key_heading); |
| 1823 | something = 1; | ||
| 1800 | } | 1824 | } |
| 1801 | 1825 | ||
| 1802 | for (; !NILP (maps); maps = Fcdr (maps)) | 1826 | for (; !NILP (maps); maps = Fcdr (maps)) |
| @@ -1846,6 +1870,9 @@ key binding\n\ | |||
| 1846 | skip: ; | 1870 | skip: ; |
| 1847 | } | 1871 | } |
| 1848 | 1872 | ||
| 1873 | if (something) | ||
| 1874 | insert_string ("\n"); | ||
| 1875 | |||
| 1849 | UNGCPRO; | 1876 | UNGCPRO; |
| 1850 | } | 1877 | } |
| 1851 | 1878 | ||