[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/minibuf.c [emacs-unicode-2]
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/src/minibuf.c [emacs-unicode-2] |
Date: |
Mon, 28 Jun 2004 03:55:40 -0400 |
Index: emacs/src/minibuf.c
diff -c emacs/src/minibuf.c:1.261.2.3 emacs/src/minibuf.c:1.261.2.4
*** emacs/src/minibuf.c:1.261.2.3 Fri Apr 16 12:50:49 2004
--- emacs/src/minibuf.c Mon Jun 28 07:29:23 2004
***************
*** 1,5 ****
/* Minibuffer input and completion.
! Copyright (C) 1985,86,93,94,95,96,97,98,99,2000,01,03
Free Software Foundation, Inc.
This file is part of GNU Emacs.
--- 1,5 ----
/* Minibuffer input and completion.
! Copyright (C) 1985,86,93,94,95,96,97,98,99,2000,01,03,04
Free Software Foundation, Inc.
This file is part of GNU Emacs.
***************
*** 209,214 ****
--- 209,215 ----
/* Actual minibuffer invocation. */
static Lisp_Object read_minibuf_unwind P_ ((Lisp_Object));
+ static Lisp_Object run_exit_minibuf_hook P_ ((Lisp_Object));
static Lisp_Object read_minibuf P_ ((Lisp_Object, Lisp_Object,
Lisp_Object, Lisp_Object,
int, Lisp_Object,
***************
*** 563,568 ****
--- 564,575 ----
record_unwind_protect (read_minibuf_unwind, Qnil);
minibuf_level++;
+ /* We are exiting the minibuffer one way or the other, so run the hook.
+ It should be run before unwinding the minibuf settings. Do it
+ separately from read_minibuf_unwind because we need to make sure that
+ read_minibuf_unwind is fully executed even if exit-minibuffer-hook
+ signals an error. --Stef */
+ record_unwind_protect (run_exit_minibuf_hook, Qnil);
/* Now that we can restore all those variables, start changing them. */
***************
*** 822,827 ****
--- 829,845 ----
return buf;
}
+ static Lisp_Object
+ run_exit_minibuf_hook (data)
+ Lisp_Object data;
+ {
+ if (!NILP (Vminibuffer_exit_hook) && !EQ (Vminibuffer_exit_hook, Qunbound)
+ && !NILP (Vrun_hooks))
+ safe_run_hooks (Qminibuffer_exit_hook);
+
+ return Qnil;
+ }
+
/* This function is called on exiting minibuffer, whether normally or
not, and it restores the current window, buffer, etc. */
***************
*** 832,843 ****
Lisp_Object old_deactivate_mark;
Lisp_Object window;
- /* We are exiting the minibuffer one way or the other,
- so run the hook. */
- if (!NILP (Vminibuffer_exit_hook) && !EQ (Vminibuffer_exit_hook, Qunbound)
- && !NILP (Vrun_hooks))
- safe_run_hooks (Qminibuffer_exit_hook);
-
/* If this was a recursive minibuffer,
tie the minibuffer window back to the outer level minibuffer buffer. */
minibuf_level--;
--- 850,855 ----
***************
*** 1195,1200 ****
--- 1207,1213 ----
|| NILP (XCAR (alist))));
int index = 0, obsize = 0;
int matchcount = 0;
+ int bindcount = -1;
Lisp_Object bucket, zero, end, tem;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
***************
*** 1274,1289 ****
/* Ignore this element if it fails to match all the regexps. */
{
- int count = SPECPDL_INDEX ();
- specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil);
for (regexps = Vcompletion_regexp_list; CONSP (regexps);
regexps = XCDR (regexps))
{
tem = Fstring_match (XCAR (regexps), eltstring, zero);
if (NILP (tem))
break;
}
- unbind_to (count, Qnil);
if (CONSP (regexps))
continue;
}
--- 1287,1304 ----
/* Ignore this element if it fails to match all the regexps. */
{
for (regexps = Vcompletion_regexp_list; CONSP (regexps);
regexps = XCDR (regexps))
{
+ if (bindcount < 0) {
+ bindcount = SPECPDL_INDEX ();
+ specbind (Qcase_fold_search,
+ completion_ignore_case ? Qt : Qnil);
+ }
tem = Fstring_match (XCAR (regexps), eltstring, zero);
if (NILP (tem))
break;
}
if (CONSP (regexps))
continue;
}
***************
*** 1297,1302 ****
--- 1312,1321 ----
tem = Fcommandp (elt, Qnil);
else
{
+ if (bindcount >= 0) {
+ unbind_to (bindcount, Qnil);
+ bindcount = -1;
+ }
GCPRO4 (tail, string, eltstring, bestmatch);
tem = type == 3
? call2 (predicate, elt,
***************
*** 1378,1383 ****
--- 1397,1407 ----
}
}
+ if (bindcount >= 0) {
+ unbind_to (bindcount, Qnil);
+ bindcount = -1;
+ }
+
if (NILP (bestmatch))
return Qnil; /* No completions found */
/* If we are ignoring case, and there is no exact match,
***************
*** 1440,1445 ****
--- 1464,1470 ----
&& (!SYMBOLP (XCAR (alist))
|| NILP (XCAR (alist))));
int index = 0, obsize = 0;
+ int bindcount = -1;
Lisp_Object bucket, tem;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
***************
*** 1525,1540 ****
/* Ignore this element if it fails to match all the regexps. */
{
- int count = SPECPDL_INDEX ();
- specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil);
for (regexps = Vcompletion_regexp_list; CONSP (regexps);
regexps = XCDR (regexps))
{
tem = Fstring_match (XCAR (regexps), eltstring, zero);
if (NILP (tem))
break;
}
- unbind_to (count, Qnil);
if (CONSP (regexps))
continue;
}
--- 1550,1567 ----
/* Ignore this element if it fails to match all the regexps. */
{
for (regexps = Vcompletion_regexp_list; CONSP (regexps);
regexps = XCDR (regexps))
{
+ if (bindcount < 0) {
+ bindcount = SPECPDL_INDEX ();
+ specbind (Qcase_fold_search,
+ completion_ignore_case ? Qt : Qnil);
+ }
tem = Fstring_match (XCAR (regexps), eltstring, zero);
if (NILP (tem))
break;
}
if (CONSP (regexps))
continue;
}
***************
*** 1548,1553 ****
--- 1575,1584 ----
tem = Fcommandp (elt, Qnil);
else
{
+ if (bindcount >= 0) {
+ unbind_to (bindcount, Qnil);
+ bindcount = -1;
+ }
GCPRO4 (tail, eltstring, allmatches, string);
tem = type == 3
? call2 (predicate, elt,
***************
*** 1562,1567 ****
--- 1593,1603 ----
}
}
+ if (bindcount >= 0) {
+ unbind_to (bindcount, Qnil);
+ bindcount = -1;
+ }
+
return Fnreverse (allmatches);
}
***************
*** 1602,1608 ****
is the initial position (the position in the list used by the
minibuffer history commands). For consistency, you should also
specify that element of the history as the value of
! INITIAL-CONTENTS. (This is the only case in which you should use
INITIAL-INPUT instead of DEF.) Positions are counted starting from
1 at the beginning of the list. The variable `history-length'
controls the maximum length of a history list.
--- 1638,1644 ----
is the initial position (the position in the list used by the
minibuffer history commands). For consistency, you should also
specify that element of the history as the value of
! INITIAL-INPUT. (This is the only case in which you should use
INITIAL-INPUT instead of DEF.) Positions are counted starting from
1 at the beginning of the list. The variable `history-length'
controls the maximum length of a history list.
***************
*** 1772,1790 ****
return call3 (alist, string, predicate, Qlambda);
/* Reject this element if it fails to match all the regexps. */
! {
! int count = SPECPDL_INDEX ();
! specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil);
! for (regexps = Vcompletion_regexp_list; CONSP (regexps);
! regexps = XCDR (regexps))
! {
! if (NILP (Fstring_match (XCAR (regexps),
! SYMBOLP (tem) ? string : tem,
! Qnil)))
! return unbind_to (count, Qnil);
! }
! unbind_to (count, Qnil);
! }
/* Finally, check the predicate. */
if (!NILP (predicate))
--- 1808,1827 ----
return call3 (alist, string, predicate, Qlambda);
/* Reject this element if it fails to match all the regexps. */
! if (CONSP (Vcompletion_regexp_list))
! {
! int count = SPECPDL_INDEX ();
! specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil);
! for (regexps = Vcompletion_regexp_list; CONSP (regexps);
! regexps = XCDR (regexps))
! {
! if (NILP (Fstring_match (XCAR (regexps),
! SYMBOLP (tem) ? string : tem,
! Qnil)))
! return unbind_to (count, Qnil);
! }
! unbind_to (count, Qnil);
! }
/* Finally, check the predicate. */
if (!NILP (predicate))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/src/minibuf.c [emacs-unicode-2],
Miles Bader <=