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: Juanma Barranquero
Subject: Re: feature request: indicator of minibuffer-recursion depth
Date: Fri, 15 Jun 2007 17:52:25 +0200

On 6/15/07, Kim F. Storm <address@hidden> wrote:

Done.

I've installed a slightly modified version (discussed back then) under the name 
of
mb-depth.el (to avoid 8.3 conflicts).

I was referring to this C patch by Miles, which Richard said to prefer
(and, honestly, I do too). I see no point in adding an elisp package
(and, worse, stuff to minibuffer-setup-hook) to avoid 15 or 20 lines
of very clean C code.

Could we please try that answer first? (I used it for months with no
problem whatsoever.)

            Juanma


Index: src/minibuf.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/minibuf.c,v
retrieving revision 1.314
diff -u -2 -r1.314 minibuf.c
--- src/minibuf.c       14 Nov 2006 19:25:39 -0000      1.314
+++ src/minibuf.c       15 Nov 2006 08:38:02 -0000
@@ -128,4 +128,11 @@
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.  */
@@ -151,4 +158,7 @@

extern Lisp_Object Qfield;
+
+extern Lisp_Object Qbefore_string;
+

/* Put minibuf on currently selected frame's minibuffer.
@@ -725,4 +735,22 @@
    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;
@@ -2948,4 +2976,11 @@
  Vread_expression_map = 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);

reply via email to

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