From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: feature request: indicator of minibuffer-recursion depth Date: Thu, 16 Mar 2006 22:35:53 +0100 Message-ID: References: <85mzfsk7qq.fsf@lola.goethe.zz> <85wtewf3oq.fsf@lola.goethe.zz> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1142545116 13268 80.91.229.2 (16 Mar 2006 21:38:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 16 Mar 2006 21:38:36 +0000 (UTC) Cc: Drew Adams , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 16 22:38:33 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FK0Aj-0002YI-SD for ged-emacs-devel@m.gmane.org; Thu, 16 Mar 2006 22:38:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FK0Aj-0003sF-BD for ged-emacs-devel@m.gmane.org; Thu, 16 Mar 2006 16:38:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FK0AN-0003qy-77 for emacs-devel@gnu.org; Thu, 16 Mar 2006 16:37:55 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FK0AL-0003qF-UN for emacs-devel@gnu.org; Thu, 16 Mar 2006 16:37:54 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FK0AL-0003q8-Nq for emacs-devel@gnu.org; Thu, 16 Mar 2006 16:37:53 -0500 Original-Received: from [195.41.46.235] (helo=pfepa.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FK0F1-0002f2-Cd; Thu, 16 Mar 2006 16:42:43 -0500 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepa.post.tele.dk (Postfix) with SMTP id 46AB3FAC04D; Thu, 16 Mar 2006 22:37:34 +0100 (CET) Original-To: Miles Bader In-Reply-To: (Miles Bader's message of "Thu, 16 Mar 2006 11:46:20 +0900") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:51717 Archived-At: Miles Bader writes: > ;;; minibuf-depth.el --- Indicate minibuffer-depth in prompt Very clever!! Thanks! I made a few changes: 1) rename file to mb-depth.el to avoid 8+3 conflict with minibuf-eldef.el 2) use propertized "[%d]" as depth>1 marker 3) added autoload cookie. I definitely think we should add this little gem. ;;; mb-depth.el --- Indicate minibuffer-depth in prompt ;; ;; Copyright (C) 2006 Free Software Foundation, Inc. ;; ;; Author: Miles Bader ;; Keywords: convenience ;; This file is part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;;; Commentary: ;; ;; Defines the minor mode `minibuffer-indicate-depth-mode'. ;; ;; When active, any recursive use of the minibuffer will show ;; the recursion depth in the minibuffer prompt. This is only ;; useful if `enable-recursive-minibuffers' is non-nil. ;;; Code: ;; An overlay covering the prompt. This is a buffer-local variable in ;; each affected minibuffer. ;; (defvar minibuf-depth-overlay) (make-variable-buffer-local 'minibuf-depth-overlay) ;; This function goes on minibuffer-setup-hook (defun minibuf-depth-setup-minibuffer () "Set up a minibuffer for `minibuffer-indicate-depth-mode'. The prompt should already have been inserted." (when (> (minibuffer-depth) 1) (setq minibuf-depth-overlay (make-overlay (point-min) (1+ (point-min)))) (overlay-put minibuf-depth-overlay 'before-string (propertize (format "[%d]" (minibuffer-depth)) 'face 'highlight)) (overlay-put minibuf-depth-overlay 'evaporate t))) ;;;###autoload (define-minor-mode minibuffer-indicate-depth-mode "Toggle Minibuffer Indicate Depth mode. When active, any recursive use of the minibuffer will show the recursion depth in the minibuffer prompt. This is only useful if `enable-recursive-minibuffers' is non-nil. With prefix argument ARG, turn on if positive, otherwise off. Returns non-nil if the new state is enabled." :global t :group 'minibuffer (if minibuffer-indicate-depth-mode ;; Enable the mode (add-hook 'minibuffer-setup-hook 'minibuf-depth-setup-minibuffer) ;; Disable the mode (remove-hook 'minibuffer-setup-hook 'minibuf-depth-setup-minibuffer))) (provide 'mb-depth) ;;; mb-depth.el ends here -- Kim F. Storm http://www.cua.dk