Permalink
Browse files

merge 313

  • Loading branch information...
2 parents 4a280f9 + 1cbb81e commit 96bf1eafef27782490dd8eec08d5563bb01a29d4 @tavisrudd committed Sep 21, 2011
Showing with 71 additions and 0 deletions.
  1. +15 −0 dss-buffer-and-window-handling.el
  2. +14 −0 dss-elisp-funcs.el
  3. +42 −0 dss-gentoo.el
@@ -39,6 +39,21 @@
(mapcar (lambda (fr) (if (string= (frame-parameter fr 'name) name) fr))
(frame-list)))))
+(defun dss/window-list ()
+ (interactive)
+ (mapc #'(lambda (f)
+ (insert (format "%S\n" f))
+ (let ((selectedw (frame-selected-window f)))
+ (mapc '(lambda (w)
+ (if (eq w selectedw)
+ (insert "*"))
+ (insert (format " %S" w))
+ (insert (format " %s" (buffer-name (window-buffer w))))
+ (insert (format ":%S\n" (window-point w))))
+ (window-list f))))
+ (frame-list)))
+
+;;; get-buffer-window-list
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun dss/kill-clean-buffer ()
(interactive)
View
@@ -20,4 +20,18 @@
(define-key mode-map k fname)))
keylist))
+
+(defun dss/call-command-with-input (command input-str out-buffer &rest args)
+ "A convenient wrapper around `call-process-region` that accepts a
+ string input instead of a buffer region"
+ (let ((args (or args "")))
+ (with-temp-buffer
+ (insert input-str)
+ (call-process-region
+ (point-min) (point-max) command nil out-buffer nil args))))
+
+(defun dss/async-call-command (command input &rest args)
+ "An asynchronous version of `dss/call-command-with-input`"
+ (apply 'dss/call-command-with-input (append (list command input 0) args)))
+
(provide 'dss-elisp-funcs)
View
@@ -0,0 +1,42 @@
+(require 'dss-elisp-funcs)
+(require 'dss-term)
+
+(defun dss/gentoo-eix-choice (prefix)
+ (interactive "sPattern:")
+ (let* ((eix-list
+ (split-string
+ (dss/local-shell-command-to-string
+ (concat
+ "eix --only-names '" prefix "'"))))
+ (choice (ido-completing-read "Which package: " eix-list)))
+ choice))
+
+(defun dss/gentoo-flagedit (pat)
+ (interactive "sPattern:")
+ (let ((choice (dss/gentoo-eix-choice pat)))
+ (dss/remote-term "root@localhost" (concat "flaggie " choice " +~amd64"))))
+
+(defun dss/gentoo-emerge (pat)
+ (interactive "sPattern:")
+ (let ((choice (dss/gentoo-eix-choice pat)))
+ (dss/remote-term "root@localhost" (concat "emerge -avuDN " choice))))
+
+(defun dss/gentoo-eix-sync ()
+ (interactive)
+ (dss/remote-term "root@localhost" "eix-sync\n"))
+
+(defun dss/gentoo-emerge-world ()
+ (interactive)
+ (dss/remote-term "root@localhost" "emerge -avuDN world\n"))
+
+(defun dss/gentoo-emerge-system ()
+ (interactive)
+ (dss/remote-term "root@localhost" "emerge -avuDN system\n"))
+
+(defun dss/gentoo-fix-system-time ()
+ (interactive)
+ (dss/remote-term
+ "root@localhost"
+ "date; /etc/init.d/ntpd stop; ntpdate tavismac; /etc/init.d/ntpd start; date\nsleep 3 && exit\n"))
+
+(provide 'dss-gentoo)

0 comments on commit 96bf1ea

Please sign in to comment.