diff options
| author | Stefan Monnier | 2004-05-28 20:52:05 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2004-05-28 20:52:05 +0000 |
| commit | 7292839d01eae3ff6d675e1bc13b2c5f589600af (patch) | |
| tree | a55b109da4f95d37291a03717a4e017aacceca1b /src | |
| parent | 5445d2872750d82ebbb7b11e3d832201032de170 (diff) | |
| download | emacs-7292839d01eae3ff6d675e1bc13b2c5f589600af.tar.gz emacs-7292839d01eae3ff6d675e1bc13b2c5f589600af.zip | |
(run_exit_minibuf_hook): New function.
(read_minibuf_unwind): Don't run exit-minibuffer-hook any more.
(read_minibuf): Use separate unwind handler to run exit-minibuf-hook.
Diffstat (limited to 'src')
| -rw-r--r-- | src/minibuf.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/minibuf.c b/src/minibuf.c index b91a4a4fc2a..67d57cab543 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Minibuffer input and completion. | 1 | /* Minibuffer input and completion. |
| 2 | Copyright (C) 1985,86,93,94,95,96,97,98,99,2000,01,03 | 2 | Copyright (C) 1985,86,93,94,95,96,97,98,99,2000,01,03,04 |
| 3 | Free Software Foundation, Inc. | 3 | Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| @@ -209,6 +209,7 @@ without invoking the usual minibuffer commands. */) | |||
| 209 | /* Actual minibuffer invocation. */ | 209 | /* Actual minibuffer invocation. */ |
| 210 | 210 | ||
| 211 | static Lisp_Object read_minibuf_unwind P_ ((Lisp_Object)); | 211 | static Lisp_Object read_minibuf_unwind P_ ((Lisp_Object)); |
| 212 | static Lisp_Object run_exit_minibuf_hook P_ ((Lisp_Object)); | ||
| 212 | static Lisp_Object read_minibuf P_ ((Lisp_Object, Lisp_Object, | 213 | static Lisp_Object read_minibuf P_ ((Lisp_Object, Lisp_Object, |
| 213 | Lisp_Object, Lisp_Object, | 214 | Lisp_Object, Lisp_Object, |
| 214 | int, Lisp_Object, | 215 | int, Lisp_Object, |
| @@ -563,6 +564,12 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 563 | 564 | ||
| 564 | record_unwind_protect (read_minibuf_unwind, Qnil); | 565 | record_unwind_protect (read_minibuf_unwind, Qnil); |
| 565 | minibuf_level++; | 566 | minibuf_level++; |
| 567 | /* We are exiting the minibuffer one way or the other, so run the hook. | ||
| 568 | It should be run before unwinding the minibuf settings. Do it | ||
| 569 | separately from read_minibuf_unwind because we need to make sure that | ||
| 570 | read_minibuf_unwind is fully executed even if exit-minibuffer-hook | ||
| 571 | signals an error. --Stef */ | ||
| 572 | record_unwind_protect (run_exit_minibuf_hook, Qnil); | ||
| 566 | 573 | ||
| 567 | /* Now that we can restore all those variables, start changing them. */ | 574 | /* Now that we can restore all those variables, start changing them. */ |
| 568 | 575 | ||
| @@ -822,6 +829,17 @@ get_minibuffer (depth) | |||
| 822 | return buf; | 829 | return buf; |
| 823 | } | 830 | } |
| 824 | 831 | ||
| 832 | static Lisp_Object | ||
| 833 | run_exit_minibuf_hook (data) | ||
| 834 | Lisp_Object data; | ||
| 835 | { | ||
| 836 | if (!NILP (Vminibuffer_exit_hook) && !EQ (Vminibuffer_exit_hook, Qunbound) | ||
| 837 | && !NILP (Vrun_hooks)) | ||
| 838 | safe_run_hooks (Qminibuffer_exit_hook); | ||
| 839 | |||
| 840 | return Qnil; | ||
| 841 | } | ||
| 842 | |||
| 825 | /* This function is called on exiting minibuffer, whether normally or | 843 | /* This function is called on exiting minibuffer, whether normally or |
| 826 | not, and it restores the current window, buffer, etc. */ | 844 | not, and it restores the current window, buffer, etc. */ |
| 827 | 845 | ||
| @@ -832,12 +850,6 @@ read_minibuf_unwind (data) | |||
| 832 | Lisp_Object old_deactivate_mark; | 850 | Lisp_Object old_deactivate_mark; |
| 833 | Lisp_Object window; | 851 | Lisp_Object window; |
| 834 | 852 | ||
| 835 | /* We are exiting the minibuffer one way or the other, | ||
| 836 | so run the hook. */ | ||
| 837 | if (!NILP (Vminibuffer_exit_hook) && !EQ (Vminibuffer_exit_hook, Qunbound) | ||
| 838 | && !NILP (Vrun_hooks)) | ||
| 839 | safe_run_hooks (Qminibuffer_exit_hook); | ||
| 840 | |||
| 841 | /* If this was a recursive minibuffer, | 853 | /* If this was a recursive minibuffer, |
| 842 | tie the minibuffer window back to the outer level minibuffer buffer. */ | 854 | tie the minibuffer window back to the outer level minibuffer buffer. */ |
| 843 | minibuf_level--; | 855 | minibuf_level--; |