From 409e09d585c974038801b62f9c9909e109136810 Mon Sep 17 00:00:00 2001 From: fpi Date: Fri, 18 Sep 2020 15:51:30 +0200 Subject: Add a mode to toggle between space and tab indentation --- emacs-init.org | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/emacs-init.org b/emacs-init.org index 40bb8ff..1e337eb 100644 --- a/emacs-init.org +++ b/emacs-init.org @@ -5416,8 +5416,33 @@ I do not really care about spaces versus tabs most of the time. I only want it to be consistent within a file. #+begin_src emacs-lisp (use-package emacs + :config + (define-minor-mode tab-mode + "Toggle tab and space based indentation." + :init-value nil + :lighter " »" + (if tab-mode + (progn + (setq indent-tabs-mode t) + (setq tab-width 4) + ) + (setq indent-tabs-mode nil) + (setq tab-width 8) + )) + (defun enable-tab-mode () + (tab-mode 1)) + (defun disable-tab-mode () + (tab-mode -1)) :custom - (indent-tabs-mode nil)) + (indent-tabs-mode nil) + ;; (tab-width 4) + ;; (tab-mode 1) + :hook + (prog-mode . enable-tab-mode) + (emacs-lisp-mode . disable-tab-mode) + (lisp-mode . disable-tab-mode) + (matlab-mode . enable-tab-mode) + ) #+end_src Instead of =$= use =⏎= to indicate newlines #+begin_src emacs-lisp -- cgit v1.2.3