Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The default indentation style for multi-line function calls in many emacs modes is to align the closing round bracket with the other arguments to the function, thus:


I would prefer it if the closing bracket aligned with the start of the line that contains the opening bracket. For example:


How do I do this?

share|improve this question

1 Answer 1

up vote 8 down vote accepted
  • For the many modes derived from CC Mode (for example, c-mode, java-mode, php-mode), customise c-offsets-alist so that arglist-close is set to c-lineup-close-paren.
  • For cperl-mode, customise cperl-indent-parens-as-block to true.
  • For cperl-mode, GNU Emacs 24.3+, set cperl-close-paren-offset to the negative of cperl-indent-level
  • For perl-mode in GNU emacs 24.3 and greater, customise perl-indent-parens-as-block to true.
  • For python-mode, this behaviour is found in GNU emacs 24.3 and greater.

You can customise a variable by typing M-x customize-variable. Alternatively, add the following lines to your ~/.emacs:

(add-to-list 'c-offsets-alist '(arglist-close . c-lineup-close-paren))
(setq cperl-indent-parens-as-block t)
(setq perl-indent-parens-as-block t)
share|improve this answer
Is there any way of getting this to work in python-mode with Emacs 23.1.1? – ishmael Oct 10 '14 at 3:31
The solution for Emacs 23.1.1 is simply to get the latest python-mode.el here. Untar it in your ~/.emacs.d directory, then in your .emacs file, add this: (add-to-list 'load-path (expand-file-name "~/.emacs.d/python-mode.el-6.1.3")) (require 'python-mode) – ishmael Oct 10 '14 at 4:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.