GNU bug report logs - #17818
24.3.91; sh-learn-buffer-indent doesn't learn current indent anymore

Previous Next

Package: emacs;

Reported by: Reiner Steib <Reiner.Steib <at> gmx.de>

Date: Fri, 20 Jun 2014 14:57:01 UTC

Severity: important

Found in version 24.3.91

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#17818: closed (24.3.91; sh-learn-buffer-indent doesn't learn
 current indent anymore)
Date: Tue, 24 Jun 2014 13:51:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Tue, 24 Jun 2014 09:49:58 -0400
with message-id <jwvha3actj9.fsf-monnier+emacsbugs <at> gnu.org>
and subject line Re: bug#17818: 24.3.91; sh-learn-buffer-indent doesn't learn current indent anymore
has caused the debbugs.gnu.org bug report #17818,
regarding 24.3.91; sh-learn-buffer-indent doesn't learn current indent anymore
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
17818: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17818
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Reiner Steib <Reiner.Steib <at> gmx.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.91; sh-learn-buffer-indent doesn't learn current indent anymore
Date: Fri, 20 Jun 2014 16:54:04 +0200
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/


[Message part 3 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Reiner Steib <reiner.steib <at> gmx.de>
Cc: 17818-done <at> debbugs.gnu.org
Subject: Re: bug#17818: 24.3.91;
 sh-learn-buffer-indent doesn't learn current indent anymore
Date: Tue, 24 Jun 2014 09:49:58 -0400
> However, I tested[1] the new code with the following script and found
> some incorrect indents (see diff below, hope the whitespace doesn't
> get changed).

These aren't due to the guessing part, but the indentation code, so I'll
deal with them in a separate report.


        Stefan


This bug report was last modified 10 years and 339 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.