GNU bug report logs - #9193
23.3; newline-and-indent broken in shell-script (sh mode)

Previous Next

Package: emacs;

Reported by: Jim Diamond <zlists <at> ns.sympatico.ca>

Date: Thu, 28 Jul 2011 19:13:02 UTC

Severity: normal

Tags: patch

Merged with 6916

Found in version 23.3

Done: Chong Yidong <cyd <at> stupidchicken.com>

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 9193 in the body.
You can then email your comments to 9193 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9193; Package emacs. (Thu, 28 Jul 2011 19:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jim Diamond <zlists <at> ns.sympatico.ca>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 28 Jul 2011 19:13:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jim Diamond <zlists <at> ns.sympatico.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.3; newline-and-indent broken in shell-script (sh mode)
Date: Thu, 28 Jul 2011 12:57:34 -0300
Create the following file

#! /bin/sh

if [ $a == $b ]
then
    echo newline-and-indent is OK here
    echo "newline-and-indent is NOT OK here"
fi

Now, put the cursor at the end of the first "echo" line and type ^J
(bound to newline-and-indent).  As expected, it does a
newline-and-indent.  Now put the cursor at the end of the second "echo"
line and type ^J.  It does the newline, but not the indent.

[ Other possibly completely irrelevant information:
Playing around a bit, I found that if I create my own function and
instead of using (newline-and-indent) I use
    (newline)
    (sit-for .001)
    (indent-according-to-mode)
then calling that function Does The Right Thing.
]



In GNU Emacs 23.3.1 (x86_64-slackware-linux-gnu, GTK+ Version 2.24.1)
 of 2011-03-12 on midas64
Windowing system distributor `The X.Org Foundation', version 11.0.10905000
configured using `configure  '--prefix=/usr' '--sysconfdir=/etc' '--localstatedir=/var' '--program-prefix=' '--program-suffix=' '--mandir=/usr/man' '--infodir=/usr/info' '--enable-static=no' '--enable-shared=yes' '--with-x' '--with-x-toolkit=gtk' '--build=x86_64-slackware-linux' 'build_alias=x86_64-slackware-linux' 'CFLAGS=-O2 -fPIC''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_CA
  value of $XMODIFIERS: nil
  locale-coding-system: iso-latin-1-unix
  default enable-multibyte-characters: t

Major mode: Shell-script

Minor modes in effect:
  tooltip-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
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<backspace> C-e C-j <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> M-x b u g <tab> 
<tab> C-g M-x a p r o <tab> <return> b u g <return> 
<down-mouse-1> <mouse-movement> <mouse-movement> <mouse-1> 
C-s - b u g C-s C-s <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<return> <return> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <down-mouse-1> 
<mouse-movement> <drag-mouse-1> C-x b <return> C-x 
C-f a . s h <backspace> <backspace> <backspace> <backspace> 
b u g g y . s h <return> # ! SPC / b i n s <backspace> 
/ s h <return> <return> i f SPC [ SPC a SPC = SPC <backspace> 
= SPC b SPC ] <return> t h e n <return> f i <up> C-e 
<return> <tab> a <up> <up> $ <right> <right> <right> 
<right> <right> $ <down> <down> = <backspace> <backspace> 
e c h o SPC t h i s SPC i s SPC o k <return> <tab> 
<up> <down> C-a <backspace> C-j e c h o SPC " t h i 
s SPC i s SPC n o t " C-j <backspace> <up> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> SPC n e w l i n e SPC a n d SPC i n d C-w C-w 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> - a n d - i n d 
e n t C-d C-d C-d C-d C-d C-e SPC h e r e <down> M-b 
M-b M-b n e w M-/ SPC M-d C-d <right> <right> <right> 
M-u SPC O K <backspace> K SPC h e r e <up> M-b M-b 
M-u C-e C-j <backspace> <backspace> <backspace> <backspace> 
<backspace> <down> C-e C-j <backspace> M-x g n u - 
e m C-u C-g M-x r e p o r t <tab> <return>

Recent messages:
Quit
Mark saved where search started
Type C-x 4 C-o RET to restore the other window.
(New file)
Setting up indent for shell type sh
setting up indent stuff
Indentation variables are now local.
Indentation setup for shell type sh
kill-region: The mark is not set now, so there is no region [2 times]
Auto-saving...done
Quit

Load-path shadows:
/usr/share/emacs/site-lisp/t-mouse hides /usr/share/emacs/23.3/lisp/t-mouse

Features:
(shadow sort mail-extr message idna sendmail ecomplete rfc822 mml
mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse
rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util
netrc time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock
sha1 hex-util hashcash mail-utils emacsbug dabbrev help-fns apropos
skeleton multi-isearch kmacro two-column iso-transl help-mode easymenu
view regexp-opt sh-script executable tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag 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 loaddefs button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process dbusbind
font-render-setting gtk x-toolkit x multi-tty emacs)




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9193; Package emacs. (Fri, 29 Jul 2011 04:05:02 GMT) Full text and rfc822 format available.

Message #8 received at 9193 <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: Jim Diamond <zlists <at> ns.sympatico.ca>
Cc: 9193 <at> debbugs.gnu.org
Subject: Re: bug#9193: 23.3;
	newline-and-indent broken in shell-script (sh mode)
Date: Fri, 29 Jul 2011 12:04:10 +0800
On 2011-07-28 23:57 +0800, Jim Diamond wrote:
> Create the following file
> Now, put the cursor at the end of the first "echo" line and type ^J
> (bound to newline-and-indent).  As expected, it does a
> newline-and-indent.  Now put the cursor at the end of the second "echo"
> line and type ^J.  It does the newline, but not the indent.

I cannot reproduce this on GNU Emacs 23.3.50.1 of 2011-07-27.

Leo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9193; Package emacs. (Sat, 30 Jul 2011 18:24:02 GMT) Full text and rfc822 format available.

Message #11 received at 9193 <at> debbugs.gnu.org (full text, mbox):

From: zlists <at> ns.sympatico.ca
To: 9193 <at> debbugs.gnu.org
Subject: 23.3; newline-and-indent broken in shell-script (sh mode)
Date: Thu, 28 Jul 2011 16:22:20 -0300
I hunted a bit before sending the bug report out, but further hunting
after I submitted the report reveals
	bug#6916: Fwd: [PATCH] fix indent bug in sh-script

I expect that is the same issue, and according to the thread a fix has
been submitted (presumably to Emacs 24) almost a year ago.






Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9193; Package emacs. (Wed, 03 Aug 2011 01:48:01 GMT) Full text and rfc822 format available.

Message #14 received at 9193 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Jim Diamond <zlists <at> ns.sympatico.ca>
Cc: 9193 <at> debbugs.gnu.org
Subject: Re: bug#9193: 23.3;
	newline-and-indent broken in shell-script (sh mode)
Date: Tue, 02 Aug 2011 21:46:53 -0400
> #! /bin/sh

> if [ $a == $b ]
> then
>     echo newline-and-indent is OK here
>     echo "newline-and-indent is NOT OK here"
> fi

> Now, put the cursor at the end of the first "echo" line and type ^J
> (bound to newline-and-indent).  As expected, it does a
> newline-and-indent.  Now put the cursor at the end of the second "echo"
> line and type ^J.  It does the newline, but not the indent.

> [ Other possibly completely irrelevant information:
> Playing around a bit, I found that if I create my own function and
> instead of using (newline-and-indent) I use
>     (newline)
>     (sit-for .001)
>     (indent-according-to-mode)
> then calling that function Does The Right Thing.
> ]

FWIW it seems to be fixed in the trunk (i.e. in the upcoming Emacs-24).
Could you try it out to confirm it fixes your problems?


        Stefan




Forcibly Merged 6916 9193. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 06 Aug 2011 22:06:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 04 Sep 2011 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 350 days ago.

Previous Next


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