Date: Wed, 26 Jan 1994 12:25:34 +0100 Return-Path: owner-gwmtalk@sophia.inria.fr From: Sven Wischnowsky Message-Id: <199401261125.AA00332@mail.cs.tu-berlin.de> To: geroahde@w250zrz.zrz.TU-Berlin.DE Cc: gwm-talk@mirsa.inria.fr In-Reply-To: <9401241755.AA22923@w250zrz.zrz.TU-Berlin.DE> (message from Gero Guenther on Mon, 24 Jan 94 18:55:29 +0100) Subject: Re: gwm support for emacs-19.22 No-Reply-To: oberon@cs.tu-berlin.de Content-Length: 6754 Gero Guenther wrote: > Hello folks, > > are there patches available for emacs-19.22 > to support the wool-interaction-mode and the other comunication with > gwm I know from epoch? > > I lost the account with my addr on the mailinglist for gwm so please > respond with email or put me on the mailinglist again before > responding. > Well, not exactly... My solution to this problem was to patch gwm. Below is a patch for the gwm.c file (version 1.7o) which adds two new options: -I: this one makes gwm read its stdin (and, of course, evaluate it) -P: together with -I makes gwm print a simple prompt showing the number of currently open parentheses COLAS NOTE: these patches has been added in the current version... The rest is simple, something like this (in emacs): (defvar gwm-proc nil) (defvar gwm-buf nil) (if (not gwm-proc) (let ((b (generate-new-buffer "*gwm*")) (ob (current-buffer)) (m (copy-keymap lisp-mode-map))) (set-buffer b) (use-local-map m) (local-set-key "\C-j" 'gwm-send) (set-buffer ob) (setq gwm-buf b) (setq gwm-proc (start-process "gwm" b (if (string-equal system-type "usg-unix-v") "/home/pub/bin/sol2/gwm" "/home/pub/bin/sun4/gwm") "-I")) (process-kill-without-query gwm-proc) (set-process-filter gwm-proc 'gwm-filter) (set-process-sentinel gwm-proc 'gwm-sentinel))) (defun gwm-filter (p s) (let ((ob (current-buffer))) (unwind-protect (let ((i 0) (l (length s)) (p (point))) (set-buffer zg-buf) (insert s) (if (string-match "\012--emacs-exec:\012\\(.*\\)\012--end" s) (eval-region (+ p (match-beginning 1)) (+ p (match-end 1)))))) (set-buffer ob))) (defun gwm-sentinel (process message) (setq gwm-proc (start-process "gwm" gwm-buf (if (string-equal system-type "usg-unix-v") "/home/pub/bin/sol2/gwm" "/home/pub/bin/sun4/gwm") "-I")) (process-kill-without-query gwm-proc) (set-process-filter gwm-proc 'gwm-filter) (set-process-sentinel gwm-proc 'gwm-sentinel)) (defun gwm-exec (s) (interactive "Sgwm: ") (send-string gwm-proc (concat s "\n"))) (defun gwm-send () (interactive) (let ((op (point)) (stab (syntax-table))) (set-syntax-table emacs-lisp-mode-syntax-table) (forward-sexp -1) (gwm-exec (buffer-substring (point) op)) (goto-char op) (insert "\n") (set-syntax-table stab))) The filter function allows you to execute emacs code from gwm: (defun eval-emacs (s) (print "\n--emacs-exec:\n" s "\n--end\n")) Hope this helps... Bye Sven