emacs-devel
[Top][All Lists]
Advanced

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

Re: feature request: indicator of minibuffer-recursion depth


From: Miles Bader
Subject: Re: feature request: indicator of minibuffer-recursion depth
Date: Mon, 20 Mar 2006 11:39:46 +0900

Richard Stallman <address@hidden> writes:
> If this uses a variable to specify the string, it does not need
> to be a mode that you can enable or disable.  You could just set
> the variable to the empty string.
>
> That makes it so simple that it ought to be installed at the C level
> and this avoid needing to use a hook.

How about this:


orig = address@hidden/emacs--miles--0--patch-12

M  src/minibuf.c

* modified files

--- orig/src/minibuf.c
+++ mod/src/minibuf.c
@@ -123,6 +123,13 @@
 
 int minibuffer_auto_raise;
 
+/* A string used to indicate minibuffer depths greater than one.
+   It is passed to Fformat, along with the minibuffer depth, and the
+   resulting string added before the minibuffer prompt.  If it is not a
+   string, or its length is zero, then it is ignored.  */
+
+Lisp_Object Vminibuffer_depth_indicator;
+
 /* If last completion attempt reported "Complete but not unique"
    then this is the string completed then; otherwise this is nil.  */
 
@@ -141,6 +148,9 @@
 extern Lisp_Object Qmouse_face;
 
 extern Lisp_Object Qfield;
+
+extern Lisp_Object Qbefore_string;
+
 
 /* Put minibuf on currently selected frame's minibuffer.
    We do this whenever the user starts a new minibuffer
@@ -717,6 +727,24 @@
       && !NILP (Vrun_hooks))
     call1 (Vrun_hooks, Qminibuffer_setup_hook);
 
+  if (minibuf_level > 1
+      && STRINGP (Vminibuffer_depth_indicator)
+      && SCHARS (Vminibuffer_depth_indicator) > 0
+      && ZV > BEGV)
+    {
+      Lisp_Object args[4];
+      Lisp_Object ov;
+
+      ov = Fmake_overlay (make_number (BEGV), make_number (BEGV + 1),
+                         Qnil, Qnil, Qnil);
+
+      Foverlay_put (ov, Qevaporate, Qt);
+
+      args[0] = Vminibuffer_depth_indicator;
+      args[1] = make_number (minibuf_level);
+      Foverlay_put (ov, Qbefore_string, Fformat (2, args));
+    }
+
   /* Don't allow the user to undo past this point.  */
   current_buffer->undo_list = Qnil;
 
@@ -2902,6 +2930,13 @@
   Vminibuffer_prompt_properties
     = Fcons (intern ("read-only"), Fcons (Qt, Qnil));
 
+  DEFVAR_LISP ("minibuffer-depth-indicator", &Vminibuffer_depth_indicator,
+              doc: /* A string used to indicate minibuffer depths greater than 
one.
+It is passed to `format', along with the minibuffer depth, and the
+resulting string added before the minibuffer prompt.  If it is not a
+string, or its length is zero, then it is ignored.  */);
+    Vminibuffer_depth_indicator = Qnil;
+
   defsubr (&Sset_minibuffer_window);
   defsubr (&Sread_from_minibuffer);
   defsubr (&Seval_minibuffer);





-- 
"1971 pickup truck; will trade for guns"




reply via email to

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