annotate lisp/mb-depth.el @ 85511:f873840f9fea

* emulation/edt-mapper.el (function-key-map): (edt-map-key): Make it a function instead of using fset. Inline edt-gnu-map-key and edt-lucid-map-key. Use featurep 'xemacs. (edt-gnu-map-key, edt-lucid-map-key): Remove. (edt-x-emacs-p): Remove. (edt-emacs-variant, edt-window-system, edt-xserver): Use featurep 'xemacs. * net/eudc.el: Use (featurep 'xemacs) instead of the string test. Replace eudc-xemacs-p with its definition. (eudc-xemacs-p, eudc-emacs-p, eudc-xemacs-mule-p) (eudc-emacs-mule-p): Remove. (eudc-install-menu, eudc-mode): Replace eudc-emacs-p and eudc-xemacs-p with feature tests. * net/eudc-bob.el (eudc-bob-generic-menu, eudc-bob-mail-keymap) (eudc-bob-url-keymap, eudc-bob-sound-keymap) (eudc-bob-generic-keymap, eudc-bob-popup-menu) (eudc-bob-toggle-inline-display): * net/eudc-hotlist.el (eudc-hotlist-emacs-menu): Replace eudc-emacs-p and eudc-xemacs-p with feature tests. * net/eudcb-ph.el (eudc-ph-open-session): Replace eudc-xemacs-mule-p with its former definition. * progmodes/octave-mod.el (octave-xemacs-p): Remove. (octave-abbrev-start): Replace octave-xemacs-p with (featurep 'xemacs). * progmodes/vera-mode.el (vera-xemacs): Remove. (vera-mode-syntax-table): Replace vera-xemacs with (featurep 'xemacs). * progmodes/vhdl-mode.el (vhdl-xemacs): Remove. (vhdl-doc-mode, vhdl-doc-variable, vhdl-compile-init) (vhdl-speedbar-initialize, vhdl-ps-print-init) (vhdl-forward-comment, vhdl-mode-map-init, vhdl-show-messages) (vhdl-emacs-22, vhdl-emacs-21): Replace vhdl-xemacs with (featurep 'xemacs). * progmodes/antlr-mode.el (cond-emacs-xemacs-macfn, defunx) (save-buffer-state-x): * obsolete/fast-lock.el (fast-lock-verbose): * emulation/viper-init.el (viper-xemacs-p) (viper-cond-compile-for-xemacs-or-emacs): * emacs-lisp/checkdoc.el (checkdoc-minor-mode-map): * ps-print.el (case-fold-search): * ediff-hook.el (ediff-cond-compile-for-xemacs-or-emacs): * calculator.el (calculator-help): Use featurep 'xemacs.
author Dan Nicolaescu <dann@ics.uci.edu>
date Sun, 21 Oct 2007 17:22:04 +0000
parents 20e6cbaf918a
children b9e8ab94c460
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
81441
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
1 ;;; mb-depth.el --- Indicate minibuffer-depth in prompt
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
2 ;;
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
3 ;; Copyright (C) 2006, 2007 Free Software Foundation, Inc.
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
4 ;;
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
5 ;; Author: Miles Bader <miles@gnu.org>
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
6 ;; Keywords: convenience
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
7
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
9
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
82160
baed8c5b63a7 Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 81452
diff changeset
12 ;; the Free Software Foundation; either version 3, or (at your option)
81441
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
13 ;; any later version.
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
14
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
18 ;; GNU General Public License for more details.
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
19
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
23 ;; Boston, MA 02110-1301, USA.
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
24
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
25 ;;; Commentary:
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
26 ;;
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
27 ;; Defines the minor mode `minibuffer-indicate-depth-mode'.
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
28 ;;
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
29 ;; When active, any recursive use of the minibuffer will show
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
30 ;; the recursion depth in the minibuffer prompt. This is only
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
31 ;; useful if `enable-recursive-minibuffers' is non-nil.
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
32
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
33 ;;; Code:
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
34
85085
20e6cbaf918a (minibuf-depth-indicator-function): New variable.
Juanma Barranquero <lekktu@gmail.com>
parents: 82160
diff changeset
35 (defvar minibuf-depth-indicator-function nil
20e6cbaf918a (minibuf-depth-indicator-function): New variable.
Juanma Barranquero <lekktu@gmail.com>
parents: 82160
diff changeset
36 "If non-nil, function to set up the minibuffer depth indicator.
20e6cbaf918a (minibuf-depth-indicator-function): New variable.
Juanma Barranquero <lekktu@gmail.com>
parents: 82160
diff changeset
37 It is called with one argument, the minibuffer depth,
20e6cbaf918a (minibuf-depth-indicator-function): New variable.
Juanma Barranquero <lekktu@gmail.com>
parents: 82160
diff changeset
38 and must return a string.")
20e6cbaf918a (minibuf-depth-indicator-function): New variable.
Juanma Barranquero <lekktu@gmail.com>
parents: 82160
diff changeset
39
81441
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
40 ;; An overlay covering the prompt. This is a buffer-local variable in
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
41 ;; each affected minibuffer.
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
42 ;;
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
43 (defvar minibuf-depth-overlay)
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
44 (make-variable-buffer-local 'minibuf-depth-overlay)
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
45
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
46 ;; This function goes on minibuffer-setup-hook
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
47 (defun minibuf-depth-setup-minibuffer ()
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
48 "Set up a minibuffer for `minibuffer-indicate-depth-mode'.
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
49 The prompt should already have been inserted."
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
50 (when (> (minibuffer-depth) 1)
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
51 (setq minibuf-depth-overlay (make-overlay (point-min) (1+ (point-min))))
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
52 (overlay-put minibuf-depth-overlay 'before-string
85085
20e6cbaf918a (minibuf-depth-indicator-function): New variable.
Juanma Barranquero <lekktu@gmail.com>
parents: 82160
diff changeset
53 (if minibuf-depth-indicator-function
20e6cbaf918a (minibuf-depth-indicator-function): New variable.
Juanma Barranquero <lekktu@gmail.com>
parents: 82160
diff changeset
54 (funcall minibuf-depth-indicator-function (minibuffer-depth))
20e6cbaf918a (minibuf-depth-indicator-function): New variable.
Juanma Barranquero <lekktu@gmail.com>
parents: 82160
diff changeset
55 (propertize (format "[%d]" (minibuffer-depth)) 'face 'highlight)))
81441
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
56 (overlay-put minibuf-depth-overlay 'evaporate t)))
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
57
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
58 ;;;###autoload
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
59 (define-minor-mode minibuffer-indicate-depth-mode
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
60 "Toggle Minibuffer Indicate Depth mode.
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
61 When active, any recursive use of the minibuffer will show
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
62 the recursion depth in the minibuffer prompt. This is only
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
63 useful if `enable-recursive-minibuffers' is non-nil.
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
64
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
65 With prefix argument ARG, turn on if positive, otherwise off.
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
66 Returns non-nil if the new state is enabled."
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
67 :global t
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
68 :group 'minibuffer
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
69 (if minibuffer-indicate-depth-mode
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
70 ;; Enable the mode
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
71 (add-hook 'minibuffer-setup-hook 'minibuf-depth-setup-minibuffer)
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
72 ;; Disable the mode
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
73 (remove-hook 'minibuffer-setup-hook 'minibuf-depth-setup-minibuffer)))
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
74
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
75 (provide 'mb-depth)
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
76
81452
56a3f23e0e74 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 81441
diff changeset
77 ;; arch-tag: 50224089-5bf5-46f8-803d-18f018c5eacf
81441
cf1f1c774776 New file.
Kim F. Storm <storm@cua.dk>
parents:
diff changeset
78 ;;; mb-depth.el ends here