Emacs config utilizing prelude as a base
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.

59 lines
1.8 KiB

  1. ;;; prelude-ts.el --- Emacs Prelude: Typescript programming support.
  2. ;;
  3. ;; Copyright © 2011-2018 LEE Dongjun
  4. ;;
  5. ;; Author: LEE Dongjun <redongjun@gmail.com>
  6. ;; Version: 1.0.0
  7. ;; Keywords: convenience typescript
  8. ;; This file is not part of GNU Emacs.
  9. ;;; Commentary:
  10. ;; Some basic configuration for Typescript development.
  11. ;;; License:
  12. ;; This program is free software; you can redistribute it and/or
  13. ;; modify it under the terms of the GNU General Public License
  14. ;; as published by the Free Software Foundation; either version 3
  15. ;; of the License, or (at your option) any later version.
  16. ;;
  17. ;; This program is distributed in the hope that it will be useful,
  18. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. ;; GNU General Public License for more details.
  21. ;;
  22. ;; You should have received a copy of the GNU General Public License
  23. ;; along with GNU Emacs; see the file COPYING. If not, write to the
  24. ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  25. ;; Boston, MA 02110-1301, USA.
  26. ;;; Code:
  27. (require 'prelude-programming)
  28. (prelude-require-packages '(tide))
  29. (require 'typescript-mode)
  30. (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))
  31. (with-eval-after-load 'typescript-mode
  32. (defun prelude-ts-mode-defaults ()
  33. (interactive)
  34. (tide-setup)
  35. (flycheck-mode +1)
  36. (setq flycheck-check-syntax-automatically '(save mode-enabled))
  37. (eldoc-mode +1)
  38. (tide-hl-identifier-mode +1))
  39. ;; formats the buffer before saving
  40. (add-hook 'before-save-hook 'tide-format-before-save)
  41. (setq prelude-ts-mode-hook 'prelude-ts-mode-defaults)
  42. (add-hook 'typescript-mode-hook (lambda () (run-hooks 'prelude-ts-mode-hook))))
  43. (provide 'prelude-ts)
  44. ;;; prelude-ts.el ends here