Mercurial > emacs
comparison src/keymap.c @ 23953:c8cdb4e487cb
(Fsingle_key_description): Handle (control ?x) etc.
(Fkey_description): Handle lists like vectors.
| author | Richard M. Stallman <rms@gnu.org> |
|---|---|
| date | Tue, 29 Dec 1998 22:53:25 +0000 |
| parents | 529965d3c653 |
| children | 4c423f69142b |
comparison
equal
deleted
inserted
replaced
| 23952:4ef8ec98dd43 | 23953:c8cdb4e487cb |
|---|---|
| 1718 else | 1718 else |
| 1719 XSETFASTINT (XVECTOR (vector)->contents[i_before], c); | 1719 XSETFASTINT (XVECTOR (vector)->contents[i_before], c); |
| 1720 } | 1720 } |
| 1721 keys = vector; | 1721 keys = vector; |
| 1722 } | 1722 } |
| 1723 else if (!VECTORP (keys)) | 1723 |
| 1724 if (VECTORP (keys)) | |
| 1725 { | |
| 1726 /* In effect, this computes | |
| 1727 (mapconcat 'single-key-description keys " ") | |
| 1728 but we shouldn't use mapconcat because it can do GC. */ | |
| 1729 | |
| 1730 len = XVECTOR (keys)->size; | |
| 1731 sep = build_string (" "); | |
| 1732 /* This has one extra element at the end that we don't pass to Fconcat. */ | |
| 1733 args = (Lisp_Object *) alloca (len * 2 * sizeof (Lisp_Object)); | |
| 1734 | |
| 1735 for (i = 0; i < len; i++) | |
| 1736 { | |
| 1737 args[i * 2] = Fsingle_key_description (XVECTOR (keys)->contents[i]); | |
| 1738 args[i * 2 + 1] = sep; | |
| 1739 } | |
| 1740 } | |
| 1741 else if (CONSP (keys)) | |
| 1742 { | |
| 1743 /* In effect, this computes | |
| 1744 (mapconcat 'single-key-description keys " ") | |
| 1745 but we shouldn't use mapconcat because it can do GC. */ | |
| 1746 | |
| 1747 len = XFASTINT (Flength (keys)); | |
| 1748 sep = build_string (" "); | |
| 1749 /* This has one extra element at the end that we don't pass to Fconcat. */ | |
| 1750 args = (Lisp_Object *) alloca (len * 2 * sizeof (Lisp_Object)); | |
| 1751 | |
| 1752 for (i = 0; i < len; i++) | |
| 1753 { | |
| 1754 args[i * 2] = Fsingle_key_description (XCONS (keys)->car); | |
| 1755 args[i * 2 + 1] = sep; | |
| 1756 keys = XCONS (keys)->cdr; | |
| 1757 } | |
| 1758 } | |
| 1759 else | |
| 1724 keys = wrong_type_argument (Qarrayp, keys); | 1760 keys = wrong_type_argument (Qarrayp, keys); |
| 1725 | |
| 1726 /* In effect, this computes | |
| 1727 (mapconcat 'single-key-description keys " ") | |
| 1728 but we shouldn't use mapconcat because it can do GC. */ | |
| 1729 | |
| 1730 len = XVECTOR (keys)->size; | |
| 1731 sep = build_string (" "); | |
| 1732 /* This has one extra element at the end that we don't pass to Fconcat. */ | |
| 1733 args = (Lisp_Object *) alloca (len * 2 * sizeof (Lisp_Object)); | |
| 1734 | |
| 1735 for (i = 0; i < len; i++) | |
| 1736 { | |
| 1737 args[i * 2] = Fsingle_key_description (XVECTOR (keys)->contents[i]); | |
| 1738 args[i * 2 + 1] = sep; | |
| 1739 } | |
| 1740 | 1761 |
| 1741 return Fconcat (len * 2 - 1, args); | 1762 return Fconcat (len * 2 - 1, args); |
| 1742 } | 1763 } |
| 1743 | 1764 |
| 1744 char * | 1765 char * |
| 1853 "Return a pretty description of command character KEY.\n\ | 1874 "Return a pretty description of command character KEY.\n\ |
| 1854 Control characters turn into C-whatever, etc.") | 1875 Control characters turn into C-whatever, etc.") |
| 1855 (key) | 1876 (key) |
| 1856 Lisp_Object key; | 1877 Lisp_Object key; |
| 1857 { | 1878 { |
| 1879 if (CONSP (key) && lucid_event_type_list_p (key)) | |
| 1880 key = Fevent_convert_list (key); | |
| 1881 | |
| 1858 key = EVENT_HEAD (key); | 1882 key = EVENT_HEAD (key); |
| 1859 | 1883 |
| 1860 if (INTEGERP (key)) /* Normal character */ | 1884 if (INTEGERP (key)) /* Normal character */ |
| 1861 { | 1885 { |
| 1862 unsigned int charset, c1, c2; | 1886 unsigned int charset, c1, c2; |
