M-x shell-script-mode #hi ls x-3 With every key-press the current line gets indeted, so that the buffer looks like: #hi ls x=3 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))