3

When using a multiple of the tab-width value for sh-basic-offset, creating a function using the built-in command C-c ( removes characters from the expected result. That being said, I can create a shell function by manually typing it. It is just this built-in command, which causes odd behavior.

When tab-width and/or sh-basic-offset are not set inside the .emacs file or the latter is not a multiple of the former, it works as expected.

Here are the tests I did:
In the below examples I use "asdf" as the function name and the pipe character ("|") is the visualization of where point is located after I completed the built-in command.

With either variables not defined or not a multiple of one another, the (default) result is:

function asdf() {
    |
}

With both set to 4, the result is:

function asdf() {}|

With tab-width set to 4 and sh-basic-offset to 8, the result is:

function asdf()}|

With both set to 8, the result is:

function asdf}|

With both set to 16 (just for a test), the result is (semantically a rather amusing):

fu}|

Is this a bug or do I need to set another variable to a certain value for it to work? I at least tried the variables stated in this question, but they did not have any effect at all for this issue.

Drew
  • 75,699
  • 9
  • 109
  • 225
Phoenix
  • 341
  • 1
  • 8

0 Answers0