Advertisement
Guest User

Untitled

a guest
Dec 20th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. ;; C-c C-e
  2. (defun sparkling-eval-replace-expr (start end)
  3. "Evaluate the contents of the selected region (or the region between START and END) as an expression and replace it with the result."
  4. (interactive "r")
  5. (call-process "spn" nil t nil "-e" (delete-and-extract-region start end))
  6. )
  7.  
  8. ;; C-c C-r
  9. (defun sparkling-eval-replace-stmt (start end)
  10. "Evaluate the contents of the selected region (or the region between START and END) as statements and replace it with the result."
  11. (interactive "r")
  12. (call-process "spn" nil t nil "-t" "-r" (delete-and-extract-region start end))
  13. )
  14.  
  15. (defvar sparkling-eval-buffer-name "*sparkling-eval*")
  16.  
  17. ;; C-M-e
  18. (defun sparkling-eval-expr (start end)
  19. "Evaluate the contents of the selected region (or the region between START and END) as an expression."
  20. (interactive "r")
  21. (call-process "spn" nil sparkling-eval-buffer-name nil "-e" (buffer-substring start end))
  22. (switch-to-buffer-other-window sparkling-eval-buffer-name)
  23. )
  24.  
  25. ;; C-M-r
  26. (defun sparkling-eval-stmt (start end)
  27. "Evaluate the contents of the selected region (or the region between START and END) as statements."
  28. (interactive "r")
  29. (call-process "spn" nil sparkling-eval-buffer-name nil "-t" "-r" (buffer-substring start end))
  30. (switch-to-buffer-other-window sparkling-eval-buffer-name)
  31. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement