You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

34 lines
1.2 KiB

  1. ;;-*-mode: emacs-lisp; coding: utf-8;-*-
  2. (add-hook 'rust-mode-hook '(lambda () (interactive) (column-marker-1 80)))
  3. (add-hook 'rust-mode-hook '(lambda ()
  4. (smartparens-mode)
  5. (auto-complete-mode)
  6. (hl-line-mode)
  7. (visual-line-mode)
  8. (whitespace-mode)
  9. (setq tab-width 8)
  10. (flycheck-mode)
  11. ))
  12. (defun rust-run-current-buffers-file ()
  13. "run a command on the current file"
  14. (interactive)
  15. (shell-command
  16. (format "rust run %s 2>&1 | grep -v 'no debug symbols in executable'"
  17. (shell-quote-argument (buffer-file-name))))
  18. )
  19. (defun rust-test-current-buffers-file ()
  20. "run a command on the current file"
  21. (interactive)
  22. (shell-command
  23. (format "rust test %s 2>&1 | grep -v 'no debug symbols in executable'"
  24. (shell-quote-argument (buffer-file-name))))
  25. )
  26. (eval-after-load 'rust-mode
  27. '(define-key rust-mode-map (kbd "C-c C-r") 'rust-run-current-buffers-file))
  28. (eval-after-load 'rust-mode
  29. '(define-key rust-mode-map (kbd "C-S-t") 'rust-test-current-buffers-file))