Subject: bug#9190: 24.0.50; wrong indentation in shell mode with main function

From: [email-masked]
Date: Thu, 28 Jul 2011 16:16:20 +0200

1) Emacs -Q
2) paste the following

main () {
}

3) press tab on the last line

The curly bracket is indented wrong:

main () {
    }

The curly bracket is incorrectly indented. It happens to any function
ending in main. Reproducible on emacs 23.3 and bzr.

In GNU Emacs 24.0.50.16 (i686-pc-linux-gnu, GTK+ Version 2.22.0)
 of 2011-07-28 on tao
Windowing system distributor `The X.Org Foundation', version 11.0.10900000
configured using `configure  '--prefix=/home/ubuntu/emacs-bzr''

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: fr_FR.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Shell-script

Minor modes in effect:
  erc-track-mode: t
  erc-track-minor-mode: t
  tracking-mode: t
  erc-ring-mode: t
  erc-netsplit-mode: t
  erc-match-mode: t
  erc-pcomplete-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-autojoin-mode: t
  erc-spelling-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-scrolltobottom-mode: t
  icomplete-mode: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  mouse-wheel-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

Recent input:
<next> <next> <next> <next> <next> <next> <next> <next> 
<next> <next> <next> <next> <next> <next> <next> <next> 
<next> <next> <next> <next> <next> <next> <next> <next> 
<next> <next> <next> <next> <next> <next> <next> <next> 
<next> <next> <next> <next> <next> <prior> <prior> 
<prior> <prior> <prior> <next> <next> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <up> <down> <down> p <backspace> C-p C-k C-k 
C-k <home> C-e <return> f r o m : SPC i v a n . a <backspace> 
k a n i s @ g o o g l e m a i l . c o m C-c C-c d y 
y <M-backspace> g <return> y y C-x b - f <return> <prior> 
<prior> <prior> <next> <insert> <next> <next> <next> 
<next> <next> M-i i C-x C-f ~ t m p / f o o . c <backspace> 
s h <backspace> <return> m a i n SPC ( ) <return> <left> 
<left> <left> <right> <right> <right> <return> C-p 
C-p C-e SPC { <return> } <tab> C-n C-n C-p f o o SPC 
( ) S-SPC { <return> } <tab> C-p C-p <tab> C-n <tab> 
C-n <tab> C-p C-a C-k C-k C-p <tab> p <backspace> C-p 
<M-backspace> f o o C-n <tab> C-n <return> m a n <backspace> 
i n SPC ( ) S-SPC { <return> <tab> } <tab> <up> <up> 
<up> <up> C-a C-SPC <down> <down> <down> <down> <down> 
M-w <down-mouse-1> <mouse-movement> <mouse-movement> 
<drag-mouse-1> <down-mouse-1> <mouse-1> <return> <return> 
b a r <tab> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <up> 
<up> <up> <up> <up> <up> <down> C-SPC <end> <down-mouse-1> 
<mouse-movement> <mouse-movement> <drag-mouse-1> C-x 
C-w C-g C-x C-s <up> <down> C-SPC <down> <down> <down> 
<down> <down> <down> <down> M-w M-x r e p o <tab> e 
<backspace> r <tab> <return>

Recent messages:
Mark set
byte-code: End of buffer
Mark set [2 times]
Ido mode enabled
Quit
Saving file /home/ubuntu/tmp/foo.sh...
Wrote /home/ubuntu/tmp/foo.sh
Mark set
byte-code: End of buffer [2 times]
Making completion list...

Load-path shadows:
/home/ubuntu/.emacs.d/misc/time hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/time
/home/ubuntu/.emacs.d/misc/whitespace hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/whitespace
/home/ubuntu/.emacs.d/org/org-capture hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-capture
/home/ubuntu/.emacs.d/org/org-bibtex hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-bibtex
/home/ubuntu/.emacs.d/org/org-beamer hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-beamer
/home/ubuntu/.emacs.d/org/org-bbdb hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-bbdb
/home/ubuntu/.emacs.d/org/org-attach hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-attach
/home/ubuntu/.emacs.d/org/org-ascii hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-ascii
/home/ubuntu/.emacs.d/org/org-archive hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-archive
/home/ubuntu/.emacs.d/org/org-agenda hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-agenda
/home/ubuntu/.emacs.d/org/ob hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob
/home/ubuntu/.emacs.d/org/ob-tangle hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-tangle
/home/ubuntu/.emacs.d/org/ob-table hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-table
/home/ubuntu/.emacs.d/org/org hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org
/home/ubuntu/.emacs.d/org/org-xoxo hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-xoxo
/home/ubuntu/.emacs.d/org/org-wl hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-wl
/home/ubuntu/.emacs.d/org/org-w3m hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-w3m
/home/ubuntu/.emacs.d/org/org-vm hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-vm
/home/ubuntu/.emacs.d/org/org-timer hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-timer
/home/ubuntu/.emacs.d/org/org-taskjuggler hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-taskjuggler
/home/ubuntu/.emacs.d/org/org-table hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-table
/home/ubuntu/.emacs.d/org/org-src hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-src
/home/ubuntu/.emacs.d/org/org-rmail hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-rmail
/home/ubuntu/.emacs.d/org/org-remember hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-remember
/home/ubuntu/.emacs.d/org/org-inlinetask hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-inlinetask
/home/ubuntu/.emacs.d/org/org-info hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-info
/home/ubuntu/.emacs.d/org/org-indent hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-indent
/home/ubuntu/.emacs.d/org/org-id hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-id
/home/ubuntu/.emacs.d/org/org-icalendar hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-icalendar
/home/ubuntu/.emacs.d/org/org-html hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-html
/home/ubuntu/.emacs.d/org/org-habit hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-habit
/home/ubuntu/.emacs.d/org/org-gnus hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-gnus
/home/ubuntu/.emacs.d/org/org-freemind hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-freemind
/home/ubuntu/.emacs.d/org/org-footnote hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-footnote
/home/ubuntu/.emacs.d/org/org-feed hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-feed
/home/ubuntu/.emacs.d/org/org-faces hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-faces
/home/ubuntu/.emacs.d/org/org-exp hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-exp
/home/ubuntu/.emacs.d/org/org-install hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-install
/home/ubuntu/.emacs.d/org/org-exp-blocks hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-exp-blocks
/home/ubuntu/.emacs.d/org/ob-sqlite hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-sqlite
/home/ubuntu/.emacs.d/org/ob-perl hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-perl
/home/ubuntu/.emacs.d/org/ob-gnuplot hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-gnuplot
/home/ubuntu/.emacs.d/org/ob-octave hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-octave
/home/ubuntu/.emacs.d/org/ob-ocaml hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-ocaml
/home/ubuntu/.emacs.d/org/ob-mscgen hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-mscgen
/home/ubuntu/.emacs.d/org/ob-matlab hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-matlab
/home/ubuntu/.emacs.d/org/ob-lob hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-lob
/home/ubuntu/.emacs.d/org/ob-latex hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-latex
/home/ubuntu/.emacs.d/org/ob-keys hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-keys
/home/ubuntu/.emacs.d/org/ob-haskell hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-haskell
/home/ubuntu/.emacs.d/org/ob-sql hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-sql
/home/ubuntu/.emacs.d/org/ob-sh hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-sh
/home/ubuntu/.emacs.d/org/ob-screen hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-screen
/home/ubuntu/.emacs.d/org/ob-sass hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-sass
/home/ubuntu/.emacs.d/org/ob-ruby hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-ruby
/home/ubuntu/.emacs.d/org/ob-ref hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-ref
/home/ubuntu/.emacs.d/org/ob-R hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-R
/home/ubuntu/.emacs.d/org/ob-python hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-python
/home/ubuntu/.emacs.d/org/org-publish hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-publish
/home/ubuntu/.emacs.d/org/org-protocol hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-protocol
/home/ubuntu/.emacs.d/org/org-plot hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-plot
/home/ubuntu/.emacs.d/org/org-mouse hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-mouse
/home/ubuntu/.emacs.d/org/org-mobile hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-mobile
/home/ubuntu/.emacs.d/org/org-mks hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-mks
/home/ubuntu/.emacs.d/org/org-mhe hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-mhe
/home/ubuntu/.emacs.d/org/org-mew hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-mew
/home/ubuntu/.emacs.d/org/org-macs hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-macs
/home/ubuntu/.emacs.d/org/org-mac-message hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-mac-message
/home/ubuntu/.emacs.d/org/org-list hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-list
/home/ubuntu/.emacs.d/org/org-latex hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-latex
/home/ubuntu/.emacs.d/org/org-jsinfo hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-jsinfo
/home/ubuntu/.emacs.d/org/org-irc hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-irc
/home/ubuntu/.emacs.d/org/org-entities hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-entities
/home/ubuntu/.emacs.d/org/org-docview hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-docview
/home/ubuntu/.emacs.d/org/org-docbook hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-docbook
/home/ubuntu/.emacs.d/org/org-datetree hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-datetree
/home/ubuntu/.emacs.d/org/org-ctags hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-ctags
/home/ubuntu/.emacs.d/org/org-crypt hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-crypt
/home/ubuntu/.emacs.d/org/org-compat hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-compat
/home/ubuntu/.emacs.d/org/org-colview hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-colview
/home/ubuntu/.emacs.d/org/org-clock hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/org-clock
/home/ubuntu/.emacs.d/org/ob-exp hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-exp
/home/ubuntu/.emacs.d/org/ob-eval hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-eval
/home/ubuntu/.emacs.d/org/ob-emacs-lisp hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-emacs-lisp
/home/ubuntu/.emacs.d/org/ob-dot hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-dot
/home/ubuntu/.emacs.d/org/ob-ditaa hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-ditaa
/home/ubuntu/.emacs.d/org/ob-css hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-css
/home/ubuntu/.emacs.d/org/ob-comint hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-comint
/home/ubuntu/.emacs.d/org/ob-clojure hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-clojure
/home/ubuntu/.emacs.d/org/ob-C hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/org/ob-C
/home/ubuntu/.emacs.d/misc/erc-goodies hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/erc/erc-goodies
/home/ubuntu/.emacs.d/emms/tq hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/emacs-lisp/tq
~/tmp/find-func hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/emacs-lisp/find-func
/home/ubuntu/.emacs.d/ert/ert hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/emacs-lisp/ert
/home/ubuntu/.emacs.d/misc/appt hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/calendar/appt
/home/ubuntu/.emacs.d/misc/sym-comp hides /home/ubuntu/emacs-bzr/share/emacs/24.0.50/lisp/obsolete/sym-comp

Features:
(skeleton sh-script executable rot13 disp-table gnutls mailalias
smtpmail sendmail ido uniquify erc-track multi-isearch japan-util kkc
ja-dic-utl quail garak notify dbus-util dbus xml tree-widget elim
warnings browse-url lui tracking incomplete network-stream auth-source
eieio byte-opt bytecomp byte-compile cconv macroexp assoc password-cache
starttls tls erc-ring comint erc-netsplit erc-match erc-pcomplete
pcomplete erc-button erc-fill erc-stamp erc-join erc-spelling
erc-goodies erc erc-backend erc-compat thingatpt pp jka-compr info ffap
debug newcomment swbuff vc-hg autoinsert noutline outline help-mode view
shadow sort hashcash cookie1 flyspell ispell bbdb-picture bbdb-com cl
bbdb timezone gnus-util mail-extr emacsbug icomplete advice
advice-preload paren eldoc help-fns init xcscope ivan-w3m ivan-term
ivan-slime ivan-re-builder ivan-org ivan-newsticker ivan-muse
ivan-message ivan-japanese ivan-gnus ivan-french easy-mmode ivan-english
ivan-emms ivan-elim ivan-comint bs ivan-bbdb ivan-anki tex-site ring
caps-mode ivan-common-code message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mailabbrev mail-utils gmm-utils mailheader
saveplace auto-complete-config auto-complete popup regexp-opt rx
cus-edit easymenu cus-start cus-load wid-edit ivan-var ivan-keymap
edmacro kmacro ivan-fun find-func ivan-face ivan-load time-date tooltip
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd
fontset image fringe lisp-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 loaddefs button faces cus-face files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)

-- 
Ivan Kanis
http://kanis.fr

Arsenic is edible. Only once.
    -- Anonymous