diff --git a/.config/emacs/init.org b/.config/emacs/init.org index 6b34584..7959c57 100644 --- a/.config/emacs/init.org +++ b/.config/emacs/init.org @@ -663,6 +663,10 @@ weren't working, until I randomly saw this in someone's init.el (global-set-key (kbd "C-x l") 'joe/switch-other-buffer) +(straight-use-package 'iflipb) +(evil-global-set-key 'normal (kbd "C-n") 'iflipb-next-buffer) +(evil-global-set-key 'normal (kbd "C-p") 'iflipb-previous-buffer) + (save-place-mode t) (setq save-place-file (expand-file-name "places" user-emacs-directory)) #+end_src @@ -1428,6 +1432,37 @@ println!("Hello world"); (define-key inferior-python-mode-map (kbd "C-n") #'comint-next-input) (define-key inferior-python-mode-map (kbd "C-p") #'comint-previous-input) #+end_src> +*** C + +Design some basic functions for compiling. There's also a hook to close the popper window if there +are no warnings or errors. It will check if we are still in the compilation buffer as well as +whether the point hasn't been moved. This way, if I switched to another popper buffer, like vterm, +it doesn't close it. + +#+begin_src emacs-lisp +(straight-use-package 'disaster) +(defun joe/c-mode-hook () + (local-set-key (kbd "C-x c r") (defun joe/make-run () (interactive) (compile "make run"))) + (local-set-key (kbd "C-x c c") (defun joe/make () (interactive) (compile "make"))) + (electric-pair-local-mode t) + (c-toggle-comment-style -1)) +(add-hook 'c-mode-hook #'joe/c-mode-hook) + +(defun joe/close-compilation-if-no-warn-err (buffer string) + "Bury a compilation buffer if succeeded without warnings " + (if (and + (string-match "compilation" (buffer-name buffer)) + (string-match "finished" string) + (not + (with-current-buffer (current-buffer) + (search-forward "warning" nil t)))) + (run-with-timer 1.5 nil + (lambda () + (and (eq (point) 1) + (string-match "compilation" (buffer-name (current-buffer))) + (popper-close-latest)))))) +(add-hook 'compilation-finish-functions 'joe/close-compilation-if-no-warn-err) +#+end_src *** Rust #+begin_src emacs-lisp (straight-use-package 'rustic) @@ -1461,37 +1496,6 @@ println!("Hello world"); (setq lsp-rust-analyzer-display-reborrow-hints t) (setq lsp-rust-analyzer-cargo-watch-command "clippy")) #+end_src -*** C - -Design some basic functions for compiling. There's also a hook to close the popper window if there -are no warnings or errors. It will check if we are still in the compilation buffer as well as -whether the point hasn't been moved. This way, if I switched to another popper buffer, like vterm, -it doesn't close it. - -#+begin_src emacs-lisp -(straight-use-package 'disaster) -(defun joe/c-mode-hook () - (local-set-key (kbd "C-x c r") (defun joe/make-run () (interactive) (compile "make run"))) - (local-set-key (kbd "C-x c c") (defun joe/make () (interactive) (compile "make"))) - (electric-pair-local-mode t) - (c-toggle-comment-style -1)) -(add-hook 'c-mode-hook #'joe/c-mode-hook) - -(defun joe/close-compilation-if-no-warn-err (buffer string) - "Bury a compilation buffer if succeeded without warnings " - (if (and - (string-match "compilation" (buffer-name buffer)) - (string-match "finished" string) - (not - (with-current-buffer (current-buffer) - (search-forward "warning" nil t)))) - (run-with-timer 1.5 nil - (lambda () - (and (eq (point) 1) - (string-match "compilation" (buffer-name (current-buffer))) - (popper-close-latest)))))) -(add-hook 'compilation-finish-functions 'joe/close-compilation-if-no-warn-err) -#+end_src *** Haskell #+begin_src emacs-lisp (straight-use-package 'haskell-mode) @@ -1545,6 +1549,12 @@ and there's no need for a middle-man when it's already been implemented. ;; Use opam switch to lookup ocamlmerlin binary (setq merlin-command 'opam))) #+end_src +*** Clojure +#+begin_src emacs-lisp +(straight-use-package 'clojure-mode) +(straight-use-package 'cider) +(setq cider-show-error-buffer 'only-in-repl) +#+end_src *** FSharp #+begin_src emacs-lisp (straight-use-package 'fsharp-mode)