void (@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { EmacsProcessingHandler emacsProcessingHandler = LanguageEmacsExtension.INSTANCE.forLanguage(file.getLanguage()); if (emacsProcessingHandler != null) { EmacsProcessingHandler.Result result = emacsProcessingHandler.changeIndent(project, editor, file); if (result == EmacsProcessingHandler.Result.STOP) { return; } } Document document = editor.getDocument(); int startLine = document.getLineNumber(editor.getSelectionModel().getSelectionStart()); int endLine = document.getLineNumber(editor.getSelectionModel().getSelectionEnd()); for (int line = startLine; line <= endLine; line++) { int lineStart = document.getLineStartOffset(line); CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(project); int newPos = codeStyleManager.adjustLineIndent(file, lineStart); if (startLine == endLine && editor.getCaretModel().getOffset() < newPos) { editor.getCaretModel().moveToOffset(newPos); editor.getSelectionModel().removeSelection(); editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); } } }