Last active
August 29, 2015 14:23
-
-
Save teaforthecat/85c518b3164445602334 to your computer and use it in GitHub Desktop.
neat idea to bookmark commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; not working: service is not found in services; | |
(let ((service (prodigy-define-service | |
:name "* head *" | |
:cwd "~/.emacs.d/lisp" | |
:command "head" | |
:args '("my-functions.el") | |
)) | |
) | |
(prodigy-start-service service)) | |
;; not working: service is not found in services; | |
(defun ct/bookmark-shell-command () | |
(interactive) | |
(let* ((bname (format "* %s *" (read-string "process buffer name: "))) | |
(working-directory (read-string (format "working directory[%s]: " default-directory) nil nil default-directory)) | |
(full-command (s-split " " (read-string "command: "))) | |
(command (car full-command)) | |
(args (cdr full-command))) | |
(bmkp-make-function-bookmark bname `(lambda () | |
(prodigy-define-service | |
:name ,bname | |
:cwd ,working-directory | |
:command ,command | |
:args (quote ,args)) | |
(prodigy-start-service ,bname) | |
)))) | |
;; working implementation without prodigy | |
(defun ct/bookmark-shell-command () | |
(interactive) | |
(let ((bname (format "* %s *" (read-string "process buffer name: "))) | |
(working-directory (read-string (format "working directory[%s]: " default-directory) nil default-directory)) | |
(command (read-string "command: "))) | |
(bmkp-make-function-bookmark bname `(lambda () | |
(let ((default-directory ,working-directory)) | |
(async-shell-command ,command ,bname)))))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment