From: Reiner Steib <Reiner.Steib@gmx.de>
To: 17818@debbugs.gnu.org
Subject: bug#17818: 24.3.91; sh-learn-buffer-indent doesn't learn current indent anymore
Date: Fri, 20 Jun 2014 16:54:04 +0200 [thread overview]
Message-ID: <87ha3fy6lv.fsf@marauder.physik.uni-ulm.de> (raw)
Hi,
in Emacs 24.3.91, `sh-learn-buffer-indent' doesn't seem to learn the
current indent rules of the buffer anymore. It worked correctly in
23.3 and better in 24.1, see below.
(I use `sh-learn-buffer-indent' in `sh-set-shell-hook'.)
Consider this shell script:
###
$ cat shell-script-test.sh
#!/bin/sh
if true; do
echo "My sh-basic-offset offset should be 2."
fi
for a in 1; do
echo "My sh-basic-offset offset should be 2."
done
###
* In Emacs 23.3 (==> *expected behavior*):
- emacs -title emacs-23.3 shell-script-test.sh
- M-x sh-learn-buffer-indent RET
- C-x b *indent* RET
Switching to buffer *indent* shows:
Indentation values for buffer shell-script-test.sh.
0 indentation variables have different values.
Comments follow default indentation.
Initial value of sh-basic-offset: 4
Suggested sh-basic-offset: 2
Learned variable settings:
sh-indent-after-if 2
sh-indent-for-fi 0
sh-indent-after-loop-construct 2
sh-indent-for-done 0
sh-indent-comment t
- Put point after first "then", hit RET and TAB (or C-j)
- the new line is indented by 2 spaces (==> *expected behavior*)
- Put point after first "echo" line, hit RET and TAB (or C-j)
- the new line is indented by 2 spaces (==> *expected behavior*)
* Emacs 24.1:
- emacs -title emacs-24.1 -Q shell-script-test.sh
- M-x sh-learn-buffer-indent RET
Result:
Message: Buffer is read-only: #<buffer *indent*>
Buffer *indent* exists but it is empty.
Something is wrong, but indentation works as expected.
- Put point after first "then", hit RET and TAB (or C-j)
- the new line is indented by 2 spaces (==> *expected behavior*)
- Put point after first "echo" line, hit RET and TAB (or C-j)
- the new line is indented by 2 spaces (==> *expected behavior*)
* Emacs 24.3.91:
- emacs -title emacs-24.1 -Q shell-script-test.sh
- M-x sh-learn-buffer-indent RET
Message: Local rules set
- Put point after first "then", hit RET (or C-j and TAB) [1]
- the new line is indented by 4 spaces (==> *wrong behavior*)
- Put point after first "echo" line, hitRET (or C-j and TAB)
- the new line is indented by 4 spaces (==> *wrong behavior*)
and the "echo" line is indented by 4 spaces (==> *wrong behavior*)
In GNU Emacs 24.3.91.1 (i686-pc-mingw32)
of 2014-05-12 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --enable-checking 'CFLAGS=-O0 -g3' CPPFLAGS=-DGLYPH_DEBUG=1'
Important settings:
value of $LANG: C.ISO-8859-1
locale-coding-system: cp1252
Bye, Reiner.
[1] NEWS says:
*** `electric-indent-mode' is now enabled by default.
Typing RET reindents the current line and indents the new line.
`C-j' inserts a newline but does not indent. In some programming modes,
additional characters are electric (eg `{').
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
next reply other threads:[~2014-06-20 14:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-20 14:54 Reiner Steib [this message]
2014-06-20 15:48 ` bug#17818: 24.3.91; sh-learn-buffer-indent doesn't learn current indent anymore Stefan Monnier
2014-06-20 21:10 ` Stefan Monnier
2014-06-23 16:04 ` Reiner Steib
2014-06-24 13:49 ` Stefan Monnier
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ha3fy6lv.fsf@marauder.physik.uni-ulm.de \
--to=reiner.steib@gmx.de \
--cc=17818@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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).