Mercurial > hg > xemacs-beta
comparison lisp/gnuserv.el @ 369:1d62742628b6 r21-1-14
Import from CVS: tag r21-1-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:01:51 +0200 |
parents | a4f53d9b3154 |
children | cc15677e0335 |
comparison
equal
deleted
inserted
replaced
368:397a7324211a | 369:1d62742628b6 |
---|---|
1 ;;; gnuserv.el --- Lisp interface code between Emacs and gnuserv | 1 ;;; gnuserv.el --- Lisp interface code between Emacs and gnuserv |
2 ;; Copyright (C) 1989-1997 Free Software Foundation, Inc. | 2 ;; Copyright (C) 1989-1997 Free Software Foundation, Inc. |
3 | 3 |
4 ;; Version: 3.11 | 4 ;; Version: 3.12 |
5 ;; Author: Andy Norman (ange@hplb.hpl.hp.com), originally based on server.el | 5 ;; Author: Andy Norman (ange@hplb.hpl.hp.com), originally based on server.el |
6 ;; Hrvoje Niksic <hniksic@srce.hr> | 6 ;; Hrvoje Niksic <hniksic@srce.hr> |
7 ;; Maintainer: Jan Vroonhof <vroonhof@math.ethz.ch>, | 7 ;; Maintainer: Jan Vroonhof <vroonhof@math.ethz.ch>, |
8 ;; Hrvoje Niksic <hniksic@srce.hr> | 8 ;; Hrvoje Niksic <hniksic@srce.hr> |
9 ;; Keywords: environment, processes, terminals | 9 ;; Keywords: environment, processes, terminals |
335 ;; <text> - the actual contents of the request. | 335 ;; <text> - the actual contents of the request. |
336 (defun gnuserv-process-filter (proc string) | 336 (defun gnuserv-process-filter (proc string) |
337 "Process gnuserv client requests to execute Emacs commands." | 337 "Process gnuserv client requests to execute Emacs commands." |
338 (setq gnuserv-string (concat gnuserv-string string)) | 338 (setq gnuserv-string (concat gnuserv-string string)) |
339 ;; C-d means end of request. | 339 ;; C-d means end of request. |
340 (when (string-match "\C-d\\'" gnuserv-string) | 340 (when (string-match "\C-d\n?\\'" gnuserv-string) |
341 (cond ((string-match "^[0-9]+" gnuserv-string) ; client request id | 341 (cond ((string-match "\\`[0-9]+" gnuserv-string) ; client request id |
342 (let ((header (read-from-string gnuserv-string))) | 342 (let ((header (read-from-string gnuserv-string))) |
343 ;; Set the client we are talking to. | 343 ;; Set the client we are talking to. |
344 (setq gnuserv-current-client (car header)) | 344 (setq gnuserv-current-client (car header)) |
345 ;; Evaluate the expression | 345 ;; Evaluate the expression |
346 (condition-case oops | 346 (condition-case oops |
357 (gnuserv-write-to-client gnuserv-current-client oops)) | 357 (gnuserv-write-to-client gnuserv-current-client oops)) |
358 (setq gnuserv-current-client nil) | 358 (setq gnuserv-current-client nil) |
359 (signal 'quit nil))) | 359 (signal 'quit nil))) |
360 (setq gnuserv-string ""))) | 360 (setq gnuserv-string ""))) |
361 (t | 361 (t |
362 (error "%s: invalid response from gnuserv" gnuserv-string) | 362 (let ((response (car (split-string gnuserv-string "\C-d")))) |
363 (setq gnuserv-string ""))))) | 363 (setq gnuserv-string "") |
364 (error "%s: invalid response from gnuserv" response)))))) | |
364 | 365 |
365 ;; This function is somewhat of a misnomer. Actually, we write to the | 366 ;; This function is somewhat of a misnomer. Actually, we write to the |
366 ;; server (using `process-send-string' to gnuserv-process), which | 367 ;; server (using `process-send-string' to gnuserv-process), which |
367 ;; interprets what we say and forwards it to the client. The | 368 ;; interprets what we say and forwards it to the client. The |
368 ;; incantation server understands is (from gnuserv.c): | 369 ;; incantation server understands is (from gnuserv.c): |