More emacs config work
This commit is contained in:
parent
a76d0afd00
commit
670a389747
4 changed files with 121 additions and 3 deletions
|
|
@ -317,7 +317,7 @@
|
|||
(turn-on-auto-fill)
|
||||
(flyspell-prog-mode)
|
||||
(define-key c-mode-base-map "\C-m" 'c-context-line-break)
|
||||
(set-fill-column 120)
|
||||
(set-fill-column 79)
|
||||
(local-set-key "}" 'indent-on-closing-bracket))
|
||||
|
||||
(add-hook 'c-mode-common-hook 'my-c-common-hook)
|
||||
|
|
@ -574,7 +574,7 @@
|
|||
|
||||
(defun my-nxml-hook ()
|
||||
(turn-on-auto-fill)
|
||||
(set-fill-column 120)
|
||||
(set-fill-column 79)
|
||||
|
||||
(local-set-key "\C-m" 'newline-and-indent)
|
||||
(local-set-key ">" 'nxml-indent-on-tag-close)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
((sequence "TODO" "|" "DONE" "ABANDONED" "DEFERRED"))))
|
||||
'(package-selected-packages
|
||||
(quote
|
||||
(thrift markdown-mode tuareg merlin ag use-package flycheck dockerfile-mode js2-mode ## web-mode ahg zencoding-mode tss switch-window python-mode paredit monky magit lua-mode go-mode go-autocomplete exec-path-from-shell csharp-mode color-theme-solarized color-theme-monokai auto-complete-nxml)))
|
||||
(sml-mode thrift markdown-mode tuareg merlin ag use-package flycheck dockerfile-mode js2-mode ## web-mode ahg zencoding-mode tss switch-window python-mode paredit monky magit lua-mode go-mode go-autocomplete exec-path-from-shell csharp-mode color-theme-solarized color-theme-monokai auto-complete-nxml)))
|
||||
'(quip-api-key
|
||||
"UU9RQU1Ba0pjR08=|1517609175|FmwD/EJT5K//+ntQqzVopKmzq/juUmBQsS2hsNi8MeQ=")
|
||||
'(rmail-mail-new-frame t)
|
||||
|
|
|
|||
3
.emacs.d/network-security.data
Normal file
3
.emacs.d/network-security.data
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(
|
||||
(:id "sha1:85457c729378cc93c732b6a3941c8e4f9c2e60f3" :fingerprint "sha1:ab:a6:d7:6a:b3:d3:63:fa:19:0d:65:41:60:23:6e:ef:d3:2a:46:dc" :host "marmalade-repo.org:443" :conditions (:unknown-ca :invalid))
|
||||
)
|
||||
115
.emacs.d/opam-user-setup.el
Normal file
115
.emacs.d/opam-user-setup.el
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
;; ## added by OPAM user-setup for emacs / base ## 2cfdcafda6d58f1dfe93a46e434ff502 ## you can edit, but keep this line
|
||||
(provide 'opam-user-setup)
|
||||
|
||||
;; 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 (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
|
||||
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 "sopam switch (empty to keep current setting): ")
|
||||
(let* ((switch-arg (if (= 0 (length switch)) "" (concat "--switch " switch)))
|
||||
(command (concat "opam config env --sexp " switch-arg))
|
||||
(env (opam-shell-command-to-string command)))
|
||||
(when 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)
|
||||
|
||||
(setq opam-share
|
||||
(let ((reply (opam-shell-command-to-string "opam config var share")))
|
||||
(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))
|
||||
|
||||
(setq 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))))
|
||||
|
||||
(setq 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue