From ea1e815c3dc1781aa5cb6d401e233c73fa8a108b Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 26 Jun 2023 15:17:20 +1000 Subject: Adapted more configs from other emacs configs Including wasamasa and jwiegley --- emacs/.emacs.d/init/ycp-prog.el | 49 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-) (limited to 'emacs/.emacs.d/init/ycp-prog.el') diff --git a/emacs/.emacs.d/init/ycp-prog.el b/emacs/.emacs.d/init/ycp-prog.el index 6392cf8..0b04509 100644 --- a/emacs/.emacs.d/init/ycp-prog.el +++ b/emacs/.emacs.d/init/ycp-prog.el @@ -115,7 +115,7 @@ #'my-comint-send-input-and-return-prompt) (add-to-list 'my-buffer-create-functions '(shell-mode . my-shell-with-directory)) - (my-keybind shell-mode-map "" #'my-restart-shell) + (my-keybind comint-mode-map "" #'my-comint-restart) (add-hook 'shell-mode-hook 'my-shell-disable-company-if-remote) (my-keybind global-map "" #'my-switch-or-create-shell-buffer) ) @@ -134,10 +134,8 @@ ;; (bash-completion-setup) ) -;;; prog modes: c, c++, elisp, js, css, ts, (my-package prog-mode - (add-hook 'prog-mode-hook #'display-line-numbers-mode) - (add-hook 'prog-mode-hook (lambda () (setq-local tab-width 2)))) + (add-hook 'prog-mode-hook #'my-prog-modes-setup)) ;; cmake (my-package cmake-mode @@ -183,6 +181,15 @@ (define-key c-mode-map (kbd "C-c C-c") 'compile) (define-key c++-mode-map (kbd "C-c C-c") 'project-compile) (add-to-list 'auto-mode-alist '("\\.inl\\'" . c++-mode)) + (setq c-default-style + '((java-mode . "java") + (awk-mode . "awk") + (c-mode . "user") + (c++-mode . "user") + (other . "gnu"))) + (setq-default c-electric-flag t) + ;; prevent backspace from untabifying + (setq c-backspace-function 'delete-backward-char) ) (my-package my-prog @@ -199,7 +206,9 @@ (my-package elisp-mode (:delay 10) (my-keybind emacs-lisp-mode-map - "C-c C-c" #'eval-buffer) + "C-c C-c" #'eval-buffer + "C-c C-z" #'ielm + "C-," #'my-insert-current-prefix) (add-hook 'emacs-lisp-mode-hook (lambda () (auto-fill-mode 1))) (setq print-length 1000) (my-keybind global-map @@ -215,11 +224,20 @@ 'emacs-lisp-mode))) ;; for deep recursion, e.g. in radix tree (setq max-specpdl-size 32000) + (add-to-list 'auto-mode-alist '("Cask\\'" . emacs-lisp-mode)) (require 'my-prog) (my-keybind emacs-lisp-mode-map "C-M-x" #'my-eval-defun-or-region) ) +(my-package data-debug + (:delay 10) + (my-keybind global-map + "C-:" 'data-debug-eval-expression)) + +(setq debugger-stack-frame-as-list t) +(setq display-raw-bytes-as-hex t) + ;;; paredit (my-package paredit (:install t) @@ -243,6 +261,15 @@ "M-h" #'paredit-convolute-sexp) ) +(my-package compile + (:delay 15) + (setq compilation-always-kill t + compilation-ask-about-save nil + compilation-context-lines 10 + compilation-scroll-output 'first-error + compilation-skip-threshold 2) + ) + ;;; flymake (my-package flymake (:install t) @@ -468,5 +495,17 @@ (add-hook 'c++-mode-hook 'my-set-header-line-to-which-func) ) +;;; nxml +(my-package nxml-mode + (:delay 60) + (setq nxml-slash-auto-complete-flag t)) + +(my-package etags + (:delay 60) + (setq tags-file-name "TAGS")) + +(my-package nroff-mode + (add-to-list 'auto-mode-alist '("\\.mdoc\\'" . nroff-mode))) + (provide 'ycp-prog) ;;; ycp-prog.el ends here -- cgit v1.2.3