Thread View: gnu.epoch.misc
1 messages
1 total messages
Started by Colas Nahaboo
Mon, 18 Feb 1991 18:56
epoch menus under gwm
Author: 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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads