Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 320 lines (257 sloc) 13.255 kb
dad7b04 converted DOS line-endings to Unix.
berndl authored
1 ;; ecb-winman-support.el - support of several window managers
2
f88254a - Removed Emacs 20.X support completely
berndl authored
3 ;; Copyright (C) 2000 - 2005 Klaus Berndl,
dad7b04 converted DOS line-endings to Unix.
berndl authored
4 ;; Free Software Foundation, Inc.
5
6 ;; Author: Klaus Berndl <klaus.berndl@sdm.de>
7 ;; Maintainer: Klaus Berndl <klaus.berndl@sdm.de>
8 ;; Keywords: browser, code, programming, tools, escreen, winring
9 ;; Created: 2003
10
11 ;; This program is free software; you can redistribute it and/or modify it under
12 ;; the terms of the GNU General Public License as published by the Free Software
13 ;; Foundation; either version 2, or (at your option) any later version.
14
15 ;; This program is distributed in the hope that it will be useful, but WITHOUT
16 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 ;; FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 ;; details.
19
20 ;; You should have received a copy of the GNU General Public License along with
21 ;; GNU Emacs; see the file COPYING. If not, write to the Free Software
22 ;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24 ;; $Id$
25
26 ;;; Commentary
27 ;;
28 ;; This library contains support for several window-managers so they interact
29 ;; well with ECB. Currently the following window-managers are supported by ECB:
30 ;; - winring.el: Written by Barry A. Warsaw <bwarsaw@python.org>, get it from
106f71b - Reworked the backbone for permanent advices (this fixes also a bug in ...
berndl authored
31 ;; http://www.python.org/emacs/winring
dad7b04 converted DOS line-endings to Unix.
berndl authored
32 ;; - escreen.el: Written by Noah Friedman <friedman@splode.com>, get it from
106f71b - Reworked the backbone for permanent advices (this fixes also a bug in ...
berndl authored
33 ;; http://www.splode.com/~friedman/software/emacs-lisp/#ui
dad7b04 converted DOS line-endings to Unix.
berndl authored
34 ;;
35 ;; Note: With one of these window-managers installed and active you can run
36 ;; applications like Gnus, VM or BBDB in the same frame as ECB! Just use
37 ;; different window-configurations (winring.el) or escreens (escreen.el) for
38 ;; ECB and the other applications. Especially with winring.el you can give
39 ;; every configuration a descriptive name like "ECB" or "Gnus" ; afterwards
40 ;; you can jump to a window-configuration by name!
41
42
43 ;;; Installation and enabling
44 ;;
45 ;; This library is installed autom. with ECB. But every support must be
46 ;; enabled explicitly:
47 ;; - winring: Call `ecb-winman-winring-enable-support'. This *must* be done
48 ;; *before* the first call to any winring-command, so also before calling
49 ;; `winring-initialize'!
50 ;; - escreen: Call `ecb-winman-escreen-enable-support'. This *must* be done
51 ;; *before* the first call to any escreen-command, so also before calling
52 ;; `escreen-install'!
53 ;;
54 ;; You can also put into your .emacs:
55 ;; (ecb-winman-winring-enable-support) or/and
56 ;; (ecb-winman-escreen-enable-support)
57
58 ;;; Deinstallation
59 ;;
60 ;; Just run `ecb-winman-escreen-disable-support' rsp.
61 ;; `ecb-winman-winring-disable-support'.
62
63
64 ;;; Usage
65 ;;
66 ;; After enabling the support of one of the supported window-managers just go
67 ;; on as described in the commentary or introduction of the respective
68 ;; library-file(s) of the window-manager. Here is a short description:
69
70 ;; - winring: Run `winring-initialize'. If ECB is active then the resulting
71 ;; window-configuration is the ECB-window-configuration. Otherwise you can
72 ;; create the ECB-window-configuration when you first time call
73 ;; `winring-new-configuration' with name equal to `ecb-winman-winring-name'.
74 ;; In general you can run all commands of the winring-library. If you jump
75 ;; to the ECB-window-configuration then ECB will be autom. activated and if
76 ;; you leave the ECB-window-configuration then ECB will autom. deactivated.
77
78 ;; - escreen: Run `escreen-install' (deactivates ECB if currently
79 ;; running), `escreen-create-screen', `escreen-goto-screen' etc. The latter
80 ;; ones activate autom. ECB if creating or selecting the escreen with number
81 ;; `ecb-escreen-number' (default = 1) and deactivate ECB autom. if leaving
82 ;; the ECB-escreen.
83
84
85 ;;; BUGS
86 ;;
87 ;; Currently not known
88
89
90 ;; Thanks to Johann "Myrkraverk" Oskarsson <myrkraverk@users.sourceforge.net>
d2bfd47 Prepared for running with cedet 1.0:
berndl authored
91 ;; for the first trigger for this support-library. He has suggested to
dad7b04 converted DOS line-endings to Unix.
berndl authored
92 ;; integrate ECB with escreen.
93
94
95 ;;; Code
96
97 (eval-when-compile
98 (require 'silentcomp))
99
100 (require 'ecb-util)
11071f9 latest fixes and changes for next release
berndl authored
101 (require 'ecb-common-browser)
dad7b04 converted DOS line-endings to Unix.
berndl authored
102
103 (silentcomp-defvar escreen-current-screen-number)
104
105
106 (defgroup ecb-winman-support nil
107 "Settings for supporting several window-managers.
108 Currently winring and escreen are supported."
109 :group 'ecb
110 :prefix "ecb-winman-")
111
112 (defcustom ecb-winman-escreen-number 1
113 "*Number of the escreen which is reserved for ECB.
114 If you go to the escreen with this number you go always to the escreen with
115 activated ECB. All other escreen-numbers are escreens with deactivated ECB!"
116 :group 'ecb-winman-support
a3a1715 Smarter and more flexible "other-window"-behavior
berndl authored
117 :group 'ecb-most-important
dad7b04 converted DOS line-endings to Unix.
berndl authored
118 :type 'integer)
119
120 (defcustom ecb-winman-winring-name "ECB"
121 "*Name of the winring-window-configuration reserved for ECB.
122 If you go to the window-configuration with this name you go always to the
123 window-configuration with activated ECB. All other window-configuration are
124 configurations with deactivated ECB!"
125 :group 'ecb-winman-support
a3a1715 Smarter and more flexible "other-window"-behavior
berndl authored
126 :group 'ecb-most-important
dad7b04 converted DOS line-endings to Unix.
berndl authored
127 :type 'string)
128
129 ;; support for the library escreen.el ----------------------------------------
130
d0bb095 - Added new advice-backbone (all)
berndl authored
131 (defecb-advice-set ecb-winman-escreen-adviced-functions
dad7b04 converted DOS line-endings to Unix.
berndl authored
132 "These functions of escreen are adviced if escreen is active during ECB is
106f71b - Reworked the backbone for permanent advices (this fixes also a bug in ...
berndl authored
133 active. This advice is a permanent advice set!"
134 t)
dad7b04 converted DOS line-endings to Unix.
berndl authored
135
136
137 (defun ecb-winman-escreen-enable-support ()
138 "Load the escreen-library and enable the ECB-support for it.
139 This does not install or activate escreen! For this you have still to call
140 `escreen-install'! For further documentation about escreen see the file
141 escreen.el!"
142 (interactive)
143 (if (locate-library "escreen")
144 (condition-case nil
145 (progn
146 (require 'escreen)
d0bb095 - Added new advice-backbone (all)
berndl authored
147 (ecb-enable-advices 'ecb-winman-escreen-adviced-functions)
dad7b04 converted DOS line-endings to Unix.
berndl authored
148 (add-hook 'escreen-goto-screen-hook
149 'ecb-winman-escreen-goto-escreen-hook)
6e4f25c New option `ecb-tree-mouse-action-trigger'.
berndl authored
150 (ecb-info-message "Support for escreen enabled."))
dad7b04 converted DOS line-endings to Unix.
berndl authored
151 (error
152 (ecb-winman-escreen-disable-support)
153 (ecb-error "The escreen-support can not be properly installed!")))
154 (ecb-error "The library escreen.el can not be found!")))
155
156
157 (defun ecb-winman-escreen-disable-support ()
158 "Disable the escreen-support of ECB."
159 (interactive)
106f71b - Reworked the backbone for permanent advices (this fixes also a bug in ...
berndl authored
160 (ecb-disable-advices 'ecb-winman-escreen-adviced-functions t)
dad7b04 converted DOS line-endings to Unix.
berndl authored
161 (when (featurep 'escreen)
162 (remove-hook 'escreen-goto-screen-hook
163 'ecb-winman-escreen-goto-escreen-hook)))
164
165
166 (defun ecb-winman-escreen-goto-escreen-hook ()
167 "Activate ECB if we go to the escreen with number `ecb-escreen-number'."
168 (if (and (boundp 'ecb-minor-mode)
169 (not ecb-minor-mode)
170 (= escreen-current-screen-number
171 ecb-winman-escreen-number))
5500aaa Added new features for next release: Modeline-window-commands for the
berndl authored
172 (let ((ecb-split-edit-window-after-start 'before-deactivation))
dad7b04 converted DOS line-endings to Unix.
berndl authored
173 (ecb-activate))))
174
d0bb095 - Added new advice-backbone (all)
berndl authored
175 (defecb-advice escreen-save-current-screen-configuration
176 before
177 ecb-winman-escreen-adviced-functions
dad7b04 converted DOS line-endings to Unix.
berndl authored
178 "escreen can only handle screen-configurations if ECB is deactivated. This
179 is because ECB handles its window-creation completely by itself and because it
180 uses dedicated windows. So we deactivate ECB before running this function."
181 (if (and (boundp 'ecb-minor-mode)
182 ecb-minor-mode
183 (equal ecb-frame (selected-frame)))
5500aaa Added new features for next release: Modeline-window-commands for the
berndl authored
184 (let ((ecb-split-edit-window-after-start 'before-deactivation))
dad7b04 converted DOS line-endings to Unix.
berndl authored
185 (ecb-deactivate))))
186
187 ;; support for the library winring.el ---------------------------------------
188
d0bb095 - Added new advice-backbone (all)
berndl authored
189 (defecb-advice-set ecb-winman-winring-adviced-functions
190 "These functions of winring are adviced if winring is active during ECB is
106f71b - Reworked the backbone for permanent advices (this fixes also a bug in ...
berndl authored
191 active. This advice is a permanent advice set!"
192 t)
dad7b04 converted DOS line-endings to Unix.
berndl authored
193
194 (defun ecb-winman-winring-enable-support ()
195 "Load the winring-library and enable the ECB-support for it.
196 This does not install or activate winring! For this you have still to call
197 `winring-initialize'! For further documentation about winring see the file
198 winring.el!"
199 (interactive)
200 (if (locate-library "winring")
201 (condition-case nil
202 (progn
203 (require 'winring)
d0bb095 - Added new advice-backbone (all)
berndl authored
204 (ecb-enable-advices 'ecb-winman-winring-adviced-functions)
6e4f25c New option `ecb-tree-mouse-action-trigger'.
berndl authored
205 (ecb-info-message "Support for winring enabled."))
dad7b04 converted DOS line-endings to Unix.
berndl authored
206 (error
207 (ecb-winman-winring-disable-support)
208 (ecb-error "The winring-support can not be properly installed!")))
209 (ecb-error "The library winring.el can not be found!")))
210
211 (defun ecb-winman-winring-disable-support ()
212 "Disable the winring-support of ECB."
213 (interactive)
106f71b - Reworked the backbone for permanent advices (this fixes also a bug in ...
berndl authored
214 (ecb-disable-advices 'ecb-winman-winring-adviced-functions t))
dad7b04 converted DOS line-endings to Unix.
berndl authored
215
216
217 (defvar ecb-winman-winring-ecb-frame nil
218 "Frame for which the ECB-window-configuration was set first time.")
219
d0bb095 - Added new advice-backbone (all)
berndl authored
220 (defecb-advice winring-set-name after ecb-winman-winring-adviced-functions
dad7b04 converted DOS line-endings to Unix.
berndl authored
221 "Store frame if name is equal with `ecb-winman-winring-name' and activate
222 ECB if we set the name `ecb-winman-winring-name'."
223 ;; Because this is an after advice of winring-name-of-current returns here
224 ;; already the new name!
eb96352 Added ecb-string< and ecb-string= with a ignore-case arg and replaces ea...
berndl authored
225 (when (ecb-string= (winring-name-of-current) ecb-winman-winring-name)
dad7b04 converted DOS line-endings to Unix.
berndl authored
226 ;; we do this only the first time
227 (when (null ecb-winman-winring-ecb-frame)
228 (setq ecb-winman-winring-ecb-frame
229 (or (ad-get-arg 1) (selected-frame))))
230 ;; now we activate ECB if necessary
231 (when (and (boundp 'ecb-minor-mode)
232 (not ecb-minor-mode)
233 (equal (or (ad-get-arg 1)
234 (selected-frame)) ecb-winman-winring-ecb-frame))
5500aaa Added new features for next release: Modeline-window-commands for the
berndl authored
235 (let ((ecb-split-edit-window-after-start 'before-deactivation))
dad7b04 converted DOS line-endings to Unix.
berndl authored
236 (ecb-activate)))))
237
d0bb095 - Added new advice-backbone (all)
berndl authored
238 (defecb-advice winring-duplicate-configuration before ecb-winman-winring-adviced-functions
dad7b04 converted DOS line-endings to Unix.
berndl authored
239 "Prevent the ECB-window-configuration from being duplicated."
eb96352 Added ecb-string< and ecb-string= with a ignore-case arg and replaces ea...
berndl authored
240 (if (ecb-string= (winring-name-of-current) ecb-winman-winring-name)
dad7b04 converted DOS line-endings to Unix.
berndl authored
241 (ecb-error "The ECB-window-configuration can not be duplicated!")))
242
d0bb095 - Added new advice-backbone (all)
berndl authored
243 (defecb-advice winring-restore-configuration before ecb-winman-winring-adviced-functions
dad7b04 converted DOS line-endings to Unix.
berndl authored
244 "Deactivates ECB if the ECB-window-configuration is active."
eb96352 Added ecb-string< and ecb-string= with a ignore-case arg and replaces ea...
berndl authored
245 (if (and (ecb-string= (winring-name-of-current) ecb-winman-winring-name)
dad7b04 converted DOS line-endings to Unix.
berndl authored
246 (boundp 'ecb-minor-mode)
247 ecb-minor-mode)
5500aaa Added new features for next release: Modeline-window-commands for the
berndl authored
248 (let ((ecb-split-edit-window-after-start 'before-deactivation))
dad7b04 converted DOS line-endings to Unix.
berndl authored
249 (ecb-deactivate))))
250
251
d0bb095 - Added new advice-backbone (all)
berndl authored
252 (defecb-advice winring-save-current-configuration before ecb-winman-winring-adviced-functions
dad7b04 converted DOS line-endings to Unix.
berndl authored
253 "winring can only handle window-configurations if ECB is deactivated. This
254 is because ECB handles its window-creation completely by itself and because it
255 uses dedicated windows. So we deactivate ECB before running this function."
256 (if (and (boundp 'ecb-minor-mode)
257 ecb-minor-mode
258 (equal ecb-frame (selected-frame)))
5500aaa Added new features for next release: Modeline-window-commands for the
berndl authored
259 (let ((ecb-split-edit-window-after-start 'before-deactivation))
dad7b04 converted DOS line-endings to Unix.
berndl authored
260 (ecb-deactivate))))
261
262
d0bb095 - Added new advice-backbone (all)
berndl authored
263 (defecb-advice winring-initialize after ecb-winman-winring-adviced-functions
dad7b04 converted DOS line-endings to Unix.
berndl authored
264 "If ECB is active when winring is initialized then this initial
265 window-configuration gets always the name `ecb-winman-winring-name'."
266 (if (and (boundp 'ecb-minor-mode)
267 ecb-minor-mode
268 (equal ecb-frame (selected-frame)))
269 (winring-set-name ecb-winman-winring-name)))
270
271
272 ;; not supported window-managing functions------------------------------------
273
d0bb095 - Added new advice-backbone (all)
berndl authored
274 (defecb-advice-set ecb-winman-not-supported-function-advices
275 "These function will be adviced so an error is reported when executed in the
106f71b - Reworked the backbone for permanent advices (this fixes also a bug in ...
berndl authored
276 ecb-frame. This advice is a permanent advice set!"
277 t)
d0bb095 - Added new advice-backbone (all)
berndl authored
278
279 (defecb-advice winner-mode before ecb-winman-not-supported-function-advices
dad7b04 converted DOS line-endings to Unix.
berndl authored
280 "Prevents `winner-mode' from being activated for the ECB-frame."
281 (if (equal (selected-frame) ecb-frame)
282 (ecb-error "Can't use winner-mode functions in the ecb-frame.")))
283
d0bb095 - Added new advice-backbone (all)
berndl authored
284 (defecb-advice winner-redo before ecb-winman-not-supported-function-advices
dad7b04 converted DOS line-endings to Unix.
berndl authored
285 "Prevents `winner-redo' from being used within the ECB-frame."
286 (if (equal (selected-frame) ecb-frame)
287 (ecb-error "Can't use winner-mode functions in the ecb-frame.")))
288
d0bb095 - Added new advice-backbone (all)
berndl authored
289 (defecb-advice winner-undo before ecb-winman-not-supported-function-advices
dad7b04 converted DOS line-endings to Unix.
berndl authored
290 "Prevents `winner-undo' from being used within the ECB-frame."
291 (if (equal (selected-frame) ecb-frame)
292 (ecb-error "Can't use winner-mode functions in the ecb-frame.")))
293
d0bb095 - Added new advice-backbone (all)
berndl authored
294 (when-ecb-running-xemacs
295 (defecb-advice push-window-configuration before ecb-winman-not-supported-function-advices
dad7b04 converted DOS line-endings to Unix.
berndl authored
296 (if (and (equal (selected-frame) ecb-frame)
85e6d2a @ware Introduce compatability layer for interactive-p
ware authored
297 (ecb-interactive-p))
dad7b04 converted DOS line-endings to Unix.
berndl authored
298 (ecb-error "Can't use interactive push-window-configuration in the ecb-frame.")))
299
d0bb095 - Added new advice-backbone (all)
berndl authored
300 (defecb-advice pop-window-configuration before ecb-winman-not-supported-function-advices
dad7b04 converted DOS line-endings to Unix.
berndl authored
301 (if (and (equal (selected-frame) ecb-frame)
85e6d2a @ware Introduce compatability layer for interactive-p
ware authored
302 (ecb-interactive-p))
dad7b04 converted DOS line-endings to Unix.
berndl authored
303 (ecb-error "Can't use interactive pop-window-configuration in the ecb-frame.")))
304
d0bb095 - Added new advice-backbone (all)
berndl authored
305 (defecb-advice unpop-window-configuration before ecb-winman-not-supported-function-advices
dad7b04 converted DOS line-endings to Unix.
berndl authored
306 (if (and (equal (selected-frame) ecb-frame)
85e6d2a @ware Introduce compatability layer for interactive-p
ware authored
307 (ecb-interactive-p))
dad7b04 converted DOS line-endings to Unix.
berndl authored
308 (ecb-error "Can't use interactive unpop-window-configuration in the ecb-frame.")))
309 )
310
311 ;; we disable all advices per default.
312
106f71b - Reworked the backbone for permanent advices (this fixes also a bug in ...
berndl authored
313 (ecb-disable-advices 'ecb-winman-winring-adviced-functions t)
314 (ecb-disable-advices 'ecb-winman-escreen-adviced-functions t)
315 (ecb-disable-advices 'ecb-winman-not-supported-function-advices t)
dad7b04 converted DOS line-endings to Unix.
berndl authored
316
317 (silentcomp-provide 'ecb-winman-support)
318
319 ;;; ecb-winman-support.el ends here
Something went wrong with that request. Please try again.