Skip to content

Commit

Permalink
Improved histories and default values of socket read functions
Browse files Browse the repository at this point in the history
* socket/rudel-socket.el
  (rudel-tcp-ask-connect-info-host-history): new variable; history of
  hosts read
  (rudel-tcp-ask-connect-info-port-last): new variable; last prompt
  read
  (rudel-ask-connect-info): use
  `rudel-tcp-ask-connect-info-host-history' and
  `rudel-tcp-ask-connect-info-port-last' to provide default inputs and
  histories for host and port reading
  • Loading branch information
scymtym committed Aug 1, 2010
1 parent 9945709 commit 7059b87
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions socket/rudel-socket.el
Expand Up @@ -177,14 +177,31 @@ The transport backend is a factory for TCP transport objects.")


(oset this :version rudel-tcp-version)) (oset this :version rudel-tcp-version))


(defvar rudel-tcp-ask-connect-info-host-history nil
"History of hosts read by TCP backend's `rudel-ask-connect-info'.")

(defvar rudel-tcp-ask-connect-info-port-last nil
"Last port read by TCP backend's `rudel-ask-connect-info'.")

(defmethod rudel-ask-connect-info ((this rudel-tcp-backend) (defmethod rudel-ask-connect-info ((this rudel-tcp-backend)
&optional info) &optional info)
"Augment INFO by read a hostname and a port number." "Augment INFO by read a hostname and a port number."
;; Read server host and port. ;; Read server host and port.
(let ((host (or (plist-get info :host) (let ((host (or (plist-get info :host)
(read-string "Server: "))) (read-string
(if (car rudel-tcp-ask-connect-info-host-history)
(format "Server (default %s): "
(car rudel-tcp-ask-connect-info-host-history))
"Server: ")
nil
'rudel-tcp-ask-connect-info-host-history
(car rudel-tcp-ask-connect-info-host-history))))
(port (or (plist-get info :port) (port (or (plist-get info :port)
(read-number "Port: ")))) (setq
rudel-tcp-ask-connect-info-port-last
(read-number
"Port: "
rudel-tcp-ask-connect-info-port-last))))) ;; TODO rudel-read-port PROMPT CATEGORY ?
(append (list :host host (append (list :host host
:port port) :port port)
info))) info)))
Expand Down

0 comments on commit 7059b87

Please sign in to comment.