Mercurial > emacs
comparison src/keymap.c @ 12542:f86a10208f7e
(current_minor_maps): Catch errors in Findirect_function.
(current_minor_maps_error): New function.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Mon, 17 Jul 1995 22:21:54 +0000 |
parents | fe458a8ecfa2 |
children | 26c09987d2f3 |
comparison
equal
deleted
inserted
replaced
12541:33a4586124e9 | 12542:f86a10208f7e |
---|---|
797 some systems, static gets macro-defined to be the empty string. | 797 some systems, static gets macro-defined to be the empty string. |
798 Ickypoo. */ | 798 Ickypoo. */ |
799 static Lisp_Object *cmm_modes, *cmm_maps; | 799 static Lisp_Object *cmm_modes, *cmm_maps; |
800 static int cmm_size; | 800 static int cmm_size; |
801 | 801 |
802 /* Error handler used in current_minor_maps. */ | |
803 static Lisp_Object | |
804 current_minor_maps_error () | |
805 { | |
806 return Qnil; | |
807 } | |
808 | |
802 /* Store a pointer to an array of the keymaps of the currently active | 809 /* Store a pointer to an array of the keymaps of the currently active |
803 minor modes in *buf, and return the number of maps it contains. | 810 minor modes in *buf, and return the number of maps it contains. |
804 | 811 |
805 This function always returns a pointer to the same buffer, and may | 812 This function always returns a pointer to the same buffer, and may |
806 free or reallocate it, so if you want to keep it for a long time or | 813 free or reallocate it, so if you want to keep it for a long time or |
828 if ((assoc = XCONS (alist)->car, CONSP (assoc)) | 835 if ((assoc = XCONS (alist)->car, CONSP (assoc)) |
829 && (var = XCONS (assoc)->car, SYMBOLP (var)) | 836 && (var = XCONS (assoc)->car, SYMBOLP (var)) |
830 && (val = find_symbol_value (var), ! EQ (val, Qunbound)) | 837 && (val = find_symbol_value (var), ! EQ (val, Qunbound)) |
831 && ! NILP (val)) | 838 && ! NILP (val)) |
832 { | 839 { |
840 Lisp_Object temp; | |
841 | |
833 if (i >= cmm_size) | 842 if (i >= cmm_size) |
834 { | 843 { |
835 Lisp_Object *newmodes, *newmaps; | 844 Lisp_Object *newmodes, *newmaps; |
836 | 845 |
837 if (cmm_maps) | 846 if (cmm_maps) |
863 cmm_maps = newmaps; | 872 cmm_maps = newmaps; |
864 } | 873 } |
865 else | 874 else |
866 break; | 875 break; |
867 } | 876 } |
868 cmm_modes[i] = var; | 877 |
869 cmm_maps [i] = Findirect_function (XCONS (assoc)->cdr); | 878 /* Get the keymap definition--or nil if it is not defined. */ |
870 i++; | 879 temp = internal_condition_case_1 (Findirect_function, |
880 XCONS (assoc)->cdr, | |
881 Qerror, current_minor_maps_error); | |
882 if (!NILP (temp)) | |
883 { | |
884 cmm_modes[i] = var; | |
885 cmm_maps [i] = temp; | |
886 i++; | |
887 } | |
871 } | 888 } |
872 | 889 |
873 if (modeptr) *modeptr = cmm_modes; | 890 if (modeptr) *modeptr = cmm_modes; |
874 if (mapptr) *mapptr = cmm_maps; | 891 if (mapptr) *mapptr = cmm_maps; |
875 return i; | 892 return i; |