GNU bug report logs -
#18756
24.4; shell-script-mode does wrong indentation
Previous Next
Reported by: Daniel Daboul <danieldaboul <at> gmail.com>
Date: Fri, 17 Oct 2014 19:56:02 UTC
Severity: normal
Tags: confirmed
Found in version 24.4
Fixed in version 24.5
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18756 in the body.
You can then email your comments to 18756 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Fri, 17 Oct 2014 19:56:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Daniel Daboul <danieldaboul <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 17 Oct 2014 19:56:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
M-x shell-script-mode<Enter>
#hi<Enter>
ls<Enter>
x-3<Enter>
With every <Enter> key-press the current line gets indeted, so that
the buffer looks like:
#hi
ls
x=3
<Tab> also mis-behaves. Emacs 24.3.1, OTOH, works fine for me.
In GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2014-10-17 on icsl5123
System Description: SUSE Linux Enterprise Server 10 (x86_64)
Configured using:
`configure --prefix=/nfs/iil/home/ddaboul/r/sles10 --with-gif=no
--without-pop --without-sound --without-gpm --without-dbus
--with-x-toolkit=lucid'
Important settings:
value of $LC_COLLATE: C
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Shell-script
Minor modes in effect:
sh-electric-here-document-mode: t
tooltip-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
ESC [ > 0 ; 2 0 8 ; 0 c ESC x s h e l l - s c r i p
t - m o d e RET # h i RET l s RET x = 3 RET ESC x r
e p o r t - e m a c s - b u g RET
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
No indentation for this shell type.
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils sh-script smie executable xterm
time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dynamic-setting x-toolkit x multi-tty
emacs)
Memory information:
((conses 16 83253 3991)
(symbols 48 18103 0)
(miscs 40 31 113)
(strings 32 12327 4537)
(string-bytes 1 361598)
(vectors 16 7894)
(vector-slots 8 361363 27987)
(floats 8 63 284)
(intervals 56 186 0)
(buffers 960 11)
(heap 1024 8017 572))
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Fri, 17 Oct 2014 22:36:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 18756 <at> debbugs.gnu.org (full text, mbox):
Daniel Daboul wrote:
> M-x shell-script-mode<Enter>
> #hi<Enter>
> ls<Enter>
> x-3<Enter>
>
> With every <Enter> key-press the current line gets indeted, so that
> the buffer looks like:
> #hi
> ls
> x=3
I cannot reproduce this with `emacs -Q'.
(Since you reported this twice, I will delete the other bug, #18755)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Sat, 18 Oct 2014 18:51:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 18756 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Sat, Oct 18, 2014 at 1:35 AM, Glenn Morris <rgm <at> gnu.org> wrote:
>
> I cannot reproduce this with `emacs -Q'.
>
> (Since you reported this twice, I will delete the other bug, #18755)
>
1. Thank you for deleting the duplicate. I thought my first e-mail
didn't make it.
2. I also used "src/emacs-24.4.1 -Q" or
"src/emacs-24.4.1 -Q -nw", which makes no difference for this problem.
3. However, I get the buggy behavior only on
"SUSE Linux Enterprise Server" version 10 and 11 (sles10, sles11).
Today I compiled emacs on a "Debian testing" system, where I do
not see the problem.
4. While trying more, I noticed that this is actually not a problem
specific to the shell-mode. It similarly happens in fundamental mode
(but again only on SUSE). So if I type in an empty buffer in
"Fundamental" mode:
1<return>2<return>3<return>4<return>
... I end up with this:
(4 spaces)1
(1 tab)2
(1 tab,4 spaces)3
(2 tabs)4
5. Can someone suggest how to debug this further or find a local fix?
With best regards, Daniel
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Sun, 19 Oct 2014 17:38:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 18756 <at> debbugs.gnu.org (full text, mbox):
Daniel Daboul wrote:
> 3. However, I get the buggy behavior only on
> "SUSE Linux Enterprise Server" version 10 and 11 (sles10, sles11).
> Today I compiled emacs on a "Debian testing" system, where I do
> not see the problem.
I have no idea how a problem like this could be OS-specific.
You are definitely running the same version of Emacs on both systems,
with no local changes, and no .emacs etc issues?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Sun, 19 Oct 2014 18:36:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 18756 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Sun, Oct 19, 2014 at 8:37 PM, Glenn Morris wrote:
> You are definitely running the same version of Emacs on both systems,
> with no local changes, and no .emacs etc issues?
>
Yes, I just downloaded the package you announced
ftp://alpha.gnu.org/gnu/emacs/pretest/emacs-24.4-rc1.tar.xz
and then basically ran ...
../emacs-24.4/configure --prefix=$HOME/r/$VER \
--with-gif=no --without-pop --without-sound --without-gpm --without-dbus
--with-x-toolkit=lucid
I also made a version with
--without-x \
make
src/emacs-24.4.1 -Q
src/emacs-24.4.1 -Q -nw
... which, AFAIK, excludes all local configuration files.
BTW, I had seen the problem earlier in some of the 24.3.9x versions
which I tried. But back than, I ignored it, hoping for the best.
I am now using 24.3.1 on Suse which runs fine and which I also
configured as similar as possible.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Mon, 20 Oct 2014 05:36:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 18756 <at> debbugs.gnu.org (full text, mbox):
Sorry, no idea.
Anyone?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Mon, 20 Oct 2014 14:12:02 GMT)
Full text and
rfc822 format available.
Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):
Glenn Morris writes:
> Sorry, no idea.
>
> Anyone?
Superficially, it looks like return/enter is only sending a line feed,
not a line feed + carriage return[1]; i wonder if there's some SLES setting
influencing this?
(Sometimes after exiting from Emacs back into a shell - zsh on Debian
Wheezy - i observe similar behaviour from the shell, i.e. output seems
to no longer include carriage returns, only line feeds. But i've not
been able to reproduce this reliably.)
[1] In terms of cursor position, not necessarily actual \l and \r
characters.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Mon, 20 Oct 2014 15:21:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 18756 <at> debbugs.gnu.org (full text, mbox):
> Resent-Sender: help-debbugs <at> gnu.org
> From: Alexis <flexibeast <at> gmail.com>
> Date: Tue, 21 Oct 2014 00:59:08 +1100
>
> Superficially, it looks like return/enter is only sending a line feed,
> not a line feed + carriage return
This doesn't seem to explain what the OP describes as happening both
in GUI and TTY sessions: in the former case, we don't send any CR or
LF characters to the screen to position the cursor, we do that via
Xlib functions.
Daniel, is it true that the problem exists in both GUI and text-mode
sessions?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Mon, 20 Oct 2014 16:14:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 18756 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Mon, Oct 20, 2014 at 6:20 PM, Eli Zaretskii wrote:
> Daniel, is it true that the problem exists in both GUI and text-mode
> sessions?
>
Yes, that is true.
Also, it is noticeable that a line is indented after I press return
and then the point is aligned with the first character in the line above it
(rather than just moving down).
And I think we know that pressing enter usually causes a chain of
events. Help tells me:
RET (translated from <return>) runs the command newline, which is an
interactive compiled Lisp function in `simple.el'.
It is bound to RET.
(newline &optional ARG INTERACTIVE)
Insert a newline, and move to left margin of the new line if it's blank.
If option `use-hard-newlines' is non-nil, the newline is marked with the
text-property `hard'.
With ARG, insert that many newlines.
If `electric-indent-mode' is enabled, this indents the final new line
that it adds, and reindents the preceding line. To just insert
a newline, use M-x electric-indent-just-newline.
Calls `auto-fill-function' if the current column number is greater
than the value of `fill-column' and ARG is nil.
A non-nil INTERACTIVE argument means to run the `post-self-insert-hook'.
I didn't mention it before, but there are modes that superficially seem
to work OK, like for example c-mode and lisp-interaction-mode.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Wed, 22 Oct 2014 01:04:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 18756 <at> debbugs.gnu.org (full text, mbox):
Daniel Daboul writes:
> I didn't mention it before, but there are modes that superficially
> seem to work OK, like for example c-mode and lisp-interaction-mode.
Out of interest, what's the status of electric-indent-mode (i.e.,
enabled or disabled?) in fundamental-mode, shell-script-mode, c-mode and
lisp-interaction-mode?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Wed, 22 Oct 2014 03:23:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 18756 <at> debbugs.gnu.org (full text, mbox):
> Out of interest, what's the status of electric-indent-mode (i.e.,
> enabled or disabled?) in fundamental-mode, shell-script-mode, c-mode and
> lisp-interaction-mode?
It's a global mode, so it's either enabled everywhere or nowhere.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Wed, 22 Oct 2014 03:43:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 18756 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier writes:
>> Out of interest, what's the status of electric-indent-mode (i.e.,
>> enabled or disabled?) in fundamental-mode, shell-script-mode, c-mode and
>> lisp-interaction-mode?
>
> It's a global mode, so it's either enabled everywhere or nowhere.
Ah okay.
The reason i asked is because of this:
https://lists.gnu.org/archive/html/emacs-orgmode/2014-10/msg00607.html
https://lists.gnu.org/archive/html/emacs-orgmode/2014-10/msg00650.html
and this:
https://www.reddit.com/r/emacs/comments/2jxpz9/anyone_having_issues_with_jsmode_in_244/
Since electric-indent-mode was the common factor in those instances, i
was wondering if it might be involved with this issue also ....
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Wed, 22 Oct 2014 13:05:02 GMT)
Full text and
rfc822 format available.
Message #41 received at 18756 <at> debbugs.gnu.org (full text, mbox):
> Since electric-indent-mode was the common factor in those instances, i
> was wondering if it might be involved with this issue also ....
Probably. But we'd need actual bug-reports to figure that out.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Sat, 25 Oct 2014 19:26:02 GMT)
Full text and
rfc822 format available.
Message #44 received at submit <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier writes:
>
> > Since electric-indent-mode was the common factor in those instances, i
> > was wondering if it might be involved with this issue also ....
>
> Probably. But we'd need actual bug-reports to figure that out.
Can one of you advise how I could test "electric-indent-mode" in
isolation on my broken Emacs in SUSE and, if applicable, submit an
"actual bug-report"?
The original mail in this thread was created with "M-x report-emacs-bug"
but apparently it was not good enough for debugging. - Daniel
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Sun, 26 Oct 2014 02:44:01 GMT)
Full text and
rfc822 format available.
Message #47 received at 18756 <at> debbugs.gnu.org (full text, mbox):
> Can one of you advise how I could test "electric-indent-mode" in
> isolation on my broken Emacs in SUSE and, if applicable, submit an
> "actual bug-report"?
You might want to disable electric-indent-mode and then try to reproduce
the same problem by hitting the TAB key before/after RET.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Thu, 04 Dec 2014 08:08:03 GMT)
Full text and
rfc822 format available.
Message #50 received at submit <at> debbugs.gnu.org (full text, mbox):
Daniel Daboul <danieldaboul <at> gmail.com> writes:
>
> M-x shell-script-mode<Enter>
> #hi<Enter>
> ls<Enter>
> x-3<Enter>
> With every <Enter> key-press the current line gets indeted,
Could this be related to this other bug:
https://lists.gnu.org/archive/html/bug-gnu-emacs/2014-07/msg00551.html
Submitted last july, unfortunately got not answer
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Thu, 04 Dec 2014 14:44:02 GMT)
Full text and
rfc822 format available.
Message #53 received at 18756 <at> debbugs.gnu.org (full text, mbox):
> Daniel Daboul <danieldaboul <at> gmail.com> writes:
>> M-x shell-script-mode<Enter>
>> #hi<Enter>
>> ls<Enter>
>> x-3<Enter>
>> With every <Enter> key-press the current line gets indeted,
> Could this be related to this other bug:
> https://lists.gnu.org/archive/html/bug-gnu-emacs/2014-07/msg00551.html
No, his problem seems to be quite different because the behavior does
not correspond to any normal behavior of sh-mode's indentation.
Instead, it sounds like something is overriding sh-mode's indentation in
his case.
> Submitted last july, unfortunately got not answer
Sorry for that. It happens too often.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#18756
; Package
emacs
.
(Mon, 22 Dec 2014 20:36:02 GMT)
Full text and
rfc822 format available.
Message #56 received at 18756 <at> debbugs.gnu.org (full text, mbox):
I can reproduce this when electric-indent-mode is on and sh-set-shell
is run for a csh-family shell. See also bug 19433, which causes this
problem to affect modes other than sh-mode.
--
Peter Oliver
Added tag(s) confirmed; removed tag(s) moreinfo.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Wed, 24 Dec 2014 23:26:01 GMT)
Full text and
rfc822 format available.
Reply sent
to
Glenn Morris <rgm <at> gnu.org>
:
You have taken responsibility.
(Tue, 06 Jan 2015 18:56:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Daniel Daboul <danieldaboul <at> gmail.com>
:
bug acknowledged by developer.
(Tue, 06 Jan 2015 18:56:02 GMT)
Full text and
rfc822 format available.
Message #63 received at 18756-done <at> debbugs.gnu.org (full text, mbox):
Version: 24.5
Peter Oliver wrote:
> I can reproduce this when electric-indent-mode is on and sh-set-shell
> is run for a csh-family shell.
Thanks for this vital clue.
I installed the following, which seems to fix it.
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index d79b387..4700324 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -2477,7 +2475,8 @@ Lines containing only comments are considered empty."
(current-column)))
current)
(save-excursion
- (indent-to (if (eq this-command 'newline-and-indent)
+ (indent-to (if (or (eq this-command 'newline-and-indent)
+ (and electric-indent-mode (eq this-command 'newline)))
previous
(if (< (current-column)
(setq current (progn (back-to-indentation)
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 04 Feb 2015 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 10 years and 138 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.