diff options
| author | benj <benj@rse8.com> | 2020-05-26 20:36:57 -0700 |
|---|---|---|
| committer | benj <benj@rse8.com> | 2020-05-26 20:36:57 -0700 |
| commit | a5f710d2e1080b5aee84b088cd87f5148f2dab30 (patch) | |
| tree | 176b373d2bac0e40816743692a2d27d439561c22 | |
| parent | a17ef07e9eb1d7870d2105ba9e978611e7858941 (diff) | |
| download | emacs-a5f710d2e1080b5aee84b088cd87f5148f2dab30.tar emacs-a5f710d2e1080b5aee84b088cd87f5148f2dab30.tar.gz emacs-a5f710d2e1080b5aee84b088cd87f5148f2dab30.tar.bz2 emacs-a5f710d2e1080b5aee84b088cd87f5148f2dab30.tar.lz emacs-a5f710d2e1080b5aee84b088cd87f5148f2dab30.tar.xz emacs-a5f710d2e1080b5aee84b088cd87f5148f2dab30.tar.zst emacs-a5f710d2e1080b5aee84b088cd87f5148f2dab30.zip | |
typescript, opam, dockerfile
Diffstat (limited to '')
| -rw-r--r-- | init.el | 8 | ||||
| -rw-r--r-- | settings/setup-ace-window-mode.el | 2 | ||||
| -rw-r--r-- | settings/setup-dockerfile-mode.el | 8 | ||||
| -rw-r--r-- | settings/setup-flycheck.el | 2 | ||||
| -rw-r--r-- | settings/setup-opam.el | 122 | ||||
| -rw-r--r-- | settings/setup-typescript-mode.el | 11 |
6 files changed, 152 insertions, 1 deletions
@@ -83,6 +83,7 @@ lsp-ui magit markdown-mode + merlin modern-cpp-font-lock multiple-cursors paredit @@ -103,6 +104,7 @@ terraform-mode treemacs treemacs-projectile + tuareg typescript-mode visual-regexp visual-regexp-steroids @@ -141,6 +143,7 @@ (require 'setup-c++-mode) (require 'setup-clojure-mode) (require 'setup-company-mode) +(require 'setup-dockerfile-mode) (require 'setup-ember-mode) (require 'setup-flycheck) (require 'setup-go-mode) @@ -163,11 +166,16 @@ (require 'setup-slime-mode) (require 'setup-terraform-mode) (require 'setup-treemacs) +(require 'setup-typescript-mode) (require 'setup-txt-mode) (require 'setup-web-mode) (require 'setup-yaml-mode) (require 'setup-yasnippet) +;; ## added by OPAM user-setup for emacs / base ## 56ab50dc8996d2bb95e7856a6eddb17b ## you can edit, but keep this line +(require 'setup-opam) +;; ## end of OPAM user-setup addition for emacs / base ## keep this line + ;; utility globals (require 'fetch-includes) (exec-path-from-shell-initialize) diff --git a/settings/setup-ace-window-mode.el b/settings/setup-ace-window-mode.el index 3735130..4fd3558 100644 --- a/settings/setup-ace-window-mode.el +++ b/settings/setup-ace-window-mode.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2018 Benj Bellon -;; Author: Benj Bellon <bbellon@bbellon-ld2.linkedin.biz> +;; Author: Benj Bellon ;; Keywords: lisp ;; This program is free software; you can redistribute it and/or modify diff --git a/settings/setup-dockerfile-mode.el b/settings/setup-dockerfile-mode.el new file mode 100644 index 0000000..1fc86e3 --- /dev/null +++ b/settings/setup-dockerfile-mode.el @@ -0,0 +1,8 @@ +;;; setup-dockerfile-mode.el --- -*- lexical-binding: t; -*- + +(add-hook 'dockerfile-mode-hook + (lambda () + (setq tab-width 2))) + +(provide 'setup-dockerfile-mode) +;;; setup-dockerfile-mode.el ends here diff --git a/settings/setup-flycheck.el b/settings/setup-flycheck.el index 764fe36..a050c3c 100644 --- a/settings/setup-flycheck.el +++ b/settings/setup-flycheck.el @@ -27,4 +27,6 @@ (global-set-key (kbd "<f2>") 'flyspell-auto-correct-previous-word) (setq flycheck-clangcheck-analyze t) +(add-hook 'sh-mode-hook 'flycheck-mode) + (provide 'setup-flycheck) diff --git a/settings/setup-opam.el b/settings/setup-opam.el new file mode 100644 index 0000000..f413d15 --- /dev/null +++ b/settings/setup-opam.el @@ -0,0 +1,122 @@ +;; ## added by OPAM user-setup for emacs / base ## cfd3c9b7837c85cffd0c59de521990f0 ## you can edit, but keep this line +(provide 'setup-opam) + +;; Base configuration for OPAM + +(defun opam-shell-command-to-string (command) + "Similar to shell-command-to-string, but returns nil unless the process + returned 0, and ignores stderr (shell-command-to-string ignores return value)" + (let* ((return-value 0) + (return-string + (with-output-to-string + (setq return-value + (with-current-buffer standard-output + (process-file shell-file-name nil '(t nil) nil + shell-command-switch command)))))) + (if (= return-value 0) return-string nil))) + +(defun opam-update-env (switch) + "Update the environment to follow current OPAM switch configuration" + (interactive + (list + (let ((default + (car (split-string (opam-shell-command-to-string "opam switch show --safe"))))) + (completing-read + (concat "opam switch (" default "): ") + (split-string (opam-shell-command-to-string "opam switch list -s --safe") "\n") + nil t nil nil default)))) + (let* ((switch-arg (if (= 0 (length switch)) "" (concat "--switch " switch))) + (command (concat "opam config env --safe --sexp " switch-arg)) + (env (opam-shell-command-to-string command))) + (when (and env (not (string= env ""))) + (dolist (var (car (read-from-string env))) + (setenv (car var) (cadr var)) + (when (string= (car var) "PATH") + (setq exec-path (split-string (cadr var) path-separator))))))) + +(opam-update-env nil) + +(defvar opam-share + (let ((reply (opam-shell-command-to-string "opam config var share --safe"))) + (when reply (substring reply 0 -1)))) + +(add-to-list 'load-path (concat opam-share "/emacs/site-lisp")) +;; OPAM-installed tools automated detection and initialisation + +(defun opam-setup-tuareg () + (add-to-list 'load-path (concat opam-share "/tuareg") t) + (load "tuareg-site-file")) + +(defun opam-setup-add-ocaml-hook (h) + (add-hook 'tuareg-mode-hook h t) + (add-hook 'caml-mode-hook h t)) + +(defun opam-setup-complete () + (if (require 'company nil t) + (opam-setup-add-ocaml-hook + (lambda () + (company-mode) + (defalias 'auto-complete 'company-complete))) + (require 'auto-complete nil t))) + +(defun opam-setup-ocp-indent () + (opam-setup-complete) + (autoload 'ocp-setup-indent "ocp-indent" "Improved indentation for Tuareg mode") + (autoload 'ocp-indent-caml-mode-setup "ocp-indent" "Improved indentation for Caml mode") + (add-hook 'tuareg-mode-hook 'ocp-setup-indent t) + (add-hook 'caml-mode-hook 'ocp-indent-caml-mode-setup t)) + +(defun opam-setup-ocp-index () + (autoload 'ocp-index-mode "ocp-index" "OCaml code browsing, documentation and completion based on build artefacts") + (opam-setup-add-ocaml-hook 'ocp-index-mode)) + +(defun opam-setup-merlin () + (opam-setup-complete) + (require 'merlin) + (opam-setup-add-ocaml-hook 'merlin-mode) + + (defcustom ocp-index-use-auto-complete nil + "Use auto-complete with ocp-index (disabled by default by opam-user-setup because merlin is in use)" + :group 'ocp_index) + (defcustom merlin-ac-setup 'easy + "Use auto-complete with merlin (enabled by default by opam-user-setup)" + :group 'merlin-ac) + + ;; So you can do it on a mac, where `C-<up>` and `C-<down>` are used + ;; by spaces. + (define-key merlin-mode-map + (kbd "C-c <up>") 'merlin-type-enclosing-go-up) + (define-key merlin-mode-map + (kbd "C-c <down>") 'merlin-type-enclosing-go-down) + (set-face-background 'merlin-type-face "skyblue")) + +(defun opam-setup-utop () + (autoload 'utop "utop" "Toplevel for OCaml" t) + (autoload 'utop-minor-mode "utop" "Minor mode for utop" t) + (add-hook 'tuareg-mode-hook 'utop-minor-mode)) + +(defvar opam-tools + '(("tuareg" . opam-setup-tuareg) + ("ocp-indent" . opam-setup-ocp-indent) + ("ocp-index" . opam-setup-ocp-index) + ("merlin" . opam-setup-merlin) + ("utop" . opam-setup-utop))) + +(defun opam-detect-installed-tools () + (let* + ((command "opam list --installed --short --safe --color=never") + (names (mapcar 'car opam-tools)) + (command-string (mapconcat 'identity (cons command names) " ")) + (reply (opam-shell-command-to-string command-string))) + (when reply (split-string reply)))) + +(defvar opam-tools-installed (opam-detect-installed-tools)) + +(defun opam-auto-tools-setup () + (interactive) + (dolist (tool opam-tools) + (when (member (car tool) opam-tools-installed) + (funcall (symbol-function (cdr tool)))))) + +(opam-auto-tools-setup) +;; ## end of OPAM user-setup addition for emacs / base ## keep this line diff --git a/settings/setup-typescript-mode.el b/settings/setup-typescript-mode.el new file mode 100644 index 0000000..31867b5 --- /dev/null +++ b/settings/setup-typescript-mode.el @@ -0,0 +1,11 @@ +(require 'typescript-mode) + +(defun indent-offset-ts () + (setq typescript-indent-level 2)) + +(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode)) +(add-hook 'typescript-mode-hook 'indent-offset-ts) + + +(provide 'setup-typescript-mode) +;;; setup-typescript-mode.el ends here |
