Fix smart tabs
This commit is contained in:
parent
1f7121db14
commit
ae1f32c997
21
config.org
21
config.org
@ -366,17 +366,16 @@
|
|||||||
(use-package smart-tabs-mode)
|
(use-package smart-tabs-mode)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
[[help:smart-tabs-insinuate][smart-tabs-insinuate]] enables smart tabs for a particular language,
|
The package has this really annoying behaviour that it turns
|
||||||
but also it will only be used when [[help:indent-tabs-mode][indent-tabs-mode]] is
|
itself off if [[help:indent-tabs-mode][indent-tabs-mode]] is nil, even when you just
|
||||||
non-nil. The following function wraps up setting
|
explicitly turned it on. The solution on the Emacs wiki is to set
|
||||||
~indent-tabs-mode~ and enabling smart tabs for the language into
|
indent-tabs-mode to t in a =c-mode-common= hook, which is a bit of
|
||||||
one thing:
|
a hack, but I tried my own approach and it didn't work for no
|
||||||
|
apparent reason so I'm just going to do as I'm told.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(defun enable-smart-tabs (lang hook)
|
(add-hook 'c-mode-common-hook
|
||||||
"Enable smart tabs for lang (even if indent-tabs-mode is nil by default)"
|
(lambda () (setq indent-tabs-mode t)))
|
||||||
(smart-tabs-insinuate lang)
|
|
||||||
(add-hook hook (lambda () (setq indent-tabs-mode nil))))
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** C
|
** C
|
||||||
@ -391,7 +390,7 @@
|
|||||||
And we want to enable smart tabs:
|
And we want to enable smart tabs:
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(enable-smart-tabs 'c 'c-mode-hook)
|
(smart-tabs-insinuate 'c)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** C++
|
** C++
|
||||||
@ -399,7 +398,7 @@
|
|||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(add-hook 'c++-mode-hook #'lsp-deferred)
|
(add-hook 'c++-mode-hook #'lsp-deferred)
|
||||||
(enable-smart-tabs 'c++ 'c++-mode-hook)
|
(smart-tabs-insinuate 'c++)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Haskell
|
** Haskell
|
||||||
|
Loading…
x
Reference in New Issue
Block a user