summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-06-01 12:34:41 -0300
committerStefan Monnier <monnier@iro.umontreal.ca>2011-06-01 12:34:41 -0300
commit6f0933c0a767fcde822b0575b49e5e0daddb2799 (patch)
tree652cb9da4b3fde4361469de0874901f7f0c1dfe0
parent7a56e3e6dd2dc48ba8689583fa354a43a55d0f4c (diff)
downloademacs-6f0933c0a767fcde822b0575b49e5e0daddb2799.tar.gz
* 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.
* Changes in Emacs 24.1
+** The inactive minibuffer has its own major mode `minibuffer-inactive-mode'.
+This is handy for minibuffer-only frames, and is also used for the "mouse-1
+pops up *Messages*" feature, which can now easily be changed.
+
** emacsclient changes
*** New emacsclient argument --parent-id ID can be used to open a
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5c17bc3907e..aa1ace38f73 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
2011-06-01 Stefan Monnier <monnier@iro.umontreal.ca>
+ * minibuffer.el (minibuffer-inactive-mode-map): New var.
+ (minibuffer-inactive-mode): New major mode.
+ * 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.
+
Miscellaneous tweaks.
* emacs-lisp/cl-macs.el (dolist, dotimes): Use the same strategy for
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'."
(define-key map "\t" 'exit-minibuffer)
(define-key map "?" 'self-insert-and-exit))
+(defvar minibuffer-inactive-mode-map
+ (let ((map (make-keymap)))
+ (suppress-keymap map)
+ (define-key map "e" 'find-file-other-frame)
+ (define-key map "f" 'find-file-other-frame)
+ (define-key map "b" 'switch-to-buffer-other-frame)
+ (define-key map "i" 'info)
+ (define-key map "m" 'mail)
+ (define-key map "n" 'make-frame)
+ (define-key map [mouse-1] (lambda () (interactive)
+ (with-current-buffer "*Messages*"
+ (goto-char (point-max))
+ (display-buffer (current-buffer)))))
+ ;; So the global down-mouse-1 binding doesn't clutter the execution of the
+ ;; above mouse-1 binding.
+ (define-key map [down-mouse-1] #'ignore)
+ map)
+ "Keymap for use in the minibuffer when it is not active.
+The non-mouse bindings in this keymap can only be used in minibuffer-only
+frames, since the minibuffer can normally not be selected when it is
+not active.")
+
+(define-derived-mode minibuffer-inactive-mode nil "InactiveMinibuffer"
+ :abbrev-table nil ;abbrev.el is not loaded yet during dump.
+ ;; Note: this major mode is called from minibuf.c.
+ "Major mode to use in the minibuffer when it is not active.
+This is only used when the minibuffer area has no active minibuffer.")
+
;;; Completion tables.
(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
not it is actually displayed."
(interactive "@e \nP")
(run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
- (popup-menu (mouse-menu-bar-map) event prefix))
+ (popup-menu (mouse-menu-bar-map) (unless (integerp event) event) prefix))
(make-obsolete 'mouse-popup-menubar 'mouse-menu-bar-map "23.1")
(defun mouse-popup-menubar-stuff (event prefix)
@@ -790,18 +790,9 @@ remains active. Otherwise, it remains until the next input event.
If the click is in the echo area, display the `*Messages*' buffer."
(interactive "e")
- (let ((w (posn-window (event-start start-event))))
- (if (and (window-minibuffer-p w)
- (not (minibuffer-window-active-p w)))
- (save-excursion
- ;; Swallow the up-event.
- (read-event)
- (set-buffer (get-buffer-create "*Messages*"))
- (goto-char (point-max))
- (display-buffer (current-buffer)))
- ;; Give temporary modes such as isearch a chance to turn off.
- (run-hooks 'mouse-leave-buffer-hook)
- (mouse-drag-track start-event t))))
+ ;; Give temporary modes such as isearch a chance to turn off.
+ (run-hooks 'mouse-leave-buffer-hook)
+ (mouse-drag-track start-event t))
(defun mouse-posn-property (pos property)
diff --git a/src/ChangeLog b/src/ChangeLog
index 414b59008fd..852b5cd18fc 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2011-06-01 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * minibuf.c (get_minibuffer, read_minibuf_unwind):
+ Call minibuffer-inactive-mode.
+
2011-05-31 Juanma Barranquero <lekktu@gmail.com>
* makefile.w32-in ($(BLD)/data.$(O), $(BLD)/editfns.$(O)):
@@ -181,7 +186,7 @@
merge count_size_as_multibyte, parse_str_to_multibyte
* character.c, character.h (count_size_as_multibyte):
- Renamed from parse_str_to_multibyte; all uses changed.
+ Rename from parse_str_to_multibyte; all uses changed.
Check for integer overflow.
* insdel.c, lisp.h (count_size_as_multibyte): Remove,
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. */)
}
-/* Actual minibuffer invocation. */
+/* Actual minibuffer invocation. */
static Lisp_Object read_minibuf_unwind (Lisp_Object);
static Lisp_Object run_exit_minibuf_hook (Lisp_Object);
@@ -266,7 +266,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
error ("Error reading from stdin");
}
- /* If Lisp form desired instead of string, parse it. */
+ /* If Lisp form desired instead of string, parse it. */
if (expflag)
val = string_to_object (val, CONSP (defalt) ? XCAR (defalt) : defalt);
@@ -743,7 +743,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
}
}
- /* If Lisp form desired instead of string, parse it. */
+ /* If Lisp form desired instead of string, parse it. */
if (expflag)
val = string_to_object (val, defalt);
@@ -755,7 +755,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
/* Return a buffer to be used as the minibuffer at depth `depth'.
depth = 0 is the lowest allowed argument, and that is the value
- used for nonrecursive minibuffer invocations */
+ used for nonrecursive minibuffer invocations. */
Lisp_Object
get_minibuffer (int depth)
@@ -793,7 +793,10 @@ get_minibuffer (int depth)
reset_buffer (XBUFFER (buf));
record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
Fset_buffer (buf);
- Fkill_all_local_variables ();
+ if (!NILP (Ffboundp (intern ("minibuffer-inactive-mode"))))
+ call0 (intern ("minibuffer-inactive-mode"));
+ else
+ Fkill_all_local_variables ();
unbind_to (count, Qnil);
}
@@ -808,7 +811,7 @@ run_exit_minibuf_hook (Lisp_Object data)
}
/* This function is called on exiting minibuffer, whether normally or
- not, and it restores the current window, buffer, etc. */
+ not, and it restores the current window, buffer, etc. */
static Lisp_Object
read_minibuf_unwind (Lisp_Object data)
@@ -868,6 +871,12 @@ read_minibuf_unwind (Lisp_Object data)
windows_or_buffers_changed++;
XSETFASTINT (XWINDOW (window)->last_modified, 0);
XSETFASTINT (XWINDOW (window)->last_overlay_modified, 0);
+
+ /* In case the previous minibuffer displayed in this miniwindow is
+ dead, we may keep displaying this buffer (tho it's inactive), so reset it,
+ to make sure we don't leave around bindings and stuff which only
+ made sense during the read_minibuf invocation. */
+ call0 (intern ("minibuffer-inactive-mode"));
return Qnil;
}
@@ -978,7 +987,7 @@ Such arguments are used as in `read-from-minibuffer'.) */)
Qnil);
}
-/* Functions that use the minibuffer to read various things. */
+/* Functions that use the minibuffer to read various things. */
DEFUN ("read-string", Fread_string, Sread_string, 1, 5, 0,
doc: /* Read a string from the minibuffer, prompting with string PROMPT.
@@ -1146,7 +1155,7 @@ function, instead of the usual behavior. */)
args[1] = prompt;
args[2] = def;
args[3] = require_match;
- result = Ffuncall(4, args);
+ result = Ffuncall (4, args);
}
return unbind_to (count, result);
}
@@ -1233,10 +1242,10 @@ is used to further constrain the set of candidates. */)
while (1)
{
- /* Get the next element of the alist, obarray, or hash-table. */
- /* Exit the loop if the elements are all used up. */
+ /* Get the next element of the alist, obarray, or hash-table. */
+ /* Exit the loop if the elements are all used up. */
/* elt gets the alist element or symbol.
- eltstring gets the name to check as a completion. */
+ eltstring gets the name to check as a completion. */
if (type == list_table)
{
@@ -1278,7 +1287,7 @@ is used to further constrain the set of candidates. */)
elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++);
}
- /* Is this element a possible completion? */
+ /* Is this element a possible completion? */
if (SYMBOLP (eltstring))
eltstring = Fsymbol_name (eltstring);
@@ -1291,7 +1300,7 @@ is used to further constrain the set of candidates. */)
completion_ignore_case ? Qt : Qnil),
EQ (Qt, tem)))
{
- /* Yes. */
+ /* Yes. */
Lisp_Object regexps;
/* Ignore this element if it fails to match all the regexps. */
@@ -1313,7 +1322,7 @@ is used to further constrain the set of candidates. */)
}
/* Ignore this element if there is a predicate
- and the predicate doesn't like it. */
+ and the predicate doesn't like it. */
if (!NILP (predicate))
{
@@ -1415,7 +1424,7 @@ is used to further constrain the set of candidates. */)
}
if (NILP (bestmatch))
- return Qnil; /* No completions found */
+ return Qnil; /* No completions found. */
/* If we are ignoring case, and there is no exact match,
and no additional text was supplied,
don't change the case of what the user typed. */
@@ -1429,7 +1438,7 @@ is used to further constrain the set of candidates. */)
return Qt;
XSETFASTINT (zero, 0); /* Else extract the part in which */
- XSETFASTINT (end, bestmatchsize); /* all completions agree */
+ XSETFASTINT (end, bestmatchsize); /* all completions agree. */
return Fsubstring (bestmatch, zero, end);
}
@@ -1496,10 +1505,10 @@ with a space are ignored unless STRING itself starts with a space. */)
while (1)
{
- /* Get the next element of the alist, obarray, or hash-table. */
- /* Exit the loop if the elements are all used up. */
+ /* Get the next element of the alist, obarray, or hash-table. */
+ /* Exit the loop if the elements are all used up. */
/* elt gets the alist element or symbol.
- eltstring gets the name to check as a completion. */
+ eltstring gets the name to check as a completion. */
if (type == 1)
{
@@ -1541,7 +1550,7 @@ with a space are ignored unless STRING itself starts with a space. */)
elt = eltstring = HASH_KEY (XHASH_TABLE (collection), idx++);
}
- /* Is this element a possible completion? */
+ /* Is this element a possible completion? */
if (SYMBOLP (eltstring))
eltstring = Fsymbol_name (eltstring);
@@ -1561,7 +1570,7 @@ with a space are ignored unless STRING itself starts with a space. */)
completion_ignore_case ? Qt : Qnil),
EQ (Qt, tem)))
{
- /* Yes. */
+ /* Yes. */
Lisp_Object regexps;
/* 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. */)
}
/* Ignore this element if there is a predicate
- and the predicate doesn't like it. */
+ and the predicate doesn't like it. */
if (!NILP (predicate))
{
@@ -1604,7 +1613,7 @@ with a space are ignored unless STRING itself starts with a space. */)
}
if (NILP (tem)) continue;
}
- /* Ok => put it on the list. */
+ /* Ok => put it on the list. */
allmatches = Fcons (eltstring, allmatches);
}
}
@@ -1810,9 +1819,9 @@ the values STRING, PREDICATE and `lambda'. */)
if (SYMBOLP (tail))
while (1)
{
- if (EQ((Fcompare_strings (string, make_number (0), Qnil,
+ if (EQ (Fcompare_strings (string, make_number (0), Qnil,
Fsymbol_name (tail),
- make_number (0) , Qnil, Qt)),
+ make_number (0) , Qnil, Qt),
Qt))
{
tem = tail;
@@ -1836,11 +1845,11 @@ the values STRING, PREDICATE and `lambda'. */)
tem = HASH_KEY (h, i);
else
for (i = 0; i < HASH_TABLE_SIZE (h); ++i)
- if (!NILP (HASH_HASH (h, i)) &&
- EQ (Fcompare_strings (string, make_number (0), Qnil,
- HASH_KEY (h, i), make_number (0) , Qnil,
- completion_ignore_case ? Qt : Qnil),
- Qt))
+ if (!NILP (HASH_HASH (h, i))
+ && EQ (Fcompare_strings (string, make_number (0), Qnil,
+ HASH_KEY (h, i), make_number (0) , Qnil,
+ completion_ignore_case ? Qt : Qnil),
+ Qt))
{
tem = HASH_KEY (h, i);
break;
@@ -1887,7 +1896,7 @@ If the argument FLAG is nil, invoke `try-completion', if it's t, invoke
`all-completions', otherwise invoke `test-completion'.
The arguments STRING and PREDICATE are as in `try-completion',
-`all-completions', and `test-completion'. */)
+`all-completions', and `test-completion'. */)
(Lisp_Object string, Lisp_Object predicate, Lisp_Object flag)
{
if (NILP (flag))