Skip to content

Instantly share code, notes, and snippets.

@saidie
Last active December 24, 2015 13:56
Show Gist options
  • Save saidie/3f6445709c95ed9c268d to your computer and use it in GitHub Desktop.
Save saidie/3f6445709c95ed9c268d to your computer and use it in GitHub Desktop.
Command to create GitHub pull-request by hub command
(defun create-github-pull-request ()
(interactive)
(let ((buffer (get-buffer-create "*hub pull-request*"))
(cwd default-directory)
(my-local-map (make-keymap)))
(define-key my-local-map (kbd "C-c C-k")
'(lambda ()
(interactive)
(kill-buffer (current-buffer))))
(define-key my-local-map (kbd "C-c C-c")
'(lambda ()
(interactive)
(mark-whole-buffer)
(shell-command-on-region (point) (mark) "hub pull-request -F-")
(kill-buffer (current-buffer))))
(switch-to-buffer buffer)
(setq default-directory cwd)
(markdown-mode)
(insert-file-contents "~/.prrc")
(use-local-map my-local-map)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment