diff options
| author | tslil clingman <tslil@posteo.de> | 2023-01-18 21:02:38 +0100 |
|---|---|---|
| committer | tslil clingman <tslil@posteo.de> | 2023-01-18 21:02:38 +0100 |
| commit | 67b505107e8c8075b409bdc7a7a8a0158caf4aa6 (patch) | |
| tree | 9fee55ff2f006da57ec8a9922b21d3d8257c362b /emacs | |
| parent | 67f463598e40139adcd70b074a8ee415310b402f (diff) | |
dwm config changes + emacs tweaks
Diffstat (limited to 'emacs')
| -rw-r--r-- | emacs/inits/20-programming.el | 345 |
1 files changed, 181 insertions, 164 deletions
diff --git a/emacs/inits/20-programming.el b/emacs/inits/20-programming.el index 9bea91e..e13ae8c 100644 --- a/emacs/inits/20-programming.el +++ b/emacs/inits/20-programming.el @@ -1,4 +1,4 @@ -;; Time-stamp: <2021-12-06 12h56 EST (hobbies)> +;; Time-stamp: <2023-01-18 20h59 CET (anker)> ;; ----------------------------------------------------------------------------- ;; General setup @@ -37,19 +37,29 @@ (use-package hideshow :bind (("C-c C-f C-f" . hs-toggle-hiding))) +;; (use-package origami +;; :ensure t +;; :bind (("C-c C-f C-f" . origami-recursively-toggle-node) +;; ("C-c C-f C-o" . origami-show-only-node) +;; ("C-c C-f C-u" . origami-undo) +;; ("C-c C-f C-r" . origami-redo)) +;; :config +;; (global-origami-mode -1)) + + ;; ----------------------------------------------------------------------------- ;; Specific packages (use-package shift-number :ensure t :bind (("C-c s p" . shift-number-up) - ("C-c s n" . shift-number-down))) + ("C-c s n" . shift-number-down))) (use-package comment-dwim-2 :ensure t :bind (("M-;" . comment-dwim-2)) :config (setq comment-multi-line t - comment-style 'extra-line)) + comment-style 'extra-line)) (use-package aggressive-indent :ensure t @@ -64,10 +74,10 @@ :defer t :config (setq electric-pair-delete-adjacent-pairs t - electric-pair-skip-self 'electric-pair-default-skip-self - electric-pair-preserve-balance t - electric-pair-skip-whitespace t - electric-pair-inhibit-predicate 'electric-pair-default-inhibit)) + electric-pair-skip-self 'electric-pair-default-skip-self + electric-pair-preserve-balance t + electric-pair-skip-whitespace t + electric-pair-inhibit-predicate 'electric-pair-default-inhibit)) (use-package lsp-mode :ensure t @@ -78,105 +88,106 @@ ;; ----------------------------------------------------------------------------- ;; C -;; What are these? -;; (setq gdb-show-threads-by-default nil -;; gdb-many-windows nil -;; gdb-show-main nil) +(use-package clang-format + :ensure t + :defer + :config + (setq clang-format-style "file")) (use-package cc-mode :defer t :bind (:map c-mode-map - ("M-/" . lh-matching-delim)) + ("M-/" . lh-matching-delim)) :hook (c-mode . (lambda () - (auto-fill-mode) - (set-fill-column 80) - (abbrev-mode 0) - (flycheck-mode 1) - (lsp) ;; clangd seems pretty good! - (c-toggle-hungry-state 1) - (c-toggle-electric-state 1) - (c-toggle-syntactic-indentation 1))) + (auto-fill-mode) + (set-fill-column 80) + (abbrev-mode 0) + (flycheck-mode 1) + (lsp) ;; clangd seems pretty good! + (c-toggle-hungry-state 1) + (c-toggle-electric-state 1) + (c-toggle-syntactic-indentation 1))) :config (c-add-style "gnu-mod" - '("gnu" - (c-basic-offset . 2) ; Guessed value - (c-offsets-alist - (block-close . 0) ; Guessed value - (case-label . +) ; Guessed value - (defun-block-intro . +) ; Guessed value - (defun-close . 0) ; Guessed value - (statement . 0) ; Guessed value - (statement-block-intro . +) ; Guessed value - (statement-case-intro . 0) ; Guessed value - (substatement . +) ; Guessed value - (topmost-intro . 0) ; Guessed value - (access-label . -) - (annotation-top-cont . 0) - (annotation-var-cont . +) - (arglist-close . c-lineup-close-paren) - (arglist-cont c-lineup-gcc-asm-reg 0) - (arglist-cont-nonempty . c-lineup-arglist) - (arglist-intro . +) - (block-open . 0) - (brace-entry-open . 0) - (brace-list-close . 0) - (brace-list-entry . 0) - (brace-list-intro . +) - (brace-list-open . 0) - (c . c-lineup-C-comments) - (catch-clause . 0) - (class-close . 0) - (class-open . 0) - (comment-intro . c-lineup-comment) - (composition-close . 0) - (composition-open . 0) - (cpp-define-intro c-lineup-cpp-define +) - (cpp-macro . -1000) - (cpp-macro-cont . +) - (defun-open . 0) - (do-while-closure . 0) - (else-clause . 0) - (extern-lang-close . 0) - (extern-lang-open . 0) - (friend . 0) - (func-decl-cont . +) - (inclass . +) - (incomposition . +) - (inexpr-class . +) - (inexpr-statement . +) - (inextern-lang . +) - (inher-cont . c-lineup-multi-inher) - (inher-intro . +) - (inlambda . 0) - (inline-close . 0) - (inline-open . +) - (inmodule . +) - (innamespace . +) - (knr-argdecl . 0) - (knr-argdecl-intro . +) - (label . 2) - (lambda-intro-cont . +) - (member-init-cont . c-lineup-multi-inher) - (member-init-intro . +) - (module-close . 0) - (module-open . 0) - (namespace-close . 0) - (namespace-open . 0) - (objc-method-args-cont . c-lineup-ObjC-method-args) - (objc-method-call-cont c-lineup-ObjC-method-call-colons c-lineup-ObjC-method-call +) - (objc-method-intro . [0]) - (statement-case-open . 0) - (statement-cont . +) - (stream-op . c-lineup-streamop) - (string . -1000) - (substatement-label . 2) - (substatement-open . +) - (template-args-cont c-lineup-template-args +) - (topmost-intro-cont . c-lineup-topmost-intro-cont)))) + '("gnu" + (c-basic-offset . 2) ; Guessed value + (c-offsets-alist + (block-close . 0) ; Guessed value + (case-label . +) ; Guessed value + (defun-block-intro . +) ; Guessed value + (defun-close . 0) ; Guessed value + (statement . 0) ; Guessed value + (statement-block-intro . +) ; Guessed value + (statement-case-intro . 0) ; Guessed value + (substatement . +) ; Guessed value + (topmost-intro . 0) ; Guessed value + (access-label . -) + (annotation-top-cont . 0) + (annotation-var-cont . +) + (arglist-close . c-lineup-close-paren) + (arglist-cont c-lineup-gcc-asm-reg 0) + (arglist-cont-nonempty . c-lineup-arglist) + (arglist-intro . +) + (block-open . 0) + (brace-entry-open . 0) + (brace-list-close . 0) + (brace-list-entry . 0) + (brace-list-intro . +) + (brace-list-open . 0) + (c . c-lineup-C-comments) + (catch-clause . 0) + (class-close . 0) + (class-open . 0) + (comment-intro . c-lineup-comment) + (composition-close . 0) + (composition-open . 0) + (cpp-define-intro c-lineup-cpp-define +) + (cpp-macro . -1000) + (cpp-macro-cont . +) + (defun-open . 0) + (do-while-closure . 0) + (else-clause . 0) + (extern-lang-close . 0) + (extern-lang-open . 0) + (friend . 0) + (func-decl-cont . +) + (inclass . +) + (incomposition . +) + (inexpr-class . +) + (inexpr-statement . +) + (inextern-lang . +) + (inher-cont . c-lineup-multi-inher) + (inher-intro . +) + (inlambda . 0) + (inline-close . 0) + (inline-open . +) + (inmodule . +) + (innamespace . +) + (knr-argdecl . 0) + (knr-argdecl-intro . +) + (label . 2) + (lambda-intro-cont . +) + (member-init-cont . c-lineup-multi-inher) + (member-init-intro . +) + (module-close . 0) + (module-open . 0) + (namespace-close . 0) + (namespace-open . 0) + (objc-method-args-cont . c-lineup-ObjC-method-args) + (objc-method-call-cont c-lineup-ObjC-method-call-colons c-lineup-ObjC-method-call +) + (objc-method-intro . [0]) + (statement-case-open . 0) + (statement-cont . +) + (stream-op . c-lineup-streamop) + (string . -1000) + (substatement-label . 2) + (substatement-open . +) + (template-args-cont c-lineup-template-args +) + (topmost-intro-cont . c-lineup-topmost-intro-cont)))) (setq c-default-style '((java-mode . "java") - (awk-mode . "awk") - (other . "gnu-mod")))) + (awk-mode . "awk") + (other . "gnu-mod")))) ;; ----------------------------------------------------------------------------- @@ -194,23 +205,23 @@ :ensure t :defer t :bind (:map rust-mode-map - ("M-," . lh-backward-delim) - ("M-." . lh-forward-delim) - ("M-/" . lh-matching-delim) - ("M-p" . beginning-of-defun) - ("M-n" . end-of-defun) - ("C-c C-c" . rust-compile) - ("C-c C-r" . rust-run)) + ("M-," . lh-backward-delim) + ("M-." . lh-forward-delim) + ("M-/" . lh-matching-delim) + ("M-p" . beginning-of-defun) + ("M-n" . end-of-defun) + ("C-c C-c" . rust-compile) + ("C-c C-r" . rust-run)) :hook (rust-mode . (lambda () - (cargo-minor-mode) - ;; For some reason this is not automatic - (setq-local electric-pair-pairs - (cons '(?' . ?') electric-pair-pairs)) - ;; Pair {} in rust format strings ... ? - (setq-local electric-pair-text-pairs - (cons '(?{ . ?}) electric-pair-pairs)) - (flycheck-rust-setup) - (lsp))) + (cargo-minor-mode) + ;; For some reason this is not automatic + (setq-local electric-pair-pairs + (cons '(?' . ?') electric-pair-pairs)) + ;; Pair {} in rust format strings ... ? + (setq-local electric-pair-text-pairs + (cons '(?{ . ?}) electric-pair-pairs)) + (flycheck-rust-setup) + (lsp))) :config (setq rust-indent-offset 4 rust-indent-method-chain t @@ -222,7 +233,6 @@ ;; ----------------------------------------------------------------------------- ;; Python - (use-package python-black :ensure t :after python @@ -235,7 +245,7 @@ :config (setq highlight-indent-guides-auto-odd-face-perc 1.5 ;; 10 highlight-indent-guides-auto-even-face-perc 3 ;; 15 -)) + )) (use-package python :hook (python-mode . (lambda () @@ -261,33 +271,33 @@ (interactive) (zig--run-cmd "build run")) :bind (:map zig-mode-map - ("M-," . lh-backward-delim) - ("M-." . lh-forward-delim) - ("M-/" . lh-matching-delim) - ("M-p" . beginning-of-defun) - ("M-n" . end-of-defun) - ("C-c C-c" . zig-compile) - ("C-c r" . zig-run) - ("C-c C-r" . my-zig-run)) + ("M-," . lh-backward-delim) + ("M-." . lh-forward-delim) + ("M-/" . lh-matching-delim) + ("M-p" . beginning-of-defun) + ("M-n" . end-of-defun) + ("C-c C-c" . zig-compile) + ("C-c r" . zig-run) + ("C-c C-r" . my-zig-run)) :config (require 'lsp) (setq zig-format-on-save nil - lsp-zig-zls-executable "~/prog/zig/zls/zig-out/bin/zls")) + lsp-zig-zls-executable "~/.local/bin/zls")) ;; ------------------------------------------------------------------- ;; OCaml -(use-package utop - :ensure t - :defer t - :config - (setq utop-command "opam config exec -- utop -emacs")) +;; (use-package utop +;; :ensure t +;; :defer t +;; :config +;; (setq utop-command "opam config exec -- utop -emacs")) -(use-package tuareg - :ensure t - :defer t - :hook (tuareg-mode . (lambda () - (utop-minor-mode)))) +;; (use-package tuareg +;; :ensure t +;; :defer t +;; :hook (tuareg-mode . (lambda () +;; (utop-minor-mode)))) ;; ------------------------------------------------------------------- ;; Misc languages @@ -297,7 +307,7 @@ :defer t :config (setq js-comint-program-command "node" - js-comint-program-arguments nil)) + js-comint-program-arguments nil)) (use-package js2-mode :ensure t @@ -305,71 +315,78 @@ :after js-comint :mode "\\.js$" :bind (:map js2-mode-map - ("TAB" . js2-indent-line) - ("C-x C-e" . js-send-last-sexp) - ("C-c C-b" . js-send-buffer) - ("C-c C-l" . js-load-file)) + ("TAB" . js2-indent-line) + ("C-x C-e" . js-send-last-sexp) + ("C-c C-b" . js-send-buffer) + ("C-c C-l" . js-load-file)) :hook (js2-mode . (lambda () - (auto-revert-mode -1) - (yas-minor-mode-on)))) + (auto-revert-mode -1) + (yas-minor-mode-on)))) (use-package nodemcu-mode :ensure t :defer t :config (setq nodemcu-default-keybindings t - nodemcu-port "/dev/ttyUSB0" - nodemcu-backend "nodemcu-uploader") + nodemcu-port "/dev/ttyUSB0" + nodemcu-backend "nodemcu-uploader") (defun nodemcu-better-upload-current-file (&optional noreset) (interactive "P") (let ((proc (get-process "nodemcu-terminal"))) (when proc - (delete-process proc)) + (delete-process proc)) (shell-command (nodemcu--get-command "upload" (file-name-nondirectory (buffer-file-name)))) (unless noreset - (shell-command - (nodemcu--get-command "node restart")) - (when proc - (nodemcu-terminal)))))) + (shell-command + (nodemcu--get-command "node restart")) + (when proc + (nodemcu-terminal)))))) (use-package lua-mode :after nodemcu-mode :ensure t :defer t :bind (:map lua-mode-map - ("C-x C-e" . lua-send-current-line) - ("C-c C-d" . lua-send-defun) - ("C-c C-e" . lua-send-region) - ("C-c C-u" . nodemcu-better-upload-current-file) - ("C-c C-t" . nodemcu-terminal) - ("M-n" . lua-forward-sexp) - ("M-p" . lua-backwards-to-block-begin-or-end)) + ("C-x C-e" . lua-send-current-line) + ("C-c C-d" . lua-send-defun) + ("C-c C-e" . lua-send-region) + ("C-c C-u" . nodemcu-better-upload-current-file) + ("C-c C-t" . nodemcu-terminal) + ("M-n" . lua-forward-sexp) + ("M-p" . lua-backwards-to-block-begin-or-end)) :hook (lua-mode . (lambda () - (require 'nodemcu-mode) - (nodemcu-mode 1)))) + (require 'nodemcu-mode) + (nodemcu-mode 1)))) (use-package verilog-mode :ensure t :defer t :mode "\\.vl$" :hook (verilog-mode . (lambda () - (setq verilog-tool 'verilog-compiler) - (verilog-set-compile-command))) + (setq verilog-tool 'verilog-compiler) + (verilog-set-compile-command))) :config (setq verilog-compiler "iverilog" - verilog-tool 'verilog-compiler)) + verilog-tool 'verilog-compiler)) (use-package gforth :commands forth-mode :mode (("\\.fs$" . forth-mode) - ("\\.fb$" . forth-block-mode) - ("\\.4th$" . forth-mode))) + ("\\.fb$" . forth-block-mode) + ("\\.4th$" . forth-mode))) -(use-package clojure-mode +;; (use-package clojure-mode +;; :ensure t +;; :defer t) + +(use-package uxntal-mode :ensure t - :defer t) + :defer t + :config + (setq uxntal-mode-strict-comments t)) + ;; ------------------------------------------------------------------- ;; JSON and related |
