From eee08eb7b3c7cfade840c24a16377cf71e654c00 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 12 Jan 2017 14:04:20 -0800 Subject: [Emacs] Add a few more functions to work with 'nest' hosts. Add a function to open a dired buffer on a remote host, and a function to do that for nest. Also add a few functions to (un-)monitor hosts from Emacs. --- emacs.d/lib/funcs.el | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/emacs.d/lib/funcs.el b/emacs.d/lib/funcs.el index 0714888..bb7d211 100644 --- a/emacs.d/lib/funcs.el +++ b/emacs.d/lib/funcs.el @@ -90,6 +90,29 @@ Visit the file after creation." (defun fc/start-nest-tmp-file (file-name) "Create a file in ~/tmp on nest for the give file name." (interactive "sName of the temporary file: ") - (fc/start--file (expand-file-name (format "/nest:~/tmp/%s" file-name)))) + (fc/start--file (expand-file-name (format "/nest.smfc.twitter.com:~/tmp/%s" file-name)))) + +;; open dired buffer with tramp on remote host +(defun fc/remote--dired (host) + "Open dired on a remote host." + (dired (concat "/" host ":"))) + +(defun fc/remote-nest-dired () + "Open dired on nest." + (interactive) + (fc/remote--dired "nest.smfc.twitter.com")) + +;; un/monitor hosts by running mth remotely +(defun fc/silence-host (host) + (interactive "sHostname: ") + (let ((default-directory "/ssh:nest.smfc.twitter.com:")) + (start-file-process "mth" (get-buffer-create "*mth*") + "/usr/local/bin/mth" "silence" host "99 years"))) + +(defun fc/unsilence-host (host) + (interactive "sHostname: ") + (let ((default-directory "/ssh:nest.smfc.twitter.com:")) + (start-file-process "mth" (get-buffer-create "*mth*") + "/usr/local/bin/mth" "unsilence" host))) (provide 'funcs) -- cgit 1.4.1