jcsalomon / smarttabs

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

Bypass the advice conditionally #28

Closed dochang closed 4 years ago

dochang commented 10 years ago

Every buffer has its own indent setting. The advice should not override it. Instead, run or bypass the advice based on the setting.

Closes jcsalomon#27.

jcsalomon commented 10 years ago

Can you please explain what this does? If I understand the code correctly, this restricts loading the mode to buffers where indent-tabs-mode is set and (eq ,offset tab-width) is true—but what does that last expression mean?

jcsalomon commented 10 years ago

I’m considering to rewrite the commit message thus:

Conditionally bypass the advice

In a buffer where indent-tabs-mode is nil, smart-tabs-mode is irrelevant, so don’t load it.

Closes #27.

Have I correctly understood the purpose of this pull-request?

dochang commented 10 years ago

Almost every mode has its own indent variable. It may not be equal to tab-width, which smarttabs use to indent.

If (eq ,offset tab-width) is false, smarttabs will break the indent setting of the mode.

That's why the advice should check it, IMHO.

I think the commit message could be:

Indent as smarttabs only if the file enables indent-tabs-mode and its indent variable is equal to tab-width.

ghost commented 6 years ago

Adding the ((and smart-tabs-mode indent-tabs-mode (eq ,offset tab-width)) expression has made my life a lot less frustrating. Any chance this will ever be merged?