From 74f3e40d940c863a26407a0cd954a11d84bc86f8 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Thu, 16 Oct 2014 14:19:49 +0100 Subject: [PATCH] better interface for squeeze and squeeze-control address and port arguments, and read them from the user if a prefix argument is given --- squeeze.el | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/squeeze.el b/squeeze.el index 415d569..cdfb86d 100644 --- a/squeeze.el +++ b/squeeze.el @@ -407,17 +407,33 @@ "favorites" )))) -(defun squeeze () +(defun squeeze-read-server-parameters (address port) + (let ((host (read-string "Host: " nil nil address)) + (port (read-number "Port: " port))) + (cons host port))) + +(defun squeeze (&optional address port) (interactive) - (let ((buffer (make-comint-in-buffer "squeeze" nil - (cons squeeze-server-address - squeeze-server-port)))) + (unless address (setq address squeeze-server-address)) + (unless port (setq port squeeze-server-port)) + (when current-prefix-arg + (let ((parameters (squeeze-read-server-parameters address port))) + (setq address (car parameters) + port (cdr parameters)))) + (let ((buffer (make-comint-in-buffer "squeeze" nil (cons address port)))) (switch-to-buffer buffer) (squeeze-mode))) -(defun squeeze-control () +(defun squeeze-control (&optional address port) (interactive) - (squeeze) + (unless address (setq address squeeze-server-address)) + (unless port (setq port squeeze-server-port)) + (when current-prefix-arg + (let ((parameters (squeeze-read-server-parameters address port))) + (setq address (car parameters) + port (cdr parameters)))) + (let ((current-prefix-arg nil)) + (squeeze address port)) (let ((buffer (get-buffer-create "*squeeze-control*"))) (switch-to-buffer buffer) (squeeze-control-listen) -- 2.39.5