el/dot-emacs.el: Indent `funcall' properly in Emacs Lisp too.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 10 Jul 2020 19:41:17 +0000 (20:41 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 9 Aug 2020 03:34:42 +0000 (04:34 +0100)
Fortunately, not much hacking is required.

el/dot-emacs.el

index fc3c13f..5ccce36 100644 (file)
@@ -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)