Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
CyberShadow opened this issue Jul 31, 2021 · 3 comments
Open

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

CyberShadow opened this issue Jul 31, 2021 · 3 comments

Comments

@CyberShadow
Copy link

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
Copy link
Author

CyberShadow commented Jul 31, 2021

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
Copy link
Author

CyberShadow commented Jul 31, 2021

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
Copy link

ngeiswei commented Dec 6, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants