From: <richard.wiseman@bt.com>
To: <24848@debbugs.gnu.org>
Subject: bug#24848: [sh-script] How to save "Local rules set" result from sh-learn-buffer-indent?
Date: Thu, 24 Aug 2017 13:44:17 +0000 [thread overview]
Message-ID: <1503582257373.58386@bt.com> (raw)
In-Reply-To: <87o9r59lyp.fsf_-_@users.sourceforge.net>
Hi Noam,
Thanks for such a quick response!
I've had a try with the commands in the comment. Here's what I did:
1. Load a correctly-formatted bash script.
2. Move to a line that I know will be problematic -- it always wants to indent 4 characters after a "then" -- and press tab. Sure enough, the indentation changes to how I don't like.
3. Undo that to restore the correctly-formatted bash script.
4. Run sh-learn-buffer-indent.
5. Press tab on that problematic line; this time, correctly, the indentation doesn't change.
6. Run sh-name-style and call it "bash".
7. Run sh-save-styles-to-buffer and let it use *scratch*.
8. Copy the output in *scratch* into my .emacs file.
9. Quit emacs.
10. Start emacs.
11. Load the same bash script.
12. Load the style, "bash".
13. Press tab on that problematic line. It still indents incorrectly, so although sh-save-styles-to-buffer saved styles (see below), it evidently didn't include the modification. :-(
Sadly, even the following doesn't work:
1. Load a correctly-formatted bash script.
2. Move to a line that I know will be problematic -- it always wants to indent 4 characters after a "then" -- and press tab. Sure enough, the indentation changes to how I don't like.
3. Undo that to restore the correctly-formatted bash script.
4. Run sh-learn-buffer-indent.
5. Press tab on that problematic line; this time, correctly, the indentation doesn't change.
6. Run sh-name-style and call it "bash".
7. Load a different bash script without quitting emacs first.
8. Run sh-load-style and press tab so it auto-completes to "bash".
9. Press tab on a problematic line -- indentation is still incorrect.
So the above seem to demonstrate that sh-name-buffer and sh-save-styles-to-buffer don't save all indentation information.
Here's what sh-save-styles-to-buffer puts in my *scratch* buffer:
(setq sh-styles-alist
'(("bash"
(sh-basic-offset . 2)
(sh-first-lines-indent . 0)
(sh-indent-after-case . +)
(sh-indent-after-do . +)
(sh-indent-after-done . 0)
(sh-indent-after-else . +)
(sh-indent-after-if . +)
(sh-indent-after-loop-construct . +)
(sh-indent-after-open . +)
(sh-indent-comment . t)
(sh-indent-for-case-alt . ++)
(sh-indent-for-case-label . +)
(sh-indent-for-continuation . +)
(sh-indent-for-do . 0)
(sh-indent-for-done . 0)
(sh-indent-for-else . 0)
(sh-indent-for-fi . 0)
(sh-indent-for-then . 0))))
Please let me know if you'd like any further information.
Thanks again for the message,
Richard
PS - I guess (add-hook 'sh-set-shell-hook 'sh-learn-buffer-indent) will help me if my file is already properly formatted, but I would like to know how to save ALL the indent rules established by sh-learn-buffer-indent if at all possible!
next prev parent reply other threads:[~2017-08-24 13:44 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 [this message]
2017-08-25 1:12 ` npostavs
2017-08-25 8:11 ` richard.wiseman
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=1503582257373.58386@bt.com \
--to=richard.wiseman@bt.com \
--cc=24848@debbugs.gnu.org \
/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.