[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/aggressive-indent 43bce89 02/43: Fix #92 - Define aggre
From: |
Stefan Monnier |
Subject: |
[elpa] externals/aggressive-indent 43bce89 02/43: Fix #92 - Define aggressive-indent-stop-here-hook |
Date: |
Wed, 7 Jul 2021 22:49:38 -0400 (EDT) |
branch: externals/aggressive-indent
commit 43bce892ce71b23528ad9e318b2b6e861c5ea6be
Author: Artur Malabarba <bruce.connor.am@gmail.com>
Commit: Artur Malabarba <bruce.connor.am@gmail.com>
Fix #92 - Define aggressive-indent-stop-here-hook
---
aggressive-indent.el | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/aggressive-indent.el b/aggressive-indent.el
index 431c87a..df04cb9 100644
--- a/aggressive-indent.el
+++ b/aggressive-indent.el
@@ -256,10 +256,32 @@ This variable is a list where each element is a Lisp form.
As long as any one of these forms returns non-nil,
aggressive-indent will not perform any indentation.
-See `aggressive-indent--internal-dont-indent-if' for usage examples."
+See `aggressive-indent--internal-dont-indent-if' for usage examples.
+
+Note that this is only used once, and only on the line where the
+point is when we're about to start indenting. In order to
+prevent indentation of further lines, see
+`aggressive-indent-stop-here-hook'."
:type '(repeat sexp)
:package-version '(aggressive-indent . "0.2"))
+(defcustom aggressive-indent-stop-here-hook nil
+ "A hook that runs on each line before it is indented.
+If any function on this hook returns non-nil, it immediately
+prevents indentation of the current line and any further
+lines.
+
+Note that aggressive-indent does indentation in two stages. The
+first stage indents the entire edited region, while the second
+stage keeps indenting further lines until its own logic decide to
+stop. This hook only affects the second stage. That is, it
+effectly lets you add your own predicates to the logic that
+decides when to stop.
+
+In order to prevent indentation before the first stage, see
+`aggressive-indent-dont-indent-if' instead."
+ :type 'hook)
+
(defvar aggressive-indent--error-message "One of the forms in
`aggressive-indent-dont-indent-if' had the following error, I've disabled it
until you fix it: %S"
"Error message thrown by `aggressive-indent-dont-indent-if'.")
@@ -355,7 +377,8 @@ until nothing more happens."
(forward-line 1)
(skip-chars-forward "[:blank:]\n\r\xc")
(let ((base-column (current-column)))
- (while (and (null (eobp))
+ (while (and (not (eobp))
+ (not (run-hook-with-args-until-success
'aggressive-indent-stop-here-hook))
(aggressive-indent--indent-current-balanced-line
base-column)))))
(goto-char p))))
- [elpa] externals/aggressive-indent updated (7e65c9e -> cb416fa), Stefan Monnier, 2021/07/07
- [elpa] externals/aggressive-indent 7653dd5 01/43: Improve the logic for deciding how far to indent beyond changed region, Stefan Monnier, 2021/07/07
- [elpa] externals/aggressive-indent a8c462f 04/43: Add def to the list of ruby-mode exceptions, Stefan Monnier, 2021/07/07
- [elpa] externals/aggressive-indent 86d5643 05/43: Fix `aggressive-indent-protected-commands', Stefan Monnier, 2021/07/07
- [elpa] externals/aggressive-indent 2f54a58 03/43: Use an idle-timer instead of sit-for+redisplay, Stefan Monnier, 2021/07/07
- [elpa] externals/aggressive-indent 43bce89 02/43: Fix #92 - Define aggressive-indent-stop-here-hook,
Stefan Monnier <=
- [elpa] externals/aggressive-indent dfdf3b2 06/43: Merge pull request #102 from raxod502/fix-protected-commands, Stefan Monnier, 2021/07/07
- [elpa] externals/aggressive-indent 893dae0 10/43: Add some modes to excluded modes, Stefan Monnier, 2021/07/07
- [elpa] externals/aggressive-indent 8324b88 08/43: Merge pull request #103 from peterwvj/master, Stefan Monnier, 2021/07/07
- [elpa] externals/aggressive-indent e3c41af 11/43: New variable: aggressive-indent-protected-current-commands, Stefan Monnier, 2021/07/07
- [elpa] externals/aggressive-indent 5959b48 09/43: Experiment with testing `indent-line-function` instead of excluded-modes, Stefan Monnier, 2021/07/07
- [elpa] externals/aggressive-indent 4b01402 07/43: Fix typo in README, Stefan Monnier, 2021/07/07
- [elpa] externals/aggressive-indent 450fe20 18/43: Check no-indent conditions at lower level, so they work on save, Stefan Monnier, 2021/07/07
- [elpa] externals/aggressive-indent 8e70039 19/43: Merge pull request #115 from joaotavora/master, Stefan Monnier, 2021/07/07
- [elpa] externals/aggressive-indent 9dfde9c 14/43: Don't enable in modes that derive from text-mode, Stefan Monnier, 2021/07/07
- [elpa] externals/aggressive-indent 83bdea4 31/43: Allow other after-change-functions to run, Stefan Monnier, 2021/07/07