Mercurial > emacs
comparison src/keyboard.c @ 3255:b04e2b131ef0
(menu_bar_items): Save Vinhibit_quit by hand
instead of using specbind.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 29 May 1993 17:58:03 +0000 |
parents | 1166db56c752 |
children | 4a1d8a111149 |
comparison
equal
deleted
inserted
replaced
3254:e1f5f8f23d90 | 3255:b04e2b131ef0 |
---|---|
3057 The elements have the form (KEY STRING . nil). */ | 3057 The elements have the form (KEY STRING . nil). */ |
3058 | 3058 |
3059 Lisp_Object | 3059 Lisp_Object |
3060 menu_bar_items () | 3060 menu_bar_items () |
3061 { | 3061 { |
3062 int count = specpdl_ptr - specpdl; | |
3063 | |
3064 /* The number of keymaps we're scanning right now, and the number of | 3062 /* The number of keymaps we're scanning right now, and the number of |
3065 keymaps we have allocated space for. */ | 3063 keymaps we have allocated space for. */ |
3066 int nmaps; | 3064 int nmaps; |
3067 | 3065 |
3068 /* maps[0..nmaps-1] are the prefix definitions of KEYBUF[0..t-1] | 3066 /* maps[0..nmaps-1] are the prefix definitions of KEYBUF[0..t-1] |
3072 Lisp_Object def, tem; | 3070 Lisp_Object def, tem; |
3073 | 3071 |
3074 Lisp_Object result; | 3072 Lisp_Object result; |
3075 | 3073 |
3076 int mapno; | 3074 int mapno; |
3075 Lisp_Object oquit; | |
3077 | 3076 |
3078 /* In order to build the menus, we need to call the keymap | 3077 /* In order to build the menus, we need to call the keymap |
3079 accessors. They all call QUIT. But this function is called | 3078 accessors. They all call QUIT. But this function is called |
3080 during redisplay, during which a quit is fatal. So inhibit | 3079 during redisplay, during which a quit is fatal. So inhibit |
3081 quitting while building the menus. */ | 3080 quitting while building the menus. |
3082 specbind (Qinhibit_quit, Qt); | 3081 We do this instead of specbind because (1) errors will clear it anyway |
3082 and (2) this avoids risk of specpdl overflow. */ | |
3083 oquit = Vinhibit_quit; | |
3084 Vinhibit_quit = Qt; | |
3083 | 3085 |
3084 /* Build our list of keymaps. | 3086 /* Build our list of keymaps. |
3085 If we recognize a function key and replace its escape sequence in | 3087 If we recognize a function key and replace its escape sequence in |
3086 keybuf with its symbol, or if the sequence starts with a mouse | 3088 keybuf with its symbol, or if the sequence starts with a mouse |
3087 click and we need to switch buffers, we jump back here to rebuild | 3089 click and we need to switch buffers, we jump back here to rebuild |
3114 tem = Fkeymapp (def); | 3116 tem = Fkeymapp (def); |
3115 if (!NILP (tem)) | 3117 if (!NILP (tem)) |
3116 result = menu_bar_one_keymap (def, result); | 3118 result = menu_bar_one_keymap (def, result); |
3117 } | 3119 } |
3118 | 3120 |
3119 return unbind_to (count, Fnreverse (result)); | 3121 Vinhibit_quit = oquit; |
3122 return Fnreverse (result); | |
3120 } | 3123 } |
3121 | 3124 |
3122 /* Scan one map KEYMAP, accumulating any menu items it defines | 3125 /* Scan one map KEYMAP, accumulating any menu items it defines |
3123 that have not yet been seen in RESULT. Return the updated RESULT. */ | 3126 that have not yet been seen in RESULT. Return the updated RESULT. */ |
3124 | 3127 |