From: Mark Wooding Date: Fri, 10 Jul 2020 19:41:17 +0000 (+0100) Subject: el/dot-emacs.el: Indent `funcall' properly in Emacs Lisp too. X-Git-Url: https://git.distorted.org.uk/~mdw/profile/commitdiff_plain/48e4a665d400660e74cbd2c31a1fae4fa81b957d el/dot-emacs.el: Indent `funcall' properly in Emacs Lisp too. Fortunately, not much hacking is required. --- diff --git a/el/dot-emacs.el b/el/dot-emacs.el index fc3c13f..5ccce36 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -4313,11 +4313,12 @@ that character only to be normal punctuation.") lisp-loop-forms-indentation 2 lisp-lambda-list-keyword-parameter-alignment t) -(defun mdw-indent-funcall (path state indent-point sexp-column normal-indent) +(defun mdw-indent-funcall + (path state &optional indent-point sexp-column normal-indent) "Indent `funcall' more usefully. Essentially, treat `funcall foo' as a function name, and align the arguments to `foo'." - (and (null (cdr path)) + (and (or (not (consp path)) (null (cadr path))) (save-excursion (goto-char (cadr state)) (forward-char 1) @@ -4328,7 +4329,9 @@ to `foo'." (forward-sexp -1) (and (= start-line (line-number-at-pos)) (current-column)))))))) -(put 'funcall 'common-lisp-indent-function 'mdw-indent-funcall) +(progn + (put 'funcall 'common-lisp-indent-function 'mdw-indent-funcall) + (put 'funcall 'lisp-indent-function 'mdw-indent-funcall)) (defadvice common-lisp-loop-part-indentation (around mdw-fix-loop-indentation (indent-point state) activate compile)