Open stribb opened 5 years ago
Correction: it's with vanilla js-mode. A pared down config, mini.el
, that shows the same issues:
; invoke with emacs -q -l mini.el
;; This is necessary to tell `straight' where git is.
(add-to-list 'exec-path "/usr/local/bin" t)
(setenv "PATH" (mapconcat 'identity exec-path ":"))
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)))
(load bootstrap-file nil 'nomessage))
(setq-default straight-use-package-by-default t)
(straight-use-package 'use-package)
(use-package aggressive-indent
:hook (prog-mode . aggressive-indent-mode))
Hey there. Thanks for the report.
Aggressive-indent doesn't define how code is indented, that's the responsibility of the major-mode. For instance, if you disable aggressive-indent-mode, and then select the whole buffer and call M-x indent-region
, do you still see that behavior?
No. Again using my mini config, with the same initial file. If I hit enter after the [ on line 3, select the whole buffer then indent-region
, it becomes what I would have hoped for.
Yet more curiously, the following happened under aggressive-indent-mode when I extended the list to three elements:
class Fish {
constructor() {
var lst = [
'foo',
'bar',
'baz',
];
}
}
When I selected all then ran indent-region
, both 'baz'
and ];
went back into the right place.
I have a more minimal test case for you actually:
Emacs config:
(load-file (concat user-emacs-directory "straight/build/aggressive-indent/aggressive-indent.el"))
(add-hook 'prog-mode-hook 'aggressive-indent-mode)
Test case:
var lst = ['foo',
'bar',
'baz',
];
Emacs: 26.1 on OS-X. aggressive-indent-mode at HEAD: 3803f24 master origin/master Merge pull request #125 from CeleritasCelery/revert
Suppose I have code,
and I want to reformat the list to move the first item to a line of its own. I would expect this:
Instead, I got: