all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: <richard.wiseman@bt.com>
To: <npostavs@gmail.com>, <24848@debbugs.gnu.org>
Subject: bug#24848: [sh-script] How to save "Local rules set" result from sh-learn-buffer-indent?
Date: Fri, 25 Aug 2017 08:11:38 +0000	[thread overview]
Message-ID: <1503648698123.80907@bt.com> (raw)
In-Reply-To: <87inhca1s9.fsf@users.sourceforge.net>

Hi Noam,

Thanks for the suggestions.

I don't know whether my Emacs uses smie for sh-mode but there's apparently no sh-use-smie variable set by default.

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.

Here's what I did:

1. I ran smie-config-guess on a correctly-indented bash script (see below) and confirmed that it now indents as I would expect when I hit tab on any line).

2. I then ran smie-save-config and it said it saved it to smie-config.

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.

4. I then clicked Apply and Save to add the setting to my ~/.emacs file.

5. I confirmed that it now appears in the (custom-set-variables ... ) section.

6. I restarted Emacs and loaded the bash script.

7. As feared, indentation is back to the way I don't like.

8. I then modified the smie-config entry in (custom-set-variables ... ) to correspond with your expression (that mentions "then").

9. I restarted Emacs and loaded the bash script.

10. Sadly, indentation is still unaffected.

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

In case there's a problem with formatting by the time this email reaches you, only the two echo lines are indented, and each by two spaces.  Hitting tab on the first of these changes the indent to four spaces; on the second, indentation remains at two.

Regards,

Richard




  reply	other threads:[~2017-08-25  8:11 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01 15:07 bug#24848: 24.5; "Local rules set" richard.wiseman
2017-08-24 11:39 ` bug#24848: Any progress? richard.wiseman
2017-08-24 12:41   ` bug#24848: [sh-script] How to save "Local rules set" result from sh-learn-buffer-indent? npostavs
2017-08-24 13:44     ` richard.wiseman
2017-08-25  1:12       ` npostavs
2017-08-25  8:11         ` richard.wiseman [this message]
2017-08-25  8:37           ` richard.wiseman
2017-08-25 12:07           ` npostavs
2017-08-25 13:44             ` richard.wiseman
2017-08-25 14:31               ` richard.wiseman
2017-08-26 20:08                 ` Noam Postavsky
2017-08-29  7:43                   ` richard.wiseman
2017-08-30 23:49               ` npostavs
2017-09-04  8:30                 ` richard.wiseman
2017-09-08 23:15                   ` npostavs
2017-09-11  7:44                     ` richard.wiseman
2017-09-11  9:53                       ` richard.wiseman
2017-09-11 18:48                         ` npostavs
2017-09-12  7:09                           ` richard.wiseman
2017-09-22 22:46                         ` Noam Postavsky
2017-09-25 11:10                           ` richard.wiseman
2017-09-25 12:19                             ` Noam Postavsky
2017-09-25 13:06                               ` richard.wiseman
2017-09-25 23:41                                 ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503648698123.80907@bt.com \
    --to=richard.wiseman@bt.com \
    --cc=24848@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.