Article View: gnu.epoch.misc
Article #2201epoch menus under gwm
From: Colas Nahaboo
Date: Mon, 18 Feb 1991 18:56
Date: Mon, 18 Feb 1991 18:56
105 lines
4047 bytes
4047 bytes
Due to a strong headache preventing any efficient work, I played around with
Philippe Kaplan's code to add menus to epoch, and I adapted it to make gwm pop
menus. Here it is:
First, make a file named "epoch.gwm" in your gwm path (gwm path listed by
typing gwm -?) containing this code: (or just select it and "Exec Cut" it)
---------------------------------------- CUT HERE ---------------------------
;;; Code to communicate with epoch
;; Colas 1991-02-18
;; this needs the epoch code "epoch-exec.el" loaded into epoch
;; routine to send a string to be executed by epoch, supposed to be the
;; current window
(defun send-epoch (code)
(set-x-property "EPOCH_EXEC"
(+ "(let ((protect epoch::event-handler)) (unwind-protect "
code
"(setq epoch::event-handler protect))))"
)))
;; Menu package:
;; how to make a menu of epoch buffers to select current buffer
(defunq string-menu-make (args)
(pop-menu
(menu-make-from-list (+
'((pop-label-make "Epoch Screens"))
(mapfor s args (list 'item-make s (list 'send-epoch-switch-buffer s))
)))))
(defunq send-epoch-switch-buffer (name)
(send-epoch (+ "(switch-to-buffer \"" name "\")")
))
;; All done
(provide 'epoch)
---------------------------------------- CUT HERE ---------------------------
then, add this code to your .emacs (or epoch-profile....), and re-launch epoch
or execute the code. (there is no need to restart gwm)
---------------------------------------- CUT HERE ---------------------------
;;=============================================================================
;; Sane EPOCH_EXEC
;;=============================================================================
;; here we add a handler to read code from X properties without trashing
;; epoch in case of errors in sent code.
(defun epoch-exec::property-init ()
"private property to avoid handler lost from external error"
(push-property "EPOCH_EXEC"
(function
(lambda (type prop screen)
(let
(
(cw (selected-window))
(action (get-property prop screen))
)
(unwind-protect
(progn
(select-window (epoch::selected-window screen))
(and (stringp action) (eval (read action)))
)
(select-window cw)
))))))
(epoch-exec::property-init)
;; use by sending to X property EPOCH_EXEC the code:
;; (let ((protect epoch::event-handler))
;; (unwind-protect
;; (progn
;;
;; ... [code to excecute via the property] ...
;;
;; (setq epoch::event-handler protect))))
;;
;; Application: pop a menu with epoch buffers:
(defun gwm-choose-buffer (arg)
(let ((buflist (mapcar (function buffer-name) (buffer-list))))
(epoch::set-property "GWM_EXECUTE"
(concat "(progn (require 'epoch)(string-menu-make "
(prin1-to-string buflist) "))")
)))
(global-set-mouse mouse-right mouse-control-shift 'gwm-choose-buffer)
---------------------------------------- CUT HERE ---------------------------
And voila! providing that you are running gwm, pressing Ctrol-Shift-RightButton
will pop up a menu of all existing buffer to allow you to choose from...
NOTE: I do NOT say that this is the best or recommanded way to have menus
under epoch, it is just an answer to question I saw many times emerging of the
epoch or gwm lists...
Colas Nahaboo, colas@sa.inria.fr, Bull Research, Koala Project, GWM X11 WM
Phone:(33) 93.65.77.70(.66 Fax), INRIA, B.P.109 - 06561 Valbonne Cedex, FRANCE.
Technical Details
Message-ID:
<9102181657.AA29120@avahi.inria.fr>Path:
arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!AVAHI.INRIA.FR!colasShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc7ee,67142700b175b602,start X-Google-Attributes: gidfc7ee,public X-Google-ArrivalTime: 1991-02-18 14:08:18 PST Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!tut.cis.ohio-state.edu!AVAHI.INRIA.FR!colas From: colas@AVAHI.INRIA.FR (Colas Nahaboo) Newsgroups: gnu.epoch.misc Subject: epoch menus under gwm Message-ID: <9102181657.AA29120@avahi.inria.fr> Date: 18 Feb 91 18:56:59 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 105