summaryrefslogtreecommitdiff
path: root/emacs-init.org
diff options
context:
space:
mode:
authorfpi2020-09-18 15:51:30 +0200
committerfpi2020-09-18 15:57:18 +0200
commit409e09d585c974038801b62f9c9909e109136810 (patch)
tree4e57093d91fed11ff2f52d664e52bf2e1ac5661d /emacs-init.org
parentAdd whole-line-or-region & redtick packages (diff)
Add a mode to toggle between space and tab indentation
Diffstat (limited to 'emacs-init.org')
-rw-r--r--emacs-init.org27
1 files changed, 26 insertions, 1 deletions
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