Skip to content

Instantly share code, notes, and snippets.

@redraiment
Created July 4, 2014 03:23
Show Gist options
  • Save redraiment/afcde2fec8ce63697075 to your computer and use it in GitHub Desktop.
Save redraiment/afcde2fec8ce63697075 to your computer and use it in GitHub Desktop.
(defun current-sentence ()
(interactive)
(replace-regexp-in-string "\n" ";"
(substring-no-properties
(or (sentence-at-point)
(save-excursion
(backward-sentence)
(sentence-at-point))))))
(defun commit-last-js ()
(interactive)
(let ((sentence (current-sentence)))
(with-current-buffer "*shell*"
(insert sentence)
(comint-send-input))))
(defun eval-last-js ()
(local-set-key (kbd "C-x C-e") #'commit-last-js))
(add-hook 'js-mode-hook #'eval-last-js)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment