Re: Question about connecting to a node and proposed patch
Matthias Radestock <[email protected]> Fri, 29 Jun 2007 23:23:14 +0100
| Newsgroups | gmane.comp.lang.erlang.distel.devel |
|---|---|
| Message-ID | <[email protected]> |
Bill, Bill Clementson <[email protected]> writes: > Matthias Radestock <[email protected]> writes: >> So, to connect and reconnect just run 'M-x erl-ping'. To switch nodes >> (and connect) run 'C-u M-x erl-ping'. > > Works for me. Find attached a suitable patch. I've made the presence of a prefix arg a general trigger for all commands that accept a node. >> Any suggestions for a key-binding? 'C-c C-d @' or 'C-c C-d !' perhaps? > > "C-c C-d @" seems appropriate. Fine by me, though both "!" and "@" are shifted on many keyboards, which makes them less ideal. Anyway, I leave it up to you to pick a suitable key and check-in the whole lot. Regards, Matthias. ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Distel-hackers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/distel-hackers
erl-service.patch
(text/x-diff, 2 KB)
Index: elisp/erl-service.el
===================================================================
--- elisp/erl-service.el (revision 23)
+++ elisp/erl-service.el (working copy)
@@ -21,8 +21,10 @@
commands. Using C-u to bypasses the cache.")
(defun erl-target-node ()
- "Return the name of the default target node for commands."
- (or erl-nodename-cache
+ "Return the name of the default target node for commands.
+Force node selection if no such node has been choosen yet, or when
+invoked with a prefix argument."
+ (or (and (not current-prefix-arg) erl-nodename-cache)
(erl-choose-nodename)))
(defun erl-set-cookie ()
@@ -256,6 +258,19 @@
node
m f a))
+(defun erl-ping (node)
+ "Ping the NODE, uploading distel code as a side effect."
+ (interactive (list (erl-target-node)))
+ (erl-spawn
+ (erl-send-rpc node 'erlang 'node nil)
+ (erl-receive (node)
+ ((['rex response]
+ (if (equal node response)
+ (message "Successfully communicated with remote node %S"
+ node)
+ (message "Failed to communicate with node %S: %S"
+ node response)))))))
+
;;;; Process list
(defun erl-process-list (node)
@@ -1014,10 +1029,14 @@
"Face for function names in `fdoc' results."
:group 'distel)
+(defun maybe-select-db-rebuild ()
+ (and current-prefix-arg
+ (equal (read-string "Rebuild DB (yes/no)? " "no") "yes")))
+
(defun erl-fdoc-apropos (node regexp rebuild-db)
(interactive (list (erl-target-node)
(read-string "Regexp: ")
- current-prefix-arg))
+ (maybe-select-db-rebuild)))
(unless (string= regexp "")
(erl-spawn
(erl-send-rpc node 'distel 'apropos (list regexp
@@ -1069,9 +1088,8 @@
(defvar erl-mfa-regexp-arity-match 5)
(defun erl-fdoc-describe (node rebuild-db)
- (interactive
- (list (erl-target-node)
- current-prefix-arg))
+ (interactive (list (erl-target-node)
+ (maybe-select-db-rebuild)))
(let* ((mfa (erl-read-call-mfa))
(defaultstr (if (null mfa)
nil