comparison lisp/mb-depth.el @ 85085:20e6cbaf918a

(minibuf-depth-indicator-function): New variable. (minibuf-depth-setup-minibuffer): Use it.
author Juanma Barranquero <lekktu@gmail.com>
date Mon, 08 Oct 2007 14:44:49 +0000
parents baed8c5b63a7
children b9e8ab94c460
comparison
equal deleted inserted replaced
85084:ccf63a47cd32 85085:20e6cbaf918a
30 ;; the recursion depth in the minibuffer prompt. This is only 30 ;; the recursion depth in the minibuffer prompt. This is only
31 ;; useful if `enable-recursive-minibuffers' is non-nil. 31 ;; useful if `enable-recursive-minibuffers' is non-nil.
32 32
33 ;;; Code: 33 ;;; Code:
34 34
35 (defvar minibuf-depth-indicator-function nil
36 "If non-nil, function to set up the minibuffer depth indicator.
37 It is called with one argument, the minibuffer depth,
38 and must return a string.")
39
35 ;; An overlay covering the prompt. This is a buffer-local variable in 40 ;; An overlay covering the prompt. This is a buffer-local variable in
36 ;; each affected minibuffer. 41 ;; each affected minibuffer.
37 ;; 42 ;;
38 (defvar minibuf-depth-overlay) 43 (defvar minibuf-depth-overlay)
39 (make-variable-buffer-local 'minibuf-depth-overlay) 44 (make-variable-buffer-local 'minibuf-depth-overlay)
43 "Set up a minibuffer for `minibuffer-indicate-depth-mode'. 48 "Set up a minibuffer for `minibuffer-indicate-depth-mode'.
44 The prompt should already have been inserted." 49 The prompt should already have been inserted."
45 (when (> (minibuffer-depth) 1) 50 (when (> (minibuffer-depth) 1)
46 (setq minibuf-depth-overlay (make-overlay (point-min) (1+ (point-min)))) 51 (setq minibuf-depth-overlay (make-overlay (point-min) (1+ (point-min))))
47 (overlay-put minibuf-depth-overlay 'before-string 52 (overlay-put minibuf-depth-overlay 'before-string
48 (propertize (format "[%d]" (minibuffer-depth)) 53 (if minibuf-depth-indicator-function
49 'face 'highlight)) 54 (funcall minibuf-depth-indicator-function (minibuffer-depth))
55 (propertize (format "[%d]" (minibuffer-depth)) 'face 'highlight)))
50 (overlay-put minibuf-depth-overlay 'evaporate t))) 56 (overlay-put minibuf-depth-overlay 'evaporate t)))
51 57
52 ;;;###autoload 58 ;;;###autoload
53 (define-minor-mode minibuffer-indicate-depth-mode 59 (define-minor-mode minibuffer-indicate-depth-mode
54 "Toggle Minibuffer Indicate Depth mode. 60 "Toggle Minibuffer Indicate Depth mode.