diff options
| author | Stefan Monnier | 2011-06-01 12:34:41 -0300 |
|---|---|---|
| committer | Stefan Monnier | 2011-06-01 12:34:41 -0300 |
| commit | fd6fa53f884d35c7fa412b492eaac4500cca2cd6 (patch) | |
| tree | 6f2226f5de5b7e7bd7c3430cff727e09a81abdb9 /src | |
| parent | ec8bd86f04daf51f8a65ed5380975185e16c9e38 (diff) | |
| download | emacs-fd6fa53f884d35c7fa412b492eaac4500cca2cd6.tar.gz emacs-fd6fa53f884d35c7fa412b492eaac4500cca2cd6.zip | |
* lisp/minibuffer.el (minibuffer-inactive-mode-map): New var.
(minibuffer-inactive-mode): New major mode.
* src/minibuf.c (get_minibuffer, read_minibuf_unwind): Call it.
* lisp/mouse.el (mouse-drag-region): Remove the "mouse-1 pops up
the *Messages* buffer" hack.
(mouse-popup-menubar): Don't burp if the event is a normal key.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/minibuf.c | 71 |
2 files changed, 46 insertions, 32 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 618a1819c19..a59b8740094 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2011-06-01 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * minibuf.c (get_minibuffer, read_minibuf_unwind): | ||
| 4 | Call minibuffer-inactive-mode. | ||
| 5 | |||
| 1 | 2011-05-31 Juanma Barranquero <lekktu@gmail.com> | 6 | 2011-05-31 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 7 | ||
| 3 | * makefile.w32-in ($(BLD)/data.$(O), $(BLD)/editfns.$(O)): | 8 | * makefile.w32-in ($(BLD)/data.$(O), $(BLD)/editfns.$(O)): |
| @@ -181,7 +186,7 @@ | |||
| 181 | 186 | ||
| 182 | merge count_size_as_multibyte, parse_str_to_multibyte | 187 | merge count_size_as_multibyte, parse_str_to_multibyte |
| 183 | * character.c, character.h (count_size_as_multibyte): | 188 | * character.c, character.h (count_size_as_multibyte): |
| 184 | Renamed from parse_str_to_multibyte; all uses changed. | 189 | Rename from parse_str_to_multibyte; all uses changed. |
| 185 | Check for integer overflow. | 190 | Check for integer overflow. |
| 186 | * insdel.c, lisp.h (count_size_as_multibyte): Remove, | 191 | * insdel.c, lisp.h (count_size_as_multibyte): Remove, |
| 187 | since it's now a duplicate of the other. This is more of | 192 | since it's now a duplicate of the other. This is more of |
diff --git a/src/minibuf.c b/src/minibuf.c index 4658b05e91d..5aa15afd5cf 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -160,7 +160,7 @@ without invoking the usual minibuffer commands. */) | |||
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | 162 | ||
| 163 | /* Actual minibuffer invocation. */ | 163 | /* Actual minibuffer invocation. */ |
| 164 | 164 | ||
| 165 | static Lisp_Object read_minibuf_unwind (Lisp_Object); | 165 | static Lisp_Object read_minibuf_unwind (Lisp_Object); |
| 166 | static Lisp_Object run_exit_minibuf_hook (Lisp_Object); | 166 | static Lisp_Object run_exit_minibuf_hook (Lisp_Object); |
| @@ -266,7 +266,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, | |||
| 266 | error ("Error reading from stdin"); | 266 | error ("Error reading from stdin"); |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | /* If Lisp form desired instead of string, parse it. */ | 269 | /* If Lisp form desired instead of string, parse it. */ |
| 270 | if (expflag) | 270 | if (expflag) |
| 271 | val = string_to_object (val, CONSP (defalt) ? XCAR (defalt) : defalt); | 271 | val = string_to_object (val, CONSP (defalt) ? XCAR (defalt) : defalt); |
| 272 | 272 | ||
| @@ -743,7 +743,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 743 | } | 743 | } |
| 744 | } | 744 | } |
| 745 | 745 | ||
| 746 | /* If Lisp form desired instead of string, parse it. */ | 746 | /* If Lisp form desired instead of string, parse it. */ |
| 747 | if (expflag) | 747 | if (expflag) |
| 748 | val = string_to_object (val, defalt); | 748 | val = string_to_object (val, defalt); |
| 749 | 749 | ||
| @@ -755,7 +755,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 755 | 755 | ||
| 756 | /* Return a buffer to be used as the minibuffer at depth `depth'. | 756 | /* Return a buffer to be used as the minibuffer at depth `depth'. |
| 757 | depth = 0 is the lowest allowed argument, and that is the value | 757 | depth = 0 is the lowest allowed argument, and that is the value |
| 758 | used for nonrecursive minibuffer invocations */ | 758 | used for nonrecursive minibuffer invocations. */ |
| 759 | 759 | ||
| 760 | Lisp_Object | 760 | Lisp_Object |
| 761 | get_minibuffer (int depth) | 761 | get_minibuffer (int depth) |
| @@ -793,7 +793,10 @@ get_minibuffer (int depth) | |||
| 793 | reset_buffer (XBUFFER (buf)); | 793 | reset_buffer (XBUFFER (buf)); |
| 794 | record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); | 794 | record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); |
| 795 | Fset_buffer (buf); | 795 | Fset_buffer (buf); |
| 796 | Fkill_all_local_variables (); | 796 | if (!NILP (Ffboundp (intern ("minibuffer-inactive-mode")))) |
| 797 | call0 (intern ("minibuffer-inactive-mode")); | ||
| 798 | else | ||
| 799 | Fkill_all_local_variables (); | ||
| 797 | unbind_to (count, Qnil); | 800 | unbind_to (count, Qnil); |
| 798 | } | 801 | } |
| 799 | 802 | ||
| @@ -808,7 +811,7 @@ run_exit_minibuf_hook (Lisp_Object data) | |||
| 808 | } | 811 | } |
| 809 | 812 | ||
| 810 | /* This function is called on exiting minibuffer, whether normally or | 813 | /* This function is called on exiting minibuffer, whether normally or |
| 811 | not, and it restores the current window, buffer, etc. */ | 814 | not, and it restores the current window, buffer, etc. */ |
| 812 | 815 | ||
| 813 | static Lisp_Object | 816 | static Lisp_Object |
| 814 | read_minibuf_unwind (Lisp_Object data) | 817 | read_minibuf_unwind (Lisp_Object data) |
| @@ -868,6 +871,12 @@ read_minibuf_unwind (Lisp_Object data) | |||
| 868 | windows_or_buffers_changed++; | 871 | windows_or_buffers_changed++; |
| 869 | XSETFASTINT (XWINDOW (window)->last_modified, 0); | 872 | XSETFASTINT (XWINDOW (window)->last_modified, 0); |
| 870 | XSETFASTINT (XWINDOW (window)->last_overlay_modified, 0); | 873 | XSETFASTINT (XWINDOW (window)->last_overlay_modified, 0); |
| 874 | |||
| 875 | /* In case the previous minibuffer displayed in this miniwindow is | ||
| 876 | dead, we may keep displaying this buffer (tho it's inactive), so reset it, | ||
| 877 | to make sure we don't leave around bindings and stuff which only | ||
| 878 | made sense during the read_minibuf invocation. */ | ||
| 879 | call0 (intern ("minibuffer-inactive-mode")); | ||
| 871 | return Qnil; | 880 | return Qnil; |
| 872 | } | 881 | } |
| 873 | 882 | ||
| @@ -978,7 +987,7 @@ Such arguments are used as in `read-from-minibuffer'.) */) | |||
| 978 | Qnil); | 987 | Qnil); |
| 979 | } | 988 | } |
| 980 | 989 | ||
| 981 | /* Functions that use the minibuffer to read various things. */ | 990 | /* Functions that use the minibuffer to read various things. */ |
| 982 | 991 | ||
| 983 | DEFUN ("read-string", Fread_string, Sread_string, 1, 5, 0, | 992 | DEFUN ("read-string", Fread_string, Sread_string, 1, 5, 0, |
| 984 | doc: /* Read a string from the minibuffer, prompting with string PROMPT. | 993 | doc: /* Read a string from the minibuffer, prompting with string PROMPT. |
| @@ -1146,7 +1155,7 @@ function, instead of the usual behavior. */) | |||
| 1146 | args[1] = prompt; | 1155 | args[1] = prompt; |
| 1147 | args[2] = def; | 1156 | args[2] = def; |
| 1148 | args[3] = require_match; | 1157 | args[3] = require_match; |
| 1149 | result = Ffuncall(4, args); | 1158 | result = Ffuncall (4, args); |
| 1150 | } | 1159 | } |
| 1151 | return unbind_to (count, result); | 1160 | return unbind_to (count, result); |
| 1152 | } | 1161 | } |
| @@ -1233,10 +1242,10 @@ is used to further constrain the set of candidates. */) | |||
| 1233 | 1242 | ||
| 1234 | while (1) | 1243 | while (1) |
| 1235 | { | 1244 | { |
| 1236 | /* Get the next element of the alist, obarray, or hash-table. */ | 1245 | /* Get the next element of the alist, obarray, or hash-table. */ |
| 1237 | /* Exit the loop if the elements are all used up. */ | 1246 | /* Exit the loop if the elements are all used up. */ |
| 1238 | /* elt gets the alist element or symbol. | 1247 | /* elt gets the alist element or symbol. |
| 1239 | eltstring gets the name to check as a completion. */ | 1248 | eltstring gets the name to check as a completion. */ |
| 1240 | 1249 | ||
| 1241 | if (type == list_table) | 1250 | if (type == list_table) |
| 1242 | { | 1251 | { |
| @@ -1278,7 +1287,7 @@ is used to further constrain the set of candidates. */) | |||
| 1278 | elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++); | 1287 | elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++); |
| 1279 | } | 1288 | } |
| 1280 | 1289 | ||
| 1281 | /* Is this element a possible completion? */ | 1290 | /* Is this element a possible completion? */ |
| 1282 | 1291 | ||
| 1283 | if (SYMBOLP (eltstring)) | 1292 | if (SYMBOLP (eltstring)) |
| 1284 | eltstring = Fsymbol_name (eltstring); | 1293 | eltstring = Fsymbol_name (eltstring); |
| @@ -1291,7 +1300,7 @@ is used to further constrain the set of candidates. */) | |||
| 1291 | completion_ignore_case ? Qt : Qnil), | 1300 | completion_ignore_case ? Qt : Qnil), |
| 1292 | EQ (Qt, tem))) | 1301 | EQ (Qt, tem))) |
| 1293 | { | 1302 | { |
| 1294 | /* Yes. */ | 1303 | /* Yes. */ |
| 1295 | Lisp_Object regexps; | 1304 | Lisp_Object regexps; |
| 1296 | 1305 | ||
| 1297 | /* Ignore this element if it fails to match all the regexps. */ | 1306 | /* Ignore this element if it fails to match all the regexps. */ |
| @@ -1313,7 +1322,7 @@ is used to further constrain the set of candidates. */) | |||
| 1313 | } | 1322 | } |
| 1314 | 1323 | ||
| 1315 | /* Ignore this element if there is a predicate | 1324 | /* Ignore this element if there is a predicate |
| 1316 | and the predicate doesn't like it. */ | 1325 | and the predicate doesn't like it. */ |
| 1317 | 1326 | ||
| 1318 | if (!NILP (predicate)) | 1327 | if (!NILP (predicate)) |
| 1319 | { | 1328 | { |
| @@ -1415,7 +1424,7 @@ is used to further constrain the set of candidates. */) | |||
| 1415 | } | 1424 | } |
| 1416 | 1425 | ||
| 1417 | if (NILP (bestmatch)) | 1426 | if (NILP (bestmatch)) |
| 1418 | return Qnil; /* No completions found */ | 1427 | return Qnil; /* No completions found. */ |
| 1419 | /* If we are ignoring case, and there is no exact match, | 1428 | /* If we are ignoring case, and there is no exact match, |
| 1420 | and no additional text was supplied, | 1429 | and no additional text was supplied, |
| 1421 | don't change the case of what the user typed. */ | 1430 | don't change the case of what the user typed. */ |
| @@ -1429,7 +1438,7 @@ is used to further constrain the set of candidates. */) | |||
| 1429 | return Qt; | 1438 | return Qt; |
| 1430 | 1439 | ||
| 1431 | XSETFASTINT (zero, 0); /* Else extract the part in which */ | 1440 | XSETFASTINT (zero, 0); /* Else extract the part in which */ |
| 1432 | XSETFASTINT (end, bestmatchsize); /* all completions agree */ | 1441 | XSETFASTINT (end, bestmatchsize); /* all completions agree. */ |
| 1433 | return Fsubstring (bestmatch, zero, end); | 1442 | return Fsubstring (bestmatch, zero, end); |
| 1434 | } | 1443 | } |
| 1435 | 1444 | ||
| @@ -1496,10 +1505,10 @@ with a space are ignored unless STRING itself starts with a space. */) | |||
| 1496 | 1505 | ||
| 1497 | while (1) | 1506 | while (1) |
| 1498 | { | 1507 | { |
| 1499 | /* Get the next element of the alist, obarray, or hash-table. */ | 1508 | /* Get the next element of the alist, obarray, or hash-table. */ |
| 1500 | /* Exit the loop if the elements are all used up. */ | 1509 | /* Exit the loop if the elements are all used up. */ |
| 1501 | /* elt gets the alist element or symbol. | 1510 | /* elt gets the alist element or symbol. |
| 1502 | eltstring gets the name to check as a completion. */ | 1511 | eltstring gets the name to check as a completion. */ |
| 1503 | 1512 | ||
| 1504 | if (type == 1) | 1513 | if (type == 1) |
| 1505 | { | 1514 | { |
| @@ -1541,7 +1550,7 @@ with a space are ignored unless STRING itself starts with a space. */) | |||
| 1541 | elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++); | 1550 | elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++); |
| 1542 | } | 1551 | } |
| 1543 | 1552 | ||
| 1544 | /* Is this element a possible completion? */ | 1553 | /* Is this element a possible completion? */ |
| 1545 | 1554 | ||
| 1546 | if (SYMBOLP (eltstring)) | 1555 | if (SYMBOLP (eltstring)) |
| 1547 | eltstring = Fsymbol_name (eltstring); | 1556 | eltstring = Fsymbol_name (eltstring); |
| @@ -1561,7 +1570,7 @@ with a space are ignored unless STRING itself starts with a space. */) | |||
| 1561 | completion_ignore_case ? Qt : Qnil), | 1570 | completion_ignore_case ? Qt : Qnil), |
| 1562 | EQ (Qt, tem))) | 1571 | EQ (Qt, tem))) |
| 1563 | { | 1572 | { |
| 1564 | /* Yes. */ | 1573 | /* Yes. */ |
| 1565 | Lisp_Object regexps; | 1574 | Lisp_Object regexps; |
| 1566 | 1575 | ||
| 1567 | /* Ignore this element if it fails to match all the regexps. */ | 1576 | /* Ignore this element if it fails to match all the regexps. */ |
| @@ -1583,7 +1592,7 @@ with a space are ignored unless STRING itself starts with a space. */) | |||
| 1583 | } | 1592 | } |
| 1584 | 1593 | ||
| 1585 | /* Ignore this element if there is a predicate | 1594 | /* Ignore this element if there is a predicate |
| 1586 | and the predicate doesn't like it. */ | 1595 | and the predicate doesn't like it. */ |
| 1587 | 1596 | ||
| 1588 | if (!NILP (predicate)) | 1597 | if (!NILP (predicate)) |
| 1589 | { | 1598 | { |
| @@ -1604,7 +1613,7 @@ with a space are ignored unless STRING itself starts with a space. */) | |||
| 1604 | } | 1613 | } |
| 1605 | if (NILP (tem)) continue; | 1614 | if (NILP (tem)) continue; |
| 1606 | } | 1615 | } |
| 1607 | /* Ok => put it on the list. */ | 1616 | /* Ok => put it on the list. */ |
| 1608 | allmatches = Fcons (eltstring, allmatches); | 1617 | allmatches = Fcons (eltstring, allmatches); |
| 1609 | } | 1618 | } |
| 1610 | } | 1619 | } |
| @@ -1810,9 +1819,9 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 1810 | if (SYMBOLP (tail)) | 1819 | if (SYMBOLP (tail)) |
| 1811 | while (1) | 1820 | while (1) |
| 1812 | { | 1821 | { |
| 1813 | if (EQ((Fcompare_strings (string, make_number (0), Qnil, | 1822 | if (EQ (Fcompare_strings (string, make_number (0), Qnil, |
| 1814 | Fsymbol_name (tail), | 1823 | Fsymbol_name (tail), |
| 1815 | make_number (0) , Qnil, Qt)), | 1824 | make_number (0) , Qnil, Qt), |
| 1816 | Qt)) | 1825 | Qt)) |
| 1817 | { | 1826 | { |
| 1818 | tem = tail; | 1827 | tem = tail; |
| @@ -1836,11 +1845,11 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 1836 | tem = HASH_KEY (h, i); | 1845 | tem = HASH_KEY (h, i); |
| 1837 | else | 1846 | else |
| 1838 | for (i = 0; i < HASH_TABLE_SIZE (h); ++i) | 1847 | for (i = 0; i < HASH_TABLE_SIZE (h); ++i) |
| 1839 | if (!NILP (HASH_HASH (h, i)) && | 1848 | if (!NILP (HASH_HASH (h, i)) |
| 1840 | EQ (Fcompare_strings (string, make_number (0), Qnil, | 1849 | && EQ (Fcompare_strings (string, make_number (0), Qnil, |
| 1841 | HASH_KEY (h, i), make_number (0) , Qnil, | 1850 | HASH_KEY (h, i), make_number (0) , Qnil, |
| 1842 | completion_ignore_case ? Qt : Qnil), | 1851 | completion_ignore_case ? Qt : Qnil), |
| 1843 | Qt)) | 1852 | Qt)) |
| 1844 | { | 1853 | { |
| 1845 | tem = HASH_KEY (h, i); | 1854 | tem = HASH_KEY (h, i); |
| 1846 | break; | 1855 | break; |
| @@ -1887,7 +1896,7 @@ If the argument FLAG is nil, invoke `try-completion', if it's t, invoke | |||
| 1887 | `all-completions', otherwise invoke `test-completion'. | 1896 | `all-completions', otherwise invoke `test-completion'. |
| 1888 | 1897 | ||
| 1889 | The arguments STRING and PREDICATE are as in `try-completion', | 1898 | The arguments STRING and PREDICATE are as in `try-completion', |
| 1890 | `all-completions', and `test-completion'. */) | 1899 | `all-completions', and `test-completion'. */) |
| 1891 | (Lisp_Object string, Lisp_Object predicate, Lisp_Object flag) | 1900 | (Lisp_Object string, Lisp_Object predicate, Lisp_Object flag) |
| 1892 | { | 1901 | { |
| 1893 | if (NILP (flag)) | 1902 | if (NILP (flag)) |