unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* shell-script indentation bug
@ 2008-02-27  8:38 Andreas Röhler
  2008-02-27 16:21 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Röhler @ 2008-02-27  8:38 UTC (permalink / raw)
  To: emacs-devel

Following the request

"shell-script indenting of &&, |"

I stumble over a supposed bug.

In a buffer in sh-mode

with cursor at the end of the line as shown below

if [ $# == 0 ]; then
____________________|______


C-j should indent.

Presently it doesn't, jumps to column 0.

A second C-i or `indent-according-to-mode' is needed.

A fix could call `indent-according-to-mode' always
after C-j.

Agreed so far?

Thanks

Andreas Röhler



In GNU Emacs 23.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.10.6)
 of 2007-12-09 on noname
Windowing system distributor `The X.Org Foundation', version 11.0.70199902
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  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: de_DE.UTF-8
  locale-coding-system: utf-8
  default-enable-multibyte-characters: t

Major mode: Shell-script

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
<help-echo> <help-echo> C-x C-f p r o g <tab> m u <tab> 
e i s <tab> . <tab> <return> <down> <down> <down> <down> 
<down> <left> C-j M-x r e p o r t - e m <tab> <ret
urn>

Recent messages:
Finished loading /usr/local/share/emacs/site-lisp/egg/leim-list.el 
   and load others...
Loading /usr/local/share/emacs/23.0.50/leim/leim-list.el (source)...done
Loading /MYPATH/emacs/20071207/emacs/leim/leim-list.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Setting up indent for shell type bash
setting up indent stuff
Indentation variables are now local.
Indentation setup for shell type bash
Auto-saving...done




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: shell-script indentation bug
  2008-02-27  8:38 shell-script indentation bug Andreas Röhler
@ 2008-02-27 16:21 ` Stefan Monnier
  2008-02-28 21:02   ` Chong Yidong
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2008-02-27 16:21 UTC (permalink / raw)
  To: Andreas R\x1fFFFFFFhler; +Cc: emacs-devel

> with cursor at the end of the line as shown below

> if [ $# == 0 ]; then
> ____________________|______


> C-j should indent.

Well, I'd agree, but it's done on purpose: C-j is bound to
sh-newline-and-indent whose docstring says:

  Strip unquoted whitespace, insert newline, and indent like current line.

Please can someone investigate which this binding was added (what was
it trying to fix), and then make it DTRT?


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: shell-script indentation bug
  2008-02-27 16:21 ` Stefan Monnier
@ 2008-02-28 21:02   ` Chong Yidong
  2008-02-28 21:38     ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2008-02-28 21:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: andreas.roehler, emacs-devel

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> with cursor at the end of the line as shown below
>
>> if [ $# == 0 ]; then
>> ____________________|______
>
>
>> C-j should indent.
>
> Well, I'd agree, but it's done on purpose: C-j is bound to
> sh-newline-and-indent whose docstring says:
>
>   Strip unquoted whitespace, insert newline, and indent like current line.
>
> Please can someone investigate which this binding was added (what was
> it trying to fix), and then make it DTRT?

It is present in the original version of sh-script.el, 13 years ago.

I think this binding should simply be removed, and the default
(newline-and-indent) used instead.
 




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: shell-script indentation bug
  2008-02-28 21:02   ` Chong Yidong
@ 2008-02-28 21:38     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2008-02-28 21:38 UTC (permalink / raw)
  To: Chong Yidong; +Cc: andreas.roehler, emacs-devel

>>> with cursor at the end of the line as shown below
>> 
>>> if [ $# == 0 ]; then
>>> ____________________|______
>> 
>> 
>>> C-j should indent.
>> 
>> Well, I'd agree, but it's done on purpose: C-j is bound to
>> sh-newline-and-indent whose docstring says:
>> 
>> Strip unquoted whitespace, insert newline, and indent like current line.
>> 
>> Please can someone investigate which this binding was added (what was
>> it trying to fix), and then make it DTRT?

> It is present in the original version of sh-script.el, 13 years ago.

> I think this binding should simply be removed, and the default
> (newline-and-indent) used instead.
 
Agreed,


        Stefan




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-02-28 21:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-27  8:38 shell-script indentation bug Andreas Röhler
2008-02-27 16:21 ` Stefan Monnier
2008-02-28 21:02   ` Chong Yidong
2008-02-28 21:38     ` Stefan Monnier

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).