X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fgnuserv.el;h=238948072f3fe57cdbd127814895da9d58830e1a;hb=8ab0502c635e7792d113360e2ba8f58e8ddc2341;hp=b670e8de6b26ecb54d57ef6961e165af390fef1e;hpb=a5f466de30a3e927ed1146b0c7e3870e71465c8f;p=chise%2Fxemacs-chise.git.1 diff --git a/lisp/gnuserv.el b/lisp/gnuserv.el index b670e8d..2389480 100644 --- a/lisp/gnuserv.el +++ b/lisp/gnuserv.el @@ -1,11 +1,11 @@ ;;; gnuserv.el --- Lisp interface code between Emacs and gnuserv ;; Copyright (C) 1989-1997 Free Software Foundation, Inc. -;; Version: 3.11 +;; Version: 3.12 ;; Author: Andy Norman (ange@hplb.hpl.hp.com), originally based on server.el -;; Hrvoje Niksic +;; Hrvoje Niksic ;; Maintainer: Jan Vroonhof , -;; Hrvoje Niksic +;; Hrvoje Niksic ;; Keywords: environment, processes, terminals ;; This file is part of XEmacs. @@ -73,7 +73,7 @@ ;; Jan Vroonhof ;; Customized. ;; -;; Hrvoje Niksic May/1997 +;; Hrvoje Niksic May/1997 ;; Completely rewritten. Now uses `defstruct' and other CL stuff ;; to define clients cleanly. Many thanks to Dave Gillespie! ;; @@ -271,6 +271,7 @@ Each element is a gnuclient structure that identifies a client.") (defun gnuserv-main-frame-function (type) "Return a sensible value for the main Emacs frame." (if (or (eq type 'x) + (eq type 'gtk) (eq type 'mswindows)) (car (frame-list)) nil)) @@ -280,6 +281,7 @@ Each element is a gnuclient structure that identifies a client.") This is meant in the X sense, so it will not return frames that are on another visual screen. Totally visible frames are preferred. If none found, return nil." (if (or (eq type 'x) + (eq type 'gtk) (eq type 'mswindows)) (cond ((car (filtered-frame-list 'frame-totally-visible-p (selected-device)))) @@ -337,8 +339,8 @@ visual screen. Totally visible frames are preferred. If none found, return nil "Process gnuserv client requests to execute Emacs commands." (setq gnuserv-string (concat gnuserv-string string)) ;; C-d means end of request. - (when (string-match "\C-d\\'" gnuserv-string) - (cond ((string-match "^[0-9]+" gnuserv-string) ; client request id + (when (string-match "\C-d\n?\\'" gnuserv-string) + (cond ((string-match "\\`[0-9]+" gnuserv-string) ; client request id (let ((header (read-from-string gnuserv-string))) ;; Set the client we are talking to. (setq gnuserv-current-client (car header)) @@ -348,17 +350,20 @@ visual screen. Totally visible frames are preferred. If none found, return nil ;; In case of an error, write the description to the ;; client, and then signal it. (error (setq gnuserv-string "") - (gnuserv-write-to-client gnuserv-current-client oops) + (when gnuserv-current-client + (gnuserv-write-to-client gnuserv-current-client oops)) (setq gnuserv-current-client nil) (signal (car oops) (cdr oops))) (quit (setq gnuserv-string "") - (gnuserv-write-to-client gnuserv-current-client oops) + (when gnuserv-current-client + (gnuserv-write-to-client gnuserv-current-client oops)) (setq gnuserv-current-client nil) (signal 'quit nil))) (setq gnuserv-string ""))) (t - (error "%s: invalid response from gnuserv" gnuserv-string) - (setq gnuserv-string ""))))) + (let ((response (car (split-string gnuserv-string "\C-d")))) + (setq gnuserv-string "") + (error "%s: invalid response from gnuserv" response)))))) ;; This function is somewhat of a misnomer. Actually, we write to the ;; server (using `process-send-string' to gnuserv-process), which @@ -425,6 +430,7 @@ If a flag is `view', view the files read-only." ((null dest-frame) (case (car type) (tty (apply 'make-tty-device (cdr type))) + (gtk (make-gtk-device)) (x (make-x-device (cadr type))) (mswindows (make-mswindows-device)) (t (error "Invalid device type")))) @@ -440,6 +446,7 @@ If a flag is `view', view the files read-only." (client (make-gnuclient :id gnuserv-current-client :device device :frame new-frame))) + (select-frame frame) (setq gnuserv-current-client nil) ;; If the device was created by this client, push it to the list. (and (/= old-device-num (length (device-list)))