diff --git a/emacs/data.el b/emacs/data.el index 987cf1a..03fc00b 100644 --- a/emacs/data.el +++ b/emacs/data.el @@ -20,6 +20,13 @@ (interactive "FFile to touch: ") (start-process "agw-touch" nil "touch" (expand-file-name fname))) +(defun agw-prog-mode () + "Sets up `prog-mode'." + (setq-local tab-always-indent nil) + (setq-local tab-width 3) + (setq-local standard-indent 3) + (setq-local indent-tabs-mode t)) + (defun agw-fp-mode () "Sets up lisp and other functional language major modes." (setq-local indent-tabs-mode nil) diff --git a/emacs/init.el b/emacs/init.el index a17f035..116fbbc 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -12,6 +12,7 @@ mark-ring-max 1024) (load custom-file) +(load "~/.emacs.d/data.el") ;; encoding (setq current-language-environment "UTF-8" @@ -32,6 +33,8 @@ (set-face-attribute 'variable-pitch nil :height 120 :family "Noto Sans") +(defvaralias 'c-basic-offset 'tab-width) + ;; ergonomics (defalias #'yes-or-no-p #'y-or-n-p) (setq line-move-ignore-invisible nil @@ -52,26 +55,11 @@ hscroll-step 1) (set-scroll-bar-mode nil) -;; tabulation -(setq tab-always-indent nil - tab-width 3 - standard-indent 3 - indent-tabs-mode t) - -(defvaralias 'c-basic-offset 'tab-width) -(defvaralias 'ruby-indent-level 'tab-width) -(defvaralias 'rust-indent-offset 'tab-width) - -(load "~/.emacs.d/data.el") - -;; spelling +;; `prog-mode' (add-hook 'prog-mode-hook #'flyspell-prog-mode) - -;; prettify symbols (add-hook 'prog-mode-hook #'prettify-symbols-mode) - -;; subword mode (add-hook 'prog-mode-hook #'subword-mode) +(add-hook 'prog-mode-hook #'agw-prog-mode) ;; pkgdb (setq package-enable-at-startup nil @@ -152,10 +140,13 @@ (use-package ruby-mode :ensure t :init + (defvaralias 'ruby-indent-level 'tab-width) (setq ruby-insert-encoding-magic-comment nil)) (use-package rust-mode - :ensure t) + :ensure t + :init + (defvaralias 'rust-indent-offset 'tab-width)) ;; org-mode (use-package org