Java's try-with-resources statement (new in version 1.7) is indented incorrectly in java-mode. Steps to reproduce: * Create a new file. Enable java-mode and electric-indent-mode. * Type the following: public class Test { public static void main(String[] args) { Path dir = Paths.get(System.getProperty("user.home")); try (DirectoryStream stream = Files.newDirectoryStream(dir)) { System.out.println("test"); } } } The two lines after the try statement are indented an additional four spaces. The final two closing braces are indented properly. Somebody else has the same problem: http://stackoverflow.com/questions/16554232/why-does-try-with-resources-break-indentation-in-emacs I submitted this bug report a couple of weeks ago, but I didn't receive a reply, so I'm trying again. I hope I'm not creating a duplicate. If Emacs crashed, and you have the Emacs process in the gdb debugger, please include the output from the following gdb commands: `bt full' and `xbacktrace'. For information about debugging Emacs, please read the file /usr/share/emacs/24.3/etc/DEBUG. In GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.6.4) of 2013-04-14 on marid, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.11303000 System Description: Ubuntu 13.04 Configured using: `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.3/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3/site-lisp:/usr/share/emacs/site-lisp' '--with-crt-dir=/usr/lib/x86_64-linux-gnu' '--with-x=yes' '--with-x-toolkit=gtk3' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro' 'CPPFLAGS=-D_FORTIFY_SOURCE=2'' Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Emacs-Lisp Minor modes in effect: paredit-mode: t my-keys-minor-mode: t recentf-mode: t show-paren-mode: t global-auto-revert-mode: t iswitchb-mode: t ido-everywhere: t global-linum-mode: t linum-mode: t global-auto-complete-mode: t auto-complete-mode: t highlight-sexps-mode: t electric-indent-mode: t global-edit-server-edit-mode: t workgroups-mode: t desktop-save-mode: t global-surround-mode: t surround-mode: t volatile-highlights-mode: t yas-global-mode: t yas-minor-mode: t evil-leader-mode: t global-evil-leader-mode: t evil-mode: t evil-local-mode: t global-undo-tree-mode: t tooltip-mode: t mouse-wheel-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 column-number-mode: t line-number-mode: t global-visual-line-mode: t visual-line-mode: t transient-mark-mode: t Recent input: b u t SPC I SPC d i d n ' t SPC r e c e i v e SPC a SPC r e p l y , SPC s o SPC I ' m SPC t r y i n SPC g SPC a SPC g g a i n e n . t z M-z M-z M-z M-Y . e n J u u , s u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u u y y y y y y w r < M-z n e w r M-k M-a e m a i l a d d r e s s C-g M-a m a i l - h o s t t o u f C-g e C-g m a i e e f m a i l - t o M-r q M-a e e M-a m a i l - f o r o r o m C-g v m a i l - h o s t - a d C-x r j e G o ( t e s t e e t q SPC m a i l - h o s t SPC " p b r i n i c h l a n g l o i r s @ g m a i l . c o m M-Y C-x C-e s t e e u u e e u u e a ] ] ] ] ] c , w M-a M-i Recent messages: Type "q" in help window to restore its previous buffer. ~/.emacs and /home/pat/.emacs.d/.emacs are the same file Executing: ~/apps/eclipse/eclim -command project_list [2 times] Mark set [yas] Cyclic parenthood: mode text-mode has already seen as a parent of mode emacs-lisp-mode Auto-saving...done "pbrinichlanglois@gmail.com" Executing: ~/apps/eclipse/eclim -command project_list user-error: Beginning of history; no preceding item [2 times] user-error: End of history; no default available [15 times] Load-path shadows: /home/pat/.emacs.d/elpa/company-20130604.316/.dir-locals hides /home/pat/.emacs.d/elpa/magit-20130604.1754/.dir-locals /home/pat/.emacs.d/elpa/color-theme-solarized-20130307.1350/solarized-dark-theme hides /home/pat/.emacs.d/elpa/solarized-theme-20130531.2020/solarized-dark-theme /home/pat/.emacs.d/elpa/color-theme-solarized-20130307.1350/solarized-light-theme hides /home/pat/.emacs.d/elpa/solarized-theme-20130531.2020/solarized-light-theme /home/pat/.emacs.d/elpa/pylint-20121112.1335/pylint hides /usr/share/emacs24/site-lisp/pylint/pylint /home/pat/.emacs.d/elpa/ipython-2927/ipython hides /usr/share/emacs/site-lisp/ipython /usr/share/emacs/24.3/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup /usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.3/lisp/textmodes/ispell /usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.3/lisp/textmodes/flyspell /home/pat/.emacs.d/elpa/company-20130604.316/.dir-locals hides /usr/share/emacs/24.3/lisp/gnus/.dir-locals Features: (find-func shadow sort mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils cc-langs cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs executable two-column misearch multi-isearch ffap url-parse auth-source gnus-util mm-util mail-prsvr password-cache url-vars smex server vc-git paredit dropdown-list helm-config helm-aliases recentf tree-widget wid-edit solarized-light-theme solarized-definitions paren ruby-end autorevert iswitchb ido linum dired+ dired-x dired-aux dired edit-server-htmlize html2text ac-emacs-eclim-source eclim-completion auto-complete-config auto-complete popup time-date help-at-pt eclimd eclim eclim-problems eclim-maven eclim-ant eclim-java json eclim-project highlight-sexps multi-term term disp-table ehelp electric edit-server workgroups desktop surround cl-macs gv buffer-stack smooth-scrolling etags volatile-highlights key-chord smarter-compile yasnippet help-mode evil-leader evil evil-integration evil-maps evil-commands evil-types evil-search evil-ex evil-macros evil-repeat evil-states evil-core evil-common undo-tree diff windmove rect evil-digraphs evil-vars slime easy-mmode pp hyperspec thingatpt browse-url cl pallet carton melpa fill-column-indicator ac-dabbrev-autoloads ace-jump-mode-autoloads ack-and-a-half-autoloads browse-kill-ring-autoloads buffer-move-autoloads color-theme-solarized-autoloads color-theme-autoloads company-autoloads diff-hl-autoloads dired+-autoloads dropdown-list-autoloads edit-server-htmlize-autoloads edit-server-autoloads emacs-eclim-autoloads evil-leader-autoloads evil-autoloads expand-region-autoloads feature-mode-autoloads fill-column-indicator-autoloads find-file-in-project-autoloads fold-this-autoloads geiser-autoloads gist-autoloads gh-autoloads eieio goto-chg-autoloads haml-mode-autoloads helm-autoloads htmlize-autoloads idle-highlight-mode-autoloads ido-ubiquitous-autoloads ipython-autoloads jedi-autoloads auto-complete-autoloads epc-autoloads ctable-autoloads concurrent-autoloads deferred-autoloads key-chord-autoloads logito-autoloads magit-autoloads info easymenu markdown-mode-autoloads maxframe-autoloads melpa-autoloads byte-opt warnings bytecomp byte-compile cconv multi-term-autoloads noctilux-theme-autoloads pallet-autoloads carton-autoloads paredit-autoloads pcache-autoloads pep8-autoloads popup-autoloads projectile-autoloads dash-autoloads pylint-autoloads python-mode-autoloads quack-autoloads rainbow-delimiters-autoloads rainbow-mode-autoloads revive-autoloads rinari-autoloads jump-autoloads inflections-autoloads findr-autoloads finder-inf ruby-block-autoloads ruby-compilation-autoloads edmacro kmacro inf-ruby-autoloads inf-ruby ruby-mode ruby-end-autoloads ruby-tools-autoloads s-autoloads scss-mode-autoloads slime-autoloads smarter-compile-autoloads smex-autoloads sml-mode-autoloads smooth-scrolling-autoloads advice help-fns cl-lib advice-preload solarized-theme-autoloads surround-autoloads thesaurus-autoloads tidy-autoloads unbound-autoloads undo-tree-autoloads volatile-highlights-autoloads websocket-autoloads workgroups-autoloads yari-autoloads yasnippet-autoloads package compile comint ansi-color ring tooltip 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 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 macroexp 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)