emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r104467: * lisp/minibuffer.el (minibu


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104467: * lisp/minibuffer.el (minibuffer-inactive-mode-map): New var.
Date: Wed, 01 Jun 2011 12:34:41 -0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104467
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2011-06-01 12:34:41 -0300
message:
  * 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.
modified:
  etc/NEWS
  lisp/ChangeLog
  lisp/minibuffer.el
  lisp/mouse.el
  src/ChangeLog
  src/minibuf.c
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2011-05-31 03:03:38 +0000
+++ b/etc/NEWS  2011-06-01 15:34:41 +0000
@@ -68,6 +68,10 @@
 
 * 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

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-06-01 14:19:45 +0000
+++ b/lisp/ChangeLog    2011-06-01 15:34:41 +0000
@@ -1,5 +1,11 @@
 2011-06-01  Stefan Monnier  <address@hidden>
 
+       * 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.

=== modified file 'lisp/minibuffer.el'
--- a/lisp/minibuffer.el        2011-05-31 21:40:30 +0000
+++ b/lisp/minibuffer.el        2011-06-01 15:34:41 +0000
@@ -1657,6 +1657,34 @@
   (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)

=== modified file 'lisp/mouse.el'
--- a/lisp/mouse.el     2011-04-23 03:07:16 +0000
+++ b/lisp/mouse.el     2011-06-01 15:34:41 +0000
@@ -278,7 +278,7 @@
 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 @@
 
 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)

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-05-31 17:03:24 +0000
+++ b/src/ChangeLog     2011-06-01 15:34:41 +0000
@@ -1,3 +1,8 @@
+2011-06-01  Stefan Monnier  <address@hidden>
+
+       * minibuf.c (get_minibuffer, read_minibuf_unwind):
+       Call minibuffer-inactive-mode.
+
 2011-05-31  Juanma Barranquero  <address@hidden>
 
        * 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

=== modified file 'src/minibuf.c'
--- a/src/minibuf.c     2011-05-31 03:03:38 +0000
+++ b/src/minibuf.c     2011-06-01 15:34:41 +0000
@@ -160,7 +160,7 @@
 }
 
 
-/* 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 @@
       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 @@
        }
     }
 
-  /* 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 @@
 
 /* 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 @@
       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 @@
 }
 
 /* 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 @@
   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 @@
                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 @@
       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 @@
 
   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 @@
            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 @@
                                      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 @@
          }
 
          /* 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 @@
   }
 
   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 @@
     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 @@
 
   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 @@
            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 @@
                                      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 @@
          }
 
          /* 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 @@
                }
              if (NILP (tem)) continue;
            }
-         /* Ok => put it on the list. */
+         /* Ok => put it on the list.  */
          allmatches = Fcons (eltstring, allmatches);
        }
     }
@@ -1810,9 +1819,9 @@
              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 @@
        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 @@
 `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))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]