NB: This problem seems to be limited to mma-mode (for Mathematica).
For example, suppose I define a snippet like this:
# key: test
# name: test
# --
$1
$1
Then, I test it (with C-c C-t
). After I type the first character (x
), my terminal looks like this (the ▮
indicates the position of the cursor).
x▮
x
Note that a couple of spurious spaces were added in front of the mirrored x
.
This behavior continues with every additional keystroke, as long as mirroring is taking place:
xy▮
xy
It happens even if the keystroke is for a backspace:
x▮
x
As I said at the beginning, I see this problem only with mma-mode.
Now, mma-mode is not maintained, AFAICT. Therefore, the most I can hope for is some workaround.
Any ideas on how I could prevent the addition of spurious spaces before mirrors?
yas-indent-line
tofixed
help? If you have those 2 lines in a.m
file, doesM-x indent-according-to-mode
on the second line also cause indentation?indent-according-to-mode
does give a clue: if I run it on an empty buffer undermma-mode
, two spaces get inserted. Unfortunately, however, if I add the line# expand-env: ((yas-indent-line 'fixed))
to the snippet's header, I still get the behavior I showed before.expand-env
at the right time (see github.com/joaotavora/yasnippet/pull/743). Settingyas-indent-line
inmma-mode-hook
should be okay.(back-to-indentation)
with(beginning-of-line)
inyas--indent-region
would help.yas-indent-line
inmma-mode-hook
did not help. I don't entirely understand you last suggestion. Do you mean that I should redefineyas--indent-region
? If so, is there a way to do this "buffer-locally", formma-mode
buffers only?