annotate lisp/utils/detached-minibuf.el @ 24:4103f0995bd7 r19-15b95

Import from CVS: tag r19-15b95
author cvs
date Mon, 13 Aug 2007 08:51:03 +0200
parents
children 9b50b4588a93
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
1 ;;; detached-minibuf.el -- Support a detached minibuffer for XEmacs.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
2
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
3 ;; Copyright (C) 1997 Alvin C. Shelton
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
4
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
5 ;; Author: Alvin Shelton <acs@acm.org>
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
6 ;; Keywords: extensions
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
7
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
9
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
13 ;; option) any later version.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
14
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
18 ;; General Public License for more details.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
19
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
21 ;; along with XEmacs; if not, write to the Free Software Foundation,
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
22 ;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
23
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
24 ;;; Synched up with: not in FSF.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
25
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
26 ;;; Commentary:
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
27
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
28 ;; WARNING. DANGER. This file reportedly crashes 19.14, use it only with a
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
29 ;; recent XEmacs.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
30
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
31 ;; Version: 1.1
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
32
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
33 ;;; Code:
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
34
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
35 ;;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
36 ;; Variable definitions
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
37
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
38 (defvar add-minibuf-options t
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
39 "*If nil, prevent minibuffer options from being added to the Options menu.\
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
40 This must be set before detached-minibuf is loaded.")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
41 (defvar minibuf-frame-height 1
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
42 "*The height in lines of the minibuffer frame created by make-detached-minibuf")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
43 (defvar minibuf-frame-width (frame-width (selected-frame))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
44 "*The width in chars of the minibuffer frame created by make-detached-minibuf")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
45 (defvar minibuf-frame-pos-y -2
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
46 "*The y position of the minibuffer frame as created by make-detached-minibuf")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
47 (defvar minibuf-frame-pos-x -2
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
48 "*The x position of the minibuffer frame as created by make-detached-minibuf")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
49
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
50 ;;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
51 ;; Add minibuffer options to the Options menu
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
52 (if add-minibuf-options
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
53 (progn
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
54 (defun toggle-minibuf ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
55 (interactive)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
56 (if (equal (frame-property (selected-frame) 'minibuffer) t)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
57
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
58 ;; This frame already has a minibuffer, so remove the minibuffer.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
59 ;; Unfortunately, we must delete and redraw the frame
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
60 (let ((fp (frame-properties (selected-frame)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
61 (buf (current-buffer))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
62 (orig (selected-frame)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
63
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
64 ;; Create and select the new frame;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
65 ;; we have to do this before we delete the old frame.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
66 (setq fp (plist-remprop fp 'window-id)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
67 fp (plist-remprop fp 'minibuffer))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
68 (select-frame
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
69 (make-frame (plist-put fp 'minibuffer nil)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
70 (switch-to-buffer buf)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
71
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
72 (set-frame-properties
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
73 orig (list 'minibuffer default-minibuffer-frame))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
74 (delete-frame orig t))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
75
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
76 ;; This frame does not have a minibuffer, so add one
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
77 (set-frame-property (selected-frame) 'minibuffer t)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
78
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
79 (add-menu-button '("Options" "Frame Appearance")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
80 ["------" nil nil]
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
81 nil)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
82 (add-menu-button '("Options" "Frame Appearance")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
83 ["Toggle minibuffer"
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
84 (toggle-minibuf)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
85 :style toggle
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
86 :active (not (equal (selected-frame)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
87 default-minibuffer-frame))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
88 :selected (equal
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
89 (frame-property (selected-frame) 'minibuffer)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
90 t)]
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
91 nil)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
92 (add-menu-button '("Options" "Frame Appearance")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
93 ["Default minibuffer here"
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
94 (setq default-minibuffer-frame (selected-frame))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
95 :style toggle
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
96 :active (let ((mbf (frame-property
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
97 (selected-frame) 'minibuffer)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
98 (or (equal mbf (selected-frame))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
99 (equal mbf t)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
100 :selected (equal (selected-frame)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
101 default-minibuffer-frame)]
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
102 nil)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
103 (add-menu-button '("Options" "Frame Appearance")
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
104 ["Make a detached minibuffer"
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
105 (make-detached-minibuf)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
106 :style nil]
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
107 nil)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
108
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
109 ;;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
110 ;; Create a minibuffer-only frame.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
111 ;;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
112 ;; This function creates a frame named "minibuffer".
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
113 ;; You will likely want this frame not to have a titlebar.
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
114 ;; In order to do this for gwm, uncomment the following line
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
115 ;; and add it to your .profile.gwm:
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
116 ;; (set-window Emacs.minibuffer no-frame)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
117 ;;
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
118 (defun make-detached-minibuf ()
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
119 "Create a standalone minibuffer"
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
120 (interactive)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
121 (if (console-on-window-system-p)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
122 (progn
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
123 (setq initial-frame-plist
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
124 (list 'minibuffer nil
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
125 'width (frame-width (selected-frame))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
126 'height (frame-height (selected-frame))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
127 (setq default-minibuffer-frame
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
128 (make-frame
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
129 (list 'minibuffer 'only
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
130 'width minibuf-frame-width
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
131 'height minibuf-frame-height
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
132 'menubar-visible-p nil
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
133 'default-toolbar-visible-p nil
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
134 'name "minibuffer"
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
135 'top minibuf-frame-pos-y
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
136 'left minibuf-frame-pos-x
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
137 'has-modeline-p nil)))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
138
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
139 ;; Bogus! But it avoids annoying screen flash at startup
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
140 (if (not command-line-args-left)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
141 (frame-notice-user-settings)))))
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
142
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
143 (provide 'detached-minibuf)
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
144
4103f0995bd7 Import from CVS: tag r19-15b95
cvs
parents:
diff changeset
145 ;;; detached-minibuf.el ends here