emacs: Programming enhancements to Lisp, C, Rust, and Clojure
This commit is contained in:
parent
3dc1582585
commit
e51d89105d
@ -2213,6 +2213,7 @@ These help speed eglot up apparently [[https://www.reddit.com/r/emacs/comments/1
|
||||
;; All this changes because we are using eglot now
|
||||
(when (boundp 'evil-mode)
|
||||
(evil-global-set-key 'normal (kbd "M-d") #'lsp-ui-doc-glance)
|
||||
(evil-global-set-key 'normal (kbd "M-D") #'lsp-describe-thing-at-point)
|
||||
(evil-global-set-key 'normal (kbd "M-r") #'lsp-rename)
|
||||
(evil-global-set-key 'insert (kbd "M-i") #'lsp-signature-activate)
|
||||
(evil-global-set-key 'normal (kbd "gD") #'xref-find-definitions-other-window)
|
||||
@ -2447,6 +2448,19 @@ And we do the rest here, including a macro
|
||||
#+begin_src emacs-lisp
|
||||
(setq sly-lisp-implementations '((sbcl ("/usr/local/bin/sbcl" "--dynamic-space-size" "4096"))
|
||||
(ecl ("/usr/bin/ecl"))))
|
||||
(defun joe/sly-copy-call-to-repl ()
|
||||
"Copy name/symbol of toplevel sexp to sly-mREPL and select sly-mREPL."
|
||||
(interactive)
|
||||
(let (string
|
||||
replwin)
|
||||
(save-excursion
|
||||
(beginning-of-defun)
|
||||
(forward-thing 'symbol 2)
|
||||
(setq string (format "(%s )" (thing-at-point 'symbol 'no-props))))
|
||||
(setq replwin (get-buffer-window (call-interactively #'sly-mrepl)))
|
||||
(with-selected-window replwin
|
||||
(insert string)
|
||||
(forward-char -1))))
|
||||
#+end_src
|
||||
*** Odin
|
||||
#+begin_src emacs-lisp
|
||||
@ -2476,13 +2490,25 @@ it doesn't close it.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(require 'disaster)
|
||||
(setq c-default-style "bsd")
|
||||
|
||||
(defun joe/disaster (arg)
|
||||
(interactive "P")
|
||||
(if arg
|
||||
(let ((disaster-cflags (concat disaster-cflags " -O2")))
|
||||
(disaster))
|
||||
(disaster)))
|
||||
|
||||
(defun joe/c-mode-hook ()
|
||||
(setq c-default-style "bsd")
|
||||
(define-key c-mode-map (kbd "C-c d") #'joe/disaster)
|
||||
(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)
|
||||
|
||||
(with-eval-after-load 'cc-mode
|
||||
(add-hook 'c-mode-hook #'joe/c-mode-hook))
|
||||
|
||||
#+end_src
|
||||
*** Python
|
||||
#+begin_src emacs-lisp
|
||||
@ -2509,10 +2535,21 @@ it doesn't close it.
|
||||
;; :host github
|
||||
;; :repo "serialdev/evcxr-mode"))
|
||||
|
||||
(defun joe/save-then-rustic-cargo-check ()
|
||||
"Save the buffer before recompiling"
|
||||
(interactive)
|
||||
(when (buffer-file-name)
|
||||
(save-buffer))
|
||||
(rustic-cargo-check))
|
||||
|
||||
(add-hook 'rust-mode-hook
|
||||
(lambda ()
|
||||
;; (evcxr-minor-mode)
|
||||
(electric-pair-local-mode)))
|
||||
(electric-pair-local-mode)
|
||||
(yas-minor-mode)
|
||||
(define-key rustic-mode-map (kbd "<f9>") #'joe/save-then-rustic-cargo-check)
|
||||
(define-key rustic-cargo-run-mode-map (kbd "<f9>") #'joe/save-then-rustic-cargo-check)
|
||||
(define-key rustic-mode-map (kbd "<f8>") #'joe/save-then-recompile)))
|
||||
|
||||
;; (with-eval-after-load 'rustic
|
||||
;; ;; Don't autostart
|
||||
@ -2944,20 +2981,25 @@ Org mode buffers have associated files.
|
||||
(ocaml . t)
|
||||
(python . t)
|
||||
(C . t)
|
||||
(lisp . t)
|
||||
(haskell . t)
|
||||
;; (rust . t)
|
||||
(rust . t)
|
||||
(clojure . t)
|
||||
(shell . t)))
|
||||
|
||||
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
|
||||
(add-to-list 'org-structure-template-alist '("cl" . "src common-lisp"))
|
||||
(add-to-list 'org-structure-template-alist '("ml" . "src ocaml"))
|
||||
(add-to-list 'org-structure-template-alist '("rs" . "src rust"))
|
||||
(add-to-list 'org-structure-template-alist '("py" . "src python"))
|
||||
(add-to-list 'org-structure-template-alist '("hs" . "src haskell"))
|
||||
(add-to-list 'org-structure-template-alist '("sh" . "src shell"))
|
||||
(add-to-list 'org-structure-template-alist '("cs" . "src csharp"))
|
||||
(add-to-list 'org-structure-template-alist '("clj" . "src clojure"))
|
||||
(add-to-list 'org-structure-template-alist '("cc" . "src C :includes stdio.h stdlib.h"))
|
||||
(setq org-edit-src-content-indentation 0)
|
||||
(setq org-src-window-setup 'current-window)
|
||||
(setq org-babel-lisp-eval-fn 'sly-eval)
|
||||
|
||||
#+end_src
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user