jcsalomon / smarttabs

Emacs smart tabs - indent with tabs, align with spaces!
http://www.emacswiki.org/emacs/SmartTabs
114 stars 20 forks source link

Doesn't work at all (Emacs 28) #51

Open CyberShadow opened 3 years ago

CyberShadow commented 3 years ago

Hi,

I can't get this package to work in the simplest case imaginable.

Here is a self-contained script which reproduces the problem:

(load "~/.emacs.d/straight/repos/smarttabs/smart-tabs-mode.el")
(smart-tabs-insinuate 'c)

(defun my-c-mode-common-hook ()
  (whitespace-mode)
  (smart-tabs-mode))

(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)

(with-current-buffer (create-file-buffer "indent-test.c")
  (switch-to-buffer (current-buffer))
  (c-mode)
  (insert "void main() {
very_long_function_name(1,
2,
3);
}
")
  (indent-region (point-min) (point-max)))

Run with emacs -Q --load test.el.

Running the script shows that the file is indented with tabs:

image

Have recent Emacs versions completely broken this package?

CyberShadow commented 3 years ago

I just tried the example in the README, but that seems to require a certain cc-mode configuration, as by default it indents array literal continuation with just a single level of indentation. I don't know how to configure cc-mode in a way that would reproduce the behavior in the README example.

CyberShadow commented 3 years ago

Aha, it's because, tab-width and c-basic-offset must match. (By default they are 8 and 2 respectively.)

I think this needs to be mentioned in the documentation.

ngeiswei commented 2 years ago

Have you solved this problem? I can't get smart-tabs to work too (even when tab-width and c-basic-offset match). Is this project dead?