Skip to content
Browse files

Improved histories and default values of socket read functions

* 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
  (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...
1 parent 9945709 commit 7059b87eff653bb74561ac37d31c0dcf7df5ae3d @scymtym committed Aug 1, 2010
Showing with 19 additions and 2 deletions.
  1. +19 −2 socket/rudel-socket.el
21 socket/rudel-socket.el
@@ -177,14 +177,31 @@ The transport backend is a factory for TCP transport objects.")
(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)
&optional info)
"Augment INFO by read a hostname and a port number."
;; Read server host and port.
(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)
- (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
:port port)

0 comments on commit 7059b87

Please sign in to comment.
Something went wrong with that request. Please try again.