diff options
Diffstat (limited to 'emacs/work_inits/20-programming.el')
| -rw-r--r-- | emacs/work_inits/20-programming.el | 277 |
1 files changed, 0 insertions, 277 deletions
diff --git a/emacs/work_inits/20-programming.el b/emacs/work_inits/20-programming.el deleted file mode 100644 index 90ab2d8..0000000 --- a/emacs/work_inits/20-programming.el +++ /dev/null @@ -1,277 +0,0 @@ -;; Time-stamp: <2022-07-21 10h34 CEST (radix)> - -;; ----------------------------------------------------------------------------- -;; General setup - -;; Always split horizontally when compiling -;; (defadvice compile (around split-horizontally activate) -;; (let ((split-width-threshold 0) -;; (split-height-threshold nil)) -;; ad-do-it)) - -;; Resize to fill column (and a little bit) -;; (defadvice compile (after resize-window-properly activate) -;; (let ((ww (window-width))) -;; (when (< ww (+ 5 fill-column)) -;; (enlarge-window-horizontally (- (+ 5 fill-column) ww))))) - -;; (use-package smart-tabs-mode -;; :ensure t -;; :config -;; (smart-tabs-insinuate 'c 'c++ 'java 'javascript 'cperl 'ruby 'nxml) -;; (setq whitespace-style '(face trailing tabs spaces lines -;; newline empty space-before-tab space-mark tab-mark -;; newline-mark))) - -(defun align-to-equals (begin end) - "Align region to equal signs" - (interactive "r") - (align-regexp begin end "\\(\\s-*\\)=" 1 1 )) - -;; (use-package flycheck -;; :defer t -;; :ensure t) - -;; (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)) - -(use-package hideshow - :bind (("C-c C-f C-f" . hs-toggle-hiding))) - -(defun programming-setup () - (subword-mode 1) - (electric-pair-local-mode) - (set-fill-column 80) - (hs-minor-mode) - ;; Emacs25 compat - (if (fboundp 'display-line-numbers-mode) - (display-line-numbers-mode) - (linum-mode)) - (setq auto-hscroll-mode t) - (yas-minor-mode-on)) - -(add-hook 'prog-mode-hook #'programming-setup) - -;; ----------------------------------------------------------------------------- -;; Specific packages - -(use-package shift-number - :ensure t - :bind (("C-c s p" . shift-number-up) - ("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)) - -(use-package aggressive-indent - :ensure t - :defer t) - -(use-package yasnippet - :ensure t - :defer t - :commands yas-minor-mode-on) - -(use-package elec-pair - :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)) - -;; (use-package lsp-mode -;; :ensure t -;; :defer t -;; :init -;; (setq lsp-keymap-prefix "M-l")) - -;; ----------------------------------------------------------------------------- -;; C - -;; What are these? -;; (setq gdb-show-threads-by-default nil -;; gdb-many-windows nil -;; gdb-show-main nil) - -(use-package cc-mode - :defer t - :bind (:map c-mode-map - ("M-/" . lh-matching-delim)) - :hook ((c-mode 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))) - :config - (c-add-style "gnu-mod" - '("gnu" - (c-basic-offset . 4) ; 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")))) - -;; ----------------------------------------------------------------------------- -;; Python - -;; (use-package yapfify -;; :ensure t -;; :defer t -;; :config -;; (setq yapfify-executable "yapf3")) - -(use-package highlight-indent-guides - :ensure t - :defer t - :config - (setq highlight-indent-guides-auto-odd-face-perc 1.5 - highlight-indent-guides-auto-even-face-perc 3)) - -(use-package python - :hook (python-mode . (lambda () - (highlight-indent-guides-mode) - ;; (yapf-mode) - )) - ;; :config - ;; (setq python-shell-interpreter "python3") - ) - -;; ------------------------------------------------------------------- -;; Misc languages - -(use-package json-mode - :ensure t - :defer t - :bind (:map json-mode-map - ("C-c C-f" . nil))) - -;; (use-package js-comint -;; :ensure t -;; :defer t -;; :config -;; (setq js-comint-program-command "node" -;; js-comint-program-arguments nil)) - -;; (use-package js2-mode -;; :ensure t -;; :defer t -;; :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)) -;; :hook (js2-mode . (lambda () -;; (auto-revert-mode -1) -;; (yas-minor-mode-on)))) - -;; (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)) -;; :hook (lua-mode . (lambda () -;; (require 'nodemcu-mode) -;; (nodemcu-mode 1)))) - -;; (use-package gforth -;; :commands forth-mode -;; :mode (("\\.fs$" . forth-mode) -;; ("\\.fb$" . forth-block-mode) -;; ("\\.4th$" . forth-mode))) |
