From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Newsgroups: gmane.emacs.bugs 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 Message-ID: <1503582257373.58386@bt.com> References: <1478012827020.47948@bt.com> <1503574770199.95054@bt.com>, <87o9r59lyp.fsf_-_@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1503582403 27802 195.159.176.226 (24 Aug 2017 13:46:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 24 Aug 2017 13:46:43 +0000 (UTC) To: <24848@debbugs.gnu.org> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 24 15:46:37 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dksSu-0006mB-VR for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Aug 2017 15:46:33 +0200 Original-Received: from localhost ([::1]:48740 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dksT1-00082d-MW for geb-bug-gnu-emacs@m.gmane.org; Thu, 24 Aug 2017 09:46:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dksRV-00072s-Hz for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2017 09:45:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dksRS-0003br-Ba for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2017 09:45:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43644) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dksRS-0003bk-7m for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2017 09:45:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dksRR-0000Vl-Ve for bug-gnu-emacs@gnu.org; Thu, 24 Aug 2017 09:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Aug 2017 13:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24848 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24848-submit@debbugs.gnu.org id=B24848.15035822691878 (code B ref 24848); Thu, 24 Aug 2017 13:45:01 +0000 Original-Received: (at 24848) by debbugs.gnu.org; 24 Aug 2017 13:44:29 +0000 Original-Received: from localhost ([127.0.0.1]:52325 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dksQv-0000UD-9O for submit@debbugs.gnu.org; Thu, 24 Aug 2017 09:44:29 -0400 Original-Received: from smtpb1.bt.com ([62.7.242.138]:23735) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dksQs-0000Tz-Od for 24848@debbugs.gnu.org; Thu, 24 Aug 2017 09:44:27 -0400 Original-Received: from EPDAG01D-UKBR.domain1.systemhost.net (193.113.197.205) by EVMED04-UKBR.bt.com (10.216.161.34) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 24 Aug 2017 14:44:19 +0100 Original-Received: from tpw09926dag12f.domain1.systemhost.net (10.9.212.20) by EPDAG01D-UKBR.domain1.systemhost.net (193.113.197.205) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Thu, 24 Aug 2017 14:44:19 +0100 Original-Received: from tpw09926dag12e.domain1.systemhost.net (10.9.212.12) by tpw09926dag12f.domain1.systemhost.net (10.9.212.20) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Thu, 24 Aug 2017 14:44:17 +0100 Original-Received: from tpw09926dag12e.domain1.systemhost.net ([fe80::b8c9:c264:c4b3:b898]) by tpw09926dag12e.domain1.systemhost.net ([fe80::b8c9:c264:c4b3:b898%12]) with mapi id 15.00.1293.002; Thu, 24 Aug 2017 14:44:17 +0100 Thread-Topic: bug#24848: [sh-script] How to save "Local rules set" result from sh-learn-buffer-indent? Thread-Index: AQHTHNYjY9CjYqE9/kGSEHgspxmKaqKTf0gu In-Reply-To: <87o9r59lyp.fsf_-_@users.sourceforge.net> Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.187.101.36] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:136147 Archived-At: Hi Noam,=0A= =0A= Thanks for such a quick response!=0A= =0A= I've had a try with the commands in the comment. Here's what I did:=0A= =0A= 1. Load a correctly-formatted bash script.=0A= =0A= 2. Move to a line that I know will be problematic -- it always wants to ind= ent 4 characters after a "then" -- and press tab. Sure enough, the indenta= tion changes to how I don't like.=0A= =0A= 3. Undo that to restore the correctly-formatted bash script.=0A= =0A= 4. Run sh-learn-buffer-indent.=0A= =0A= 5. Press tab on that problematic line; this time, correctly, the indentatio= n doesn't change.=0A= =0A= 6. Run sh-name-style and call it "bash".=0A= =0A= 7. Run sh-save-styles-to-buffer and let it use *scratch*.=0A= =0A= 8. Copy the output in *scratch* into my .emacs file.=0A= =0A= 9. Quit emacs.=0A= =0A= 10. Start emacs.=0A= =0A= 11. Load the same bash script.=0A= =0A= 12. Load the style, "bash".=0A= =0A= 13. Press tab on that problematic line. It still indents incorrectly, so a= lthough sh-save-styles-to-buffer saved styles (see below), it evidently did= n't include the modification. :-(=0A= =0A= Sadly, even the following doesn't work:=0A= =0A= 1. Load a correctly-formatted bash script.=0A= =0A= 2. Move to a line that I know will be problematic -- it always wants to ind= ent 4 characters after a "then" -- and press tab. Sure enough, the indenta= tion changes to how I don't like.=0A= =0A= 3. Undo that to restore the correctly-formatted bash script.=0A= =0A= 4. Run sh-learn-buffer-indent.=0A= =0A= 5. Press tab on that problematic line; this time, correctly, the indentatio= n doesn't change.=0A= =0A= 6. Run sh-name-style and call it "bash".=0A= =0A= 7. Load a different bash script without quitting emacs first.=0A= =0A= 8. Run sh-load-style and press tab so it auto-completes to "bash".=0A= =0A= 9. Press tab on a problematic line -- indentation is still incorrect.=0A= =0A= So the above seem to demonstrate that sh-name-buffer and sh-save-styles-to-= buffer don't save all indentation information.=0A= =0A= Here's what sh-save-styles-to-buffer puts in my *scratch* buffer:=0A= =0A= (setq sh-styles-alist=0A= '(("bash"=0A= (sh-basic-offset . 2)=0A= (sh-first-lines-indent . 0)=0A= (sh-indent-after-case . +)=0A= (sh-indent-after-do . +)=0A= (sh-indent-after-done . 0)=0A= (sh-indent-after-else . +)=0A= (sh-indent-after-if . +)=0A= (sh-indent-after-loop-construct . +)=0A= (sh-indent-after-open . +)=0A= (sh-indent-comment . t)=0A= (sh-indent-for-case-alt . ++)=0A= (sh-indent-for-case-label . +)=0A= (sh-indent-for-continuation . +)=0A= (sh-indent-for-do . 0)=0A= (sh-indent-for-done . 0)=0A= (sh-indent-for-else . 0)=0A= (sh-indent-for-fi . 0)=0A= (sh-indent-for-then . 0))))=0A= =0A= Please let me know if you'd like any further information.=0A= =0A= Thanks again for the message,=0A= =0A= Richard=0A= =0A= PS - I guess (add-hook 'sh-set-shell-hook 'sh-learn-buffer-indent) will hel= p 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 a= ll possible!=