Ocaml packages. Don't close vertico when embark kills buffer

This commit is contained in:
Joseph Ferano 2022-12-29 17:20:22 +07:00
parent 185ff896df
commit 98276c52f8
3 changed files with 53 additions and 2 deletions

View File

@ -283,7 +283,7 @@ Setup other stuff
(doom-modeline-set-modeline 'main 'default))) (doom-modeline-set-modeline 'main 'default)))
(dolist (mode '(dired-mode-hook lsp-help-mode-hook)) (dolist (mode '(dired-mode-hook lsp-help-mode-hook fundamental-mode-hook))
(add-hook mode (lambda () (setq truncate-lines t)))) (add-hook mode (lambda () (setq truncate-lines t))))
;; (straight-use-package 'centaur-tabs) ;; (straight-use-package 'centaur-tabs)
@ -534,6 +534,7 @@ Emacs is an great operating system, if only it had a good text editor...
(add-hook 'emacs-startup-hook (add-hook 'emacs-startup-hook
(lambda () (lambda ()
(evil-global-set-key 'normal (kbd "<leader>t") tab-prefix-map)
(evil-define-key 'normal 'global (evil-define-key 'normal 'global
(kbd "<leader>q") 'kill-buffer-and-window (kbd "<leader>q") 'kill-buffer-and-window
(kbd "<leader>k") 'kill-this-buffer (kbd "<leader>k") 'kill-this-buffer
@ -783,7 +784,6 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun
(evil-global-set-key 'normal (kbd "M-8") '(lambda () (interactive) (tab-bar-select-tab 8))) (evil-global-set-key 'normal (kbd "M-8") '(lambda () (interactive) (tab-bar-select-tab 8)))
(evil-global-set-key 'normal (kbd "M-9") '(lambda () (interactive) (tab-bar-select-tab 9))) (evil-global-set-key 'normal (kbd "M-9") '(lambda () (interactive) (tab-bar-select-tab 9)))
(evil-global-set-key 'normal (kbd "<leader>t") tab-prefix-map)
#+end_src #+end_src
** Projects ** Projects
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -851,6 +851,8 @@ Vertico Embark Marginalia Consult Orderless
(straight-use-package 'embark) (straight-use-package 'embark)
(setq embark-quit-after-action '((kill-buffer . nil)))
(defvar joe-mode-map (defvar joe-mode-map
(let ((map (make-sparse-keymap))) (let ((map (make-sparse-keymap)))
;; (define-key map (kbd "C-'") #'embark-act) ;; (define-key map (kbd "C-'") #'embark-act)
@ -1377,6 +1379,51 @@ it doesn't close it.
(straight-use-package 'fsharp-mode) (straight-use-package 'fsharp-mode)
;; (straight-use-package 'eglot-fsharp) ;; (straight-use-package 'eglot-fsharp)
#+end_src
*** OCaml
#+begin_src emacs-lisp
(straight-use-package 'tuareg)
(straight-use-package 'dune)
(straight-use-package 'utop)
(straight-use-package 'merlin)
(straight-use-package 'merlin-eldoc)
;; Might be worth checking out, depeding on whether we stick with flycheck or not
;; (straight-use-package 'flycheck-ocaml)
;; Also check this out, see if it adds anything
;; (require 'ocp-indent)
(defun opam-env ()
"Load the opam env to get the PATH variables so everything works"
(interactive nil)
(dolist (var
(car (read-from-string
(shell-command-to-string "opam config env --sexp"))))
(setenv (car var) (cadr var))))
(setq opam-share
(substring (shell-command-to-string
"opam config var share 2> /dev/null") 0 -1))
(add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share))
(require 'utop)
#+end_src
We won't use the LSP server but rather directly talk to Merlin, since I guess LSP just wraps Merlin
and there's no need for a middle-man when it's already been implemented.
#+begin_src emacs-lisp
;; Use the opam installed utop
(setq utop-command "opam exec -- utop -emacs")
(let ((opam-share (ignore-errors (car (process-lines "opam" "var" "share")))))
(when (and opam-share (file-directory-p opam-share))
;; Register Merlin
(add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share))
(autoload 'merlin-mode "merlin" nil t nil)
;; Automatically start it in OCaml buffers
(add-hook 'tuareg-mode-hook 'merlin-mode t)
(add-hook 'caml-mode-hook 'merlin-mode t)
;; Use opam switch to lookup ocamlmerlin binary
(setq merlin-command 'opam)))
#+end_src #+end_src
*** Other *** Other
#+begin_src emacs-lisp #+begin_src emacs-lisp

View File

@ -80,3 +80,6 @@ function fish_prompt --description 'Write out the prompt; do not replace this. I
end end
set -q GHCUP_INSTALL_BASE_PREFIX[1]; or set GHCUP_INSTALL_BASE_PREFIX $HOME ; set -gx PATH $HOME/.cabal/bin $PATH /home/joe/.ghcup/bin # ghcup-env set -q GHCUP_INSTALL_BASE_PREFIX[1]; or set GHCUP_INSTALL_BASE_PREFIX $HOME ; set -gx PATH $HOME/.cabal/bin $PATH /home/joe/.ghcup/bin # ghcup-env
# opam configuration
source /home/joe/.local/share/opam/opam-init/init.fish > /dev/null 2> /dev/null; or true

View File

@ -4,6 +4,7 @@ SETUVAR EDITOR:hx
SETUVAR --export --path GOPATH:/home/joe/\x2elocal/share/go/ SETUVAR --export --path GOPATH:/home/joe/\x2elocal/share/go/
SETUVAR --export LC_COLLATE:C SETUVAR --export LC_COLLATE:C
SETUVAR --export NNN_FIFO:/tmp/nnn\x2efifo SETUVAR --export NNN_FIFO:/tmp/nnn\x2efifo
SETUVAR --export OPAMROOT:/home/joe/\x2elocal/share/opam/
SETUVAR --export VISUAL:hx SETUVAR --export VISUAL:hx
SETUVAR XDG_CACHE_HOME:/home/joe/\x2ecache SETUVAR XDG_CACHE_HOME:/home/joe/\x2ecache
SETUVAR XDG_CONFIG_HOME:/home/joe/\x2econfig SETUVAR XDG_CONFIG_HOME:/home/joe/\x2econfig