Subject: bug#27503: 26.0.50; Not lining up Javascript arguments

From: James Nguyen <[email-masked]>
Date: Tue, 27 Jun 2017 12:42:34 -0700

This would effectively be the same as my snippet right? I removed the if
check and the else block to always go into the progn.

This looks good to me unless there are other gotchas. Making it
configurable is ideal.

-- 
  James Nguyen
  [email-masked]

On Tue, Jun 27, 2017, at 11:16 AM, Ingo Lohmar wrote:
> I've been meaning to post this for months, guess now is as good a time
> as any.  Here's an alternative take that I've been using for a long time
> without noticing any bugs.  It is a less intrusive change to achieve the
> desired effect AFAICT:
> 
> 
> 
> diff --git i/lisp/progmodes/js.el w/lisp/progmodes/js.el
> index bae9e52bf0..a27db82eb0 100644
> --- i/lisp/progmodes/js.el
> +++ w/lisp/progmodes/js.el
> @@ -475,6 +475,11 @@ js-flat-functions
>    :type 'boolean
>    :group 'js)
>  
> +(defcustom js-cont-nonempty-list-indent-rigidly nil
> +  "Indent continuation of non-empty ([{ lines in `js-mode' rigidly."
> +  :type 'boolean
> +  :group 'js)
> +
>  (defcustom js-comment-lineup-func #'c-lineup-C-comments
>    "Lineup function for `cc-mode-style', for C comments in `js-mode'."
>    :type 'function
> @@ -2092,7 +2097,8 @@ js--proper-indentation
>                   (switch-keyword-p (looking-at
>                   "default\\_>\\|case\\_>[^:]"))
>                   (continued-expr-p (js--continued-expression-p)))
>               (goto-char (nth 1 parse-status)) ; go to the opening char
> -             (if (looking-at "[({[]\\s-*\\(/[/*]\\|$\\)")
> +             (if (or js-cont-nonempty-list-indent-rigidly
> +                     (looking-at "[({[]\\s-*\\(/[/*]\\|$\\)"))
>                   (progn ; nothing following the opening paren/bracket
>                     (skip-syntax-backward " ")
>                     (when (eq (char-before) ?\)) (backward-list))