aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2011-06-01 12:34:41 -0300
committerStefan Monnier2011-06-01 12:34:41 -0300
commitfd6fa53f884d35c7fa412b492eaac4500cca2cd6 (patch)
tree6f2226f5de5b7e7bd7c3430cff727e09a81abdb9
parentec8bd86f04daf51f8a65ed5380975185e16c9e38 (diff)
downloademacs-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.
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/minibuffer.el28
-rw-r--r--lisp/mouse.el17
-rw-r--r--src/ChangeLog7
-rw-r--r--src/minibuf.c71
6 files changed, 88 insertions, 45 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 509b304d369..25fd259eb9a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -68,6 +68,10 @@ and also when HOME is set to C:\ by default.
68 68
69* Changes in Emacs 24.1 69* Changes in Emacs 24.1
70 70
71** The inactive minibuffer has its own major mode `minibuffer-inactive-mode'.
72This is handy for minibuffer-only frames, and is also used for the "mouse-1
73pops up *Messages*" feature, which can now easily be changed.
74
71** emacsclient changes 75** emacsclient changes
72 76
73*** New emacsclient argument --parent-id ID can be used to open a 77*** New emacsclient argument --parent-id ID can be used to open a
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4b2a1751813..2ec54b36d1d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
12011-06-01 Stefan Monnier <monnier@iro.umontreal.ca> 12011-06-01 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * minibuffer.el (minibuffer-inactive-mode-map): New var.
4 (minibuffer-inactive-mode): New major mode.
5 * mouse.el (mouse-drag-region): Remove the "mouse-1 pops up
6 the *Messages* buffer" hack.
7 (mouse-popup-menubar): Don't burp if the event is a normal key.
8
3 Miscellaneous tweaks. 9 Miscellaneous tweaks.
4 * emacs-lisp/cl-macs.el (dolist, dotimes): Use the same strategy for 10 * emacs-lisp/cl-macs.el (dolist, dotimes): Use the same strategy for
5 lexical scoping as in subr.el's dolist and dotimes. 11 lexical scoping as in subr.el's dolist and dotimes.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 972c65f62e3..3699f5bab02 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1657,6 +1657,34 @@ The completion method is determined by `completion-at-point-functions'."
1657 (define-key map "\t" 'exit-minibuffer) 1657 (define-key map "\t" 'exit-minibuffer)
1658 (define-key map "?" 'self-insert-and-exit)) 1658 (define-key map "?" 'self-insert-and-exit))
1659 1659
1660(defvar minibuffer-inactive-mode-map
1661 (let ((map (make-keymap)))
1662 (suppress-keymap map)
1663 (define-key map "e" 'find-file-other-frame)
1664 (define-key map "f" 'find-file-other-frame)
1665 (define-key map "b" 'switch-to-buffer-other-frame)
1666 (define-key map "i" 'info)
1667 (define-key map "m" 'mail)
1668 (define-key map "n" 'make-frame)
1669 (define-key map [mouse-1] (lambda () (interactive)
1670 (with-current-buffer "*Messages*"
1671 (goto-char (point-max))
1672 (display-buffer (current-buffer)))))
1673 ;; So the global down-mouse-1 binding doesn't clutter the execution of the
1674 ;; above mouse-1 binding.
1675 (define-key map [down-mouse-1] #'ignore)
1676 map)
1677 "Keymap for use in the minibuffer when it is not active.
1678The non-mouse bindings in this keymap can only be used in minibuffer-only
1679frames, since the minibuffer can normally not be selected when it is
1680not active.")
1681
1682(define-derived-mode minibuffer-inactive-mode nil "InactiveMinibuffer"
1683 :abbrev-table nil ;abbrev.el is not loaded yet during dump.
1684 ;; Note: this major mode is called from minibuf.c.
1685 "Major mode to use in the minibuffer when it is not active.
1686This is only used when the minibuffer area has no active minibuffer.")
1687
1660;;; Completion tables. 1688;;; Completion tables.
1661 1689
1662(defun minibuffer--double-dollars (str) 1690(defun minibuffer--double-dollars (str)
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 124f84d7d73..f35069763bd 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -278,7 +278,7 @@ The contents are the items that would be in the menu bar whether or
278not it is actually displayed." 278not it is actually displayed."
279 (interactive "@e \nP") 279 (interactive "@e \nP")
280 (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) 280 (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
281 (popup-menu (mouse-menu-bar-map) event prefix)) 281 (popup-menu (mouse-menu-bar-map) (unless (integerp event) event) prefix))
282(make-obsolete 'mouse-popup-menubar 'mouse-menu-bar-map "23.1") 282(make-obsolete 'mouse-popup-menubar 'mouse-menu-bar-map "23.1")
283 283
284(defun mouse-popup-menubar-stuff (event prefix) 284(defun mouse-popup-menubar-stuff (event prefix)
@@ -790,18 +790,9 @@ remains active. Otherwise, it remains until the next input event.
790 790
791If the click is in the echo area, display the `*Messages*' buffer." 791If the click is in the echo area, display the `*Messages*' buffer."
792 (interactive "e") 792 (interactive "e")
793 (let ((w (posn-window (event-start start-event)))) 793 ;; Give temporary modes such as isearch a chance to turn off.
794 (if (and (window-minibuffer-p w) 794 (run-hooks 'mouse-leave-buffer-hook)
795 (not (minibuffer-window-active-p w))) 795 (mouse-drag-track start-event t))
796 (save-excursion
797 ;; Swallow the up-event.
798 (read-event)
799 (set-buffer (get-buffer-create "*Messages*"))
800 (goto-char (point-max))
801 (display-buffer (current-buffer)))
802 ;; Give temporary modes such as isearch a chance to turn off.
803 (run-hooks 'mouse-leave-buffer-hook)
804 (mouse-drag-track start-event t))))
805 796
806 797
807(defun mouse-posn-property (pos property) 798(defun mouse-posn-property (pos property)
diff --git a/src/ChangeLog b/src/ChangeLog
index 618a1819c19..a59b8740094 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12011-06-01 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * minibuf.c (get_minibuffer, read_minibuf_unwind):
4 Call minibuffer-inactive-mode.
5
12011-05-31 Juanma Barranquero <lekktu@gmail.com> 62011-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
165static Lisp_Object read_minibuf_unwind (Lisp_Object); 165static Lisp_Object read_minibuf_unwind (Lisp_Object);
166static Lisp_Object run_exit_minibuf_hook (Lisp_Object); 166static 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
760Lisp_Object 760Lisp_Object
761get_minibuffer (int depth) 761get_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
813static Lisp_Object 816static Lisp_Object
814read_minibuf_unwind (Lisp_Object data) 817read_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
983DEFUN ("read-string", Fread_string, Sread_string, 1, 5, 0, 992DEFUN ("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
1889The arguments STRING and PREDICATE are as in `try-completion', 1898The 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))