Skip to content

Instantly share code, notes, and snippets.

@teaforthecat
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teaforthecat/85c518b3164445602334 to your computer and use it in GitHub Desktop.
Save teaforthecat/85c518b3164445602334 to your computer and use it in GitHub Desktop.
neat idea to bookmark commands
;; 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