comparison src/keymap.c @ 5613:cad51b2de6cd

(Fkey_binding): Handle Voverriding_local_map. (describe_buffer_bindings): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Sun, 16 Jan 1994 23:39:50 +0000
parents 2b8f405f5103
children a93fc56763fd
comparison
equal deleted inserted replaced
5612:bf68550ececf 5613:cad51b2de6cd
77 77
78 /* A char with the CHAR_META bit set in a vector or the 0200 bit set 78 /* A char with the CHAR_META bit set in a vector or the 0200 bit set
79 in a string key sequence is equivalent to prefixing with this 79 in a string key sequence is equivalent to prefixing with this
80 character. */ 80 character. */
81 extern Lisp_Object meta_prefix_char; 81 extern Lisp_Object meta_prefix_char;
82
83 extern Lisp_Object Voverriding_local_map;
82 84
83 void describe_map_tree (); 85 void describe_map_tree ();
84 static Lisp_Object define_as_prefix (); 86 static Lisp_Object define_as_prefix ();
85 static Lisp_Object describe_buffer_bindings (); 87 static Lisp_Object describe_buffer_bindings ();
86 static void describe_command (); 88 static void describe_command ();
817 Lisp_Object key; 819 Lisp_Object key;
818 { 820 {
819 Lisp_Object *maps, value; 821 Lisp_Object *maps, value;
820 int nmaps, i; 822 int nmaps, i;
821 823
822 nmaps = current_minor_maps (0, &maps); 824 if (!NILP (Voverriding_local_map))
823 for (i = 0; i < nmaps; i++) 825 {
824 if (! NILP (maps[i])) 826 value = Flookup_key (Voverriding_local_map, key, accept_default);
825 {
826 value = Flookup_key (maps[i], key, accept_default);
827 if (! NILP (value) && XTYPE (value) != Lisp_Int)
828 return value;
829 }
830
831 if (! NILP (current_buffer->keymap))
832 {
833 value = Flookup_key (current_buffer->keymap, key, accept_default);
834 if (! NILP (value) && XTYPE (value) != Lisp_Int) 827 if (! NILP (value) && XTYPE (value) != Lisp_Int)
835 return value; 828 return value;
829 }
830 else
831 {
832 nmaps = current_minor_maps (0, &maps);
833 for (i = 0; i < nmaps; i++)
834 if (! NILP (maps[i]))
835 {
836 value = Flookup_key (maps[i], key, accept_default);
837 if (! NILP (value) && XTYPE (value) != Lisp_Int)
838 return value;
839 }
840
841 if (! NILP (current_buffer->keymap))
842 {
843 value = Flookup_key (current_buffer->keymap, key, accept_default);
844 if (! NILP (value) && XTYPE (value) != Lisp_Int)
845 return value;
846 }
836 } 847 }
837 848
838 value = Flookup_key (current_global_map, key, accept_default); 849 value = Flookup_key (current_global_map, key, accept_default);
839 if (! NILP (value) && XTYPE (value) != Lisp_Int) 850 if (! NILP (value) && XTYPE (value) != Lisp_Int)
840 return value; 851 return value;
1729 Lisp_Object *modes, *maps; 1740 Lisp_Object *modes, *maps;
1730 1741
1731 /* Temporarily switch to descbuf, so that we can get that buffer's 1742 /* Temporarily switch to descbuf, so that we can get that buffer's
1732 minor modes correctly. */ 1743 minor modes correctly. */
1733 Fset_buffer (descbuf); 1744 Fset_buffer (descbuf);
1734 nmaps = current_minor_maps (&modes, &maps); 1745 if (!NILP (Voverriding_local_map))
1746 nmaps = 0;
1747 else
1748 nmaps = current_minor_maps (&modes, &maps);
1735 Fset_buffer (Vstandard_output); 1749 Fset_buffer (Vstandard_output);
1736 1750
1737 /* Print the minor mode maps. */ 1751 /* Print the minor mode maps. */
1738 for (i = 0; i < nmaps; i++) 1752 for (i = 0; i < nmaps; i++)
1739 { 1753 {
1765 shadow = Fcons (maps[i], shadow); 1779 shadow = Fcons (maps[i], shadow);
1766 } 1780 }
1767 } 1781 }
1768 1782
1769 /* Print the (major mode) local map. */ 1783 /* Print the (major mode) local map. */
1770 start1 = XBUFFER (descbuf)->keymap; 1784 if (!NILP (Voverriding_local_map))
1785 start1 = Voverriding_local_map;
1786 else
1787 start1 = XBUFFER (descbuf)->keymap;
1788
1771 if (!NILP (start1)) 1789 if (!NILP (start1))
1772 { 1790 {
1773 describe_map_tree (start1, 0, shadow, prefix, 1791 describe_map_tree (start1, 0, shadow, prefix,
1774 "Major Mode Bindings", 0); 1792 "Major Mode Bindings", 0);
1775 shadow = Fcons (start1, shadow); 1793 shadow = Fcons (start1, shadow);