From f330dfb902ef9fbc6e34b67fb8f7c1a4bb8bd6f2 Mon Sep 17 00:00:00 2001 From: "Alison G. Watson" Date: Tue, 6 Oct 2020 12:14:29 -0600 Subject: [PATCH] improve work environment --- emacs/data.el | 26 ++++++++++++++++++-------- emacs/init.el | 2 -- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/emacs/data.el b/emacs/data.el index c959161..27de720 100644 --- a/emacs/data.el +++ b/emacs/data.el @@ -7,7 +7,10 @@ "Global keymap for `agw-mode'.") (defvar-local agw-no-fixes nil - "Fixes files before save if `t' in this buffer.") + "Fixes files before save if nil in this buffer.") + +(defvar-local agw-work nil + "Changes the functionality of `agw-prog-mode'.") (define-minor-mode agw-key-map-mode "Minor mode for key bindings." @@ -18,13 +21,6 @@ "Binds a key into `agw-mode-map'." (define-key agw-mode-map (kbd (concat "C- " key)) def)) -(defun agw-prog-mode () - "Sets up `prog-mode' and `text-mode'." - (setq-local tab-always-indent nil - tab-width 3 - standard-indent 3 - indent-tabs-mode t)) - (defun agw-fp-mode () "Sets up lisp and other functional language major modes." (setq-local indent-tabs-mode nil @@ -61,7 +57,21 @@ ((eq selection 'screen-line) "ʌ") ((eq selection 'block) "Λ")))) +(defun agw-prog-mode () + "Sets up `prog-mode' and `text-mode'." + (if agw-work + (setq-local tab-always-indent t + tab-width 4 + standard-indent 4 + indent-tabs-mode nil) + (setq-local tab-always-indent nil + tab-width 3 + standard-indent 3 + indent-tabs-mode t))) + (defun agw-after-local-vars () + (if (or (derived-mode-p 'prog-mode) (derived-mode-p 'text-mode)) + (agw-prog-mode)) (unless indent-tabs-mode (smart-tabs-mode 0))) ;; Lithium dialogues mode diff --git a/emacs/init.el b/emacs/init.el index 9d99aae..8f2ac9c 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -24,12 +24,10 @@ (add-hook 'prog-mode-hook #'agw-flyspell-prog-mode) (add-hook 'prog-mode-hook #'prettify-symbols-mode) (add-hook 'prog-mode-hook #'subword-mode) -(add-hook 'prog-mode-hook #'agw-prog-mode) ;; `text-mode' (add-hook 'text-mode-hook #'agw-flyspell-prog-mode) (add-hook 'text-mode-hook #'subword-mode) -(add-hook 'text-mode-hook #'agw-prog-mode) ;; `hack-local-variables' (add-hook 'hack-local-variables-hook #'agw-after-local-vars)