Mercurial > emacs
comparison src/keymap.c @ 3908:a148b4ff79c6
(describe_map_2): Cleanups.
Check there's no previous definition in same keymap.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 28 Jun 1993 19:20:28 +0000 |
parents | 7193a99a87c1 |
children | f9dfc2872fb0 |
comparison
equal
deleted
inserted
replaced
3907:72da559fedd2 | 3908:a148b4ff79c6 |
---|---|
1839 Lisp_Object elt_prefix; | 1839 Lisp_Object elt_prefix; |
1840 int (*elt_describer) (); | 1840 int (*elt_describer) (); |
1841 int partial; | 1841 int partial; |
1842 Lisp_Object shadow; | 1842 Lisp_Object shadow; |
1843 { | 1843 { |
1844 Lisp_Object this; | 1844 Lisp_Object definition, event; |
1845 Lisp_Object tem1, tem2 = Qnil; | 1845 Lisp_Object tem; |
1846 Lisp_Object suppress; | 1846 Lisp_Object suppress; |
1847 Lisp_Object kludge; | 1847 Lisp_Object kludge; |
1848 int first = 1; | 1848 int first = 1; |
1849 struct gcpro gcpro1, gcpro2, gcpro3; | 1849 struct gcpro gcpro1, gcpro2, gcpro3; |
1850 | 1850 |
1853 | 1853 |
1854 /* This vector gets used to present single keys to Flookup_key. Since | 1854 /* This vector gets used to present single keys to Flookup_key. Since |
1855 that is done once per keymap element, we don't want to cons up a | 1855 that is done once per keymap element, we don't want to cons up a |
1856 fresh vector every time. */ | 1856 fresh vector every time. */ |
1857 kludge = Fmake_vector (make_number (1), Qnil); | 1857 kludge = Fmake_vector (make_number (1), Qnil); |
1858 | 1858 definition = Qnil; |
1859 GCPRO3 (elt_prefix, tem2, kludge); | 1859 |
1860 GCPRO3 (elt_prefix, definition, kludge); | |
1860 | 1861 |
1861 for (; CONSP (keymap); keymap = Fcdr (keymap)) | 1862 for (; CONSP (keymap); keymap = Fcdr (keymap)) |
1862 { | 1863 { |
1863 QUIT; | 1864 QUIT; |
1864 | 1865 |
1865 if (XTYPE (XCONS (keymap)->car) == Lisp_Vector) | 1866 if (XTYPE (XCONS (keymap)->car) == Lisp_Vector) |
1866 describe_vector (XCONS (keymap)->car, | 1867 describe_vector (XCONS (keymap)->car, |
1867 elt_prefix, elt_describer, partial, shadow); | 1868 elt_prefix, elt_describer, partial, shadow); |
1868 else | 1869 else |
1869 { | 1870 { |
1870 tem1 = Fcar_safe (Fcar (keymap)); | 1871 event = Fcar_safe (Fcar (keymap)); |
1871 tem2 = get_keyelt (Fcdr_safe (Fcar (keymap))); | 1872 definition = get_keyelt (Fcdr_safe (Fcar (keymap))); |
1872 | 1873 |
1873 /* Don't show undefined commands or suppressed commands. */ | 1874 /* Don't show undefined commands or suppressed commands. */ |
1874 if (NILP (tem2)) continue; | 1875 if (NILP (definition)) continue; |
1875 if (XTYPE (tem2) == Lisp_Symbol && partial) | 1876 if (XTYPE (definition) == Lisp_Symbol && partial) |
1876 { | 1877 { |
1877 this = Fget (tem2, suppress); | 1878 tem = Fget (definition, suppress); |
1878 if (!NILP (this)) | 1879 if (!NILP (tem)) |
1879 continue; | 1880 continue; |
1880 } | 1881 } |
1881 | 1882 |
1882 /* Don't show a command that isn't really visible | 1883 /* Don't show a command that isn't really visible |
1883 because a local definition of the same key shadows it. */ | 1884 because a local definition of the same key shadows it. */ |
1884 | 1885 |
1886 XVECTOR (kludge)->contents[0] = event; | |
1885 if (!NILP (shadow)) | 1887 if (!NILP (shadow)) |
1886 { | 1888 { |
1887 Lisp_Object tem; | |
1888 | |
1889 XVECTOR (kludge)->contents[0] = tem1; | |
1890 tem = Flookup_key (shadow, kludge, Qt); | 1889 tem = Flookup_key (shadow, kludge, Qt); |
1891 if (!NILP (tem)) continue; | 1890 if (!NILP (tem)) continue; |
1892 } | 1891 } |
1892 | |
1893 tem = Flookup_key (map, kludge, Qt); | |
1894 if (! EQ (tem, definition)) continue; | |
1893 | 1895 |
1894 if (first) | 1896 if (first) |
1895 { | 1897 { |
1896 insert ("\n", 1); | 1898 insert ("\n", 1); |
1897 first = 0; | 1899 first = 0; |
1898 } | 1900 } |
1899 | 1901 |
1900 if (!NILP (elt_prefix)) | 1902 if (!NILP (elt_prefix)) |
1901 insert1 (elt_prefix); | 1903 insert1 (elt_prefix); |
1902 | 1904 |
1903 /* THIS gets the string to describe the character TEM1. */ | 1905 /* THIS gets the string to describe the character EVENT. */ |
1904 this = Fsingle_key_description (tem1); | 1906 insert1 (Fsingle_key_description (event)); |
1905 insert1 (this); | |
1906 | 1907 |
1907 /* Print a description of the definition of this character. | 1908 /* Print a description of the definition of this character. |
1908 elt_describer will take care of spacing out far enough | 1909 elt_describer will take care of spacing out far enough |
1909 for alignment purposes. */ | 1910 for alignment purposes. */ |
1910 (*elt_describer) (tem2); | 1911 (*elt_describer) (definition); |
1911 } | 1912 } |
1912 } | 1913 } |
1913 | 1914 |
1914 UNGCPRO; | 1915 UNGCPRO; |
1915 } | 1916 } |