diff --git a/lib/extensions/john_titor.el b/lib/extensions/john_titor.el index aceeb4a..4b60f94 100644 --- a/lib/extensions/john_titor.el +++ b/lib/extensions/john_titor.el @@ -15,7 +15,7 @@ ;; Extension ------------------------------------- (extension john_titor :version "2.32" - :on-initialize extensions/john_titor-initialize + :on-initialize extensions/john-titor-initialize :docs "lib/extensions/john_titor/readme.org") (provide 'extensions/john_titor) diff --git a/lib/extensions/john_titor/#init.el# b/lib/extensions/john_titor/#init.el# deleted file mode 100644 index 3e0fbf7..0000000 --- a/lib/extensions/john_titor/#init.el# +++ /dev/null @@ -1,30 +0,0 @@ -;;; john_title --- Enables RPC for john titor client -;;; Commentary: -;;; Code: -(defvar epc-connection nil - "The EPC connection to the john titor client.") - -(defun john_titor/connect () - "Connect to john titor via RPC." - (interactive) - (setq epc-connection - (epc:start-epc "node" '("../../..//john_titor/target/main.js")))) - -(message "%S" (epc:call-sync epc-connection 'echo '(10))) - -(defun john_titor/disconnect () - "Disconnect from the john titor client." - (interactive) - (epc:stop-epc epc-connection)) - - -;;;###autoload -(defun extensions/john_titor-initialize () - "Initialize the john_titor extention." - (require 'epc) - - (if (nilp epc-connection) - (john_titor/connect))) - -(provide 'extensions/john_titor/init) -;;; init.el ends here diff --git a/lib/extensions/john_titor/.#init.el b/lib/extensions/john_titor/.#init.el deleted file mode 120000 index 50bbafa..0000000 --- a/lib/extensions/john_titor/.#init.el +++ /dev/null @@ -1 +0,0 @@ -sameer.rahmani@MacBook-Pro-4.local.2114 \ No newline at end of file diff --git a/lib/extensions/john_titor/init.el b/lib/extensions/john_titor/init.el index f35a043..d71c91a 100644 --- a/lib/extensions/john_titor/init.el +++ b/lib/extensions/john_titor/init.el @@ -1,28 +1,26 @@ ;;; john_title --- Enables RPC for john titor client ;;; Commentary: ;;; Code: -(defvar epc-connection nil - "The EPC connection to the john titor client.") - -(defun john_titor/connect () +(defun john-titor-connect () "Connect to john titor via RPC." (interactive) - (setq epc-connection - (epc:start-epc "node" '("~/.fg42/john_titor/target/main.js")))) + (john_titor/connect)) -(defun john_titor/disconnect () + +(defun john-titor-disconnect () "Disconnect from the john titor client." (interactive) - (epc:stop-epc epc-connection)) + (john_titor/disconnect)) ;;;###autoload -(defun extensions/john_titor-initialize () +(defun extensions/john-titor-initialize () "Initialize the john_titor extention." - (require 'epc) + (require 'john_titor) + + (when (nilp epc-connection) + (john-titor-connect))) - (if (nilp epc-connection) - (john_titor/connect))) (provide 'extensions/john_titor/init) ;;; init.el ends here diff --git a/lib/john_titor.el b/lib/john_titor.el new file mode 100644 index 0000000..85dbf4f --- /dev/null +++ b/lib/john_titor.el @@ -0,0 +1,31 @@ +;;; john_titor --- Enables RPC for john titor client +;;; Commentary: +;;; Code: +(require 'epc) + +(defvar epc-connection nil + "The EPC connection to the john titor client.") + +(defun john_titor/connect () + "Connect to john titor via RPC." + (setq epc-connection + (epc:start-epc "node" '("../../../john_titor/target/main.js")))) + +(defun john_titor/call-sync (command args) + "Call the given COMMAND with the given ARGS via john titor epc." + (epc:call-sync command args)) + + +(defun john_titor/call (command args f) + "Call the COMMAND with the given ARGS in async fashion and call F as callback." + (deferred:$ + (epc:call-deferred epc-connection command args) + (deferred:nextc it f))) + +(defun john_titor/disconnect () + "Disconnect from the john titor client." + (epc:stop-epc epc-connection)) + + +(provide 'john_titor) +;;; john_titor.el ends here