123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- (defvar minibuffer-depth-indicator-function nil
- "If non-nil, function to set up the minibuffer depth indicator.
- It is called with one argument, the minibuffer depth,
- and must return a string.")
- (defvar minibuffer-depth-overlay)
- (make-variable-buffer-local 'minibuffer-depth-overlay)
- (defun minibuffer-depth-setup ()
- "Set up a minibuffer for `minibuffer-depth-indicate-mode'.
- The prompt should already have been inserted."
- (when (> (minibuffer-depth) 1)
- (setq minibuffer-depth-overlay (make-overlay (point-min) (1+ (point-min))))
- (overlay-put minibuffer-depth-overlay 'before-string
- (if minibuffer-depth-indicator-function
- (funcall minibuffer-depth-indicator-function (minibuffer-depth))
- (propertize (format "[%d]" (minibuffer-depth)) 'face 'highlight)))
- (overlay-put minibuffer-depth-overlay 'evaporate t)))
- (define-minor-mode minibuffer-depth-indicate-mode
- "Toggle Minibuffer Depth Indication mode.
- With a prefix argument ARG, enable Minibuffer Depth Indication
- mode if ARG is positive, and disable it otherwise. If called
- from Lisp, enable the mode if ARG is omitted or nil.
- Minibuffer Depth Indication mode is a global minor mode. When
- enabled, 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."
- :global t
- :group 'minibuffer
- (if minibuffer-depth-indicate-mode
-
- (add-hook 'minibuffer-setup-hook 'minibuffer-depth-setup)
-
- (remove-hook 'minibuffer-setup-hook 'minibuffer-depth-setup)))
- (provide 'mb-depth)
|