GNU bug report logs -
#24848
[sh-script] How to save "Local rules set" result from sh-learn-buffer-indent?
Previous Next
Reported by: <richard.wiseman <at> bt.com>
Date: Tue, 1 Nov 2016 15:37:01 UTC
Severity: minor
Tags: fixed, patch
Merged with 29414
Found in version 24.5
Fixed in version 26.1
Done: Noam Postavsky <npostavs <at> users.sourceforge.net>
Bug is archived. No further changes may be made.
Full log
Message #28 received at 24848 <at> debbugs.gnu.org (full text, mbox):
<richard.wiseman <at> bt.com> writes:
> I don't know whether my Emacs uses smie for sh-mode but there's
> apparently no sh-use-smie variable set by default.
What Emacs version do you have? (Based on what you said below, it
sounds like smie is being used.)
> The bash script I've used as a test here is:
>
> #!/usr/bin/env bash
>
> if [ "$1" ]
> then
> echo "First argument is: $1"
> else
> echo "No arguments"
> fi
Ah, so you've set sh-basic-offset to 2, right? That's Bug#21751. Hmm,
it looks like the smie code is following sh-indentation instead of
sh-basic-offset. It's not clear to me why both of those variables
exist...
> 3. I ran customize-variable on smie-config and its value is now ((2
> :elem basic 4)) which doesn't make any mention of indenting after
> "then" which is weird, because as I said, it does now indent correctly
> in this buffer.
When I set sh-basic-offset to 2, I get that value for smie-config as
well.
> 7. As feared, indentation is back to the way I don't like.
>
> However, running smie-config-guess seems to have the same effect as
> sm-learn-buffer-indent so perhaps it does. Unfortunately, I've still
> not managed to save the config.
I followed your steps and got similar results. The problem is actually
that the config doesn't get loaded properly. It works if I then do
8. M-x customize-option RET smie-config RET
9. Modify the text of the value field, e.g., by adding a space at the
end, so that the "State" turns to EDITED.
10. Click the "Apply" button (this is equivalent to the
(customize-set-variable 'smie-config ...) expression I mentioned
before).
11. Go to the bash script buffer and run M-x normal-mode RET so that the
mode hooks are run again.
12. Indentation is correct.
This bug report was last modified 7 years and 176 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.