From 83d79357d8dac60bfe6dc3cd7caccd3712549424 Mon Sep 17 00:00:00 2001 From: ueno Date: Thu, 11 Aug 2005 04:34:00 +0000 Subject: [PATCH] * riece-ruby.el: Add docs for variables. (riece-ruby-substitute-variables): Substitute multiple variables. --- lisp/ChangeLog | 5 ++++ lisp/riece-ruby.el | 64 +++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 51 insertions(+), 18 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8628b54..870eec1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2005-08-11 Daiki Ueno + * riece-ruby.el: Add docs for variables. + (riece-ruby-substitute-variables): Substitute multiple variables. + +2005-08-11 Daiki Ueno + * server.rb: Renamed from rubyserv.rb; s/RubyServ/Server/. * riece-ruby.el (riece-ruby-server-program): Follow the filename change. diff --git a/lisp/riece-ruby.el b/lisp/riece-ruby.el index da209ca..37ebcd8 100644 --- a/lisp/riece-ruby.el +++ b/lisp/riece-ruby.el @@ -48,30 +48,58 @@ ;;; Code: -(defvar riece-ruby-command "ruby" - "Command name for Ruby interpreter.") +(defgroup riece-ruby nil + "Interact with the Ruby interpreter." + :group 'riece) -(defvar riece-ruby-server-program "server.rb") +(defcustom riece-ruby-command "ruby" + "Command name for Ruby interpreter." + :type 'string + :group 'riece-ruby) -(defvar riece-ruby-process nil) +(defvar riece-ruby-server-program "server.rb" + "The server program file. If the filename is not absolute, it is +assumed that the file is in the same directory of this file.") -(defvar riece-ruby-lock nil) -(defvar riece-ruby-response nil) -(defvar riece-ruby-data nil) -(defvar riece-ruby-escaped-data nil) -(defvar riece-ruby-status-alist nil) +(defvar riece-ruby-process nil + "Process object of the Ruby interpreter.") -(defvar riece-ruby-output-handler-alist nil) -(defvar riece-ruby-exit-handler-alist nil) +(defvar riece-ruby-lock nil + "Lock for waiting server response. +Local to the process buffer.") +(defvar riece-ruby-response nil + "The server response. +Local to the process buffer.") +(defvar riece-ruby-data nil + "Data from server. +Local to the process buffer.") +(defvar riece-ruby-escaped-data nil + "Escaped data from server. This variable is cleared every time +server response arrives. +Local to the process buffer.") +(defvar riece-ruby-status-alist nil + "Status from server. +Local to the process buffer.") -(defun riece-ruby-substitute-variables (program variable value) +(defvar riece-ruby-output-handler-alist nil + "An alist mapping from program name to output handler. +Output handlers are called every time \"# output\" line arrives. +Use `riece-ruby-set-output-handler' to set this variable.") +(defvar riece-ruby-exit-handler-alist nil + "An alist mapping from program name to exit handler. +Exit handlers are called once when \"# exit\" line arrives. +Use `riece-ruby-set-exit-handler' to set this variable.") + +(defun riece-ruby-substitute-variables (program alist) (setq program (copy-sequence program)) - (let ((pointer program)) - (while pointer - (setq pointer (memq variable program)) - (if pointer - (setcar pointer value))) - program)) + (while alist + (let ((pointer program)) + (while pointer + (setq pointer (memq (car (car alist)) program)) + (if pointer + (setcar pointer (cdr (car alist)))))) + (setq alist (cdr alist))) + (apply #'concat program)) (defun riece-ruby-escape-data (data) (let ((index 0)) -- 1.7.10.4