emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/aggressive-indent e3c41af 11/43: New variable: aggressi


From: Stefan Monnier
Subject: [elpa] externals/aggressive-indent e3c41af 11/43: New variable: aggressive-indent-protected-current-commands
Date: Wed, 7 Jul 2021 22:49:40 -0400 (EDT)

branch: externals/aggressive-indent
commit e3c41af5ca8fb6eb0845e9e96ded0416bb449bc8
Author: Artur Malabarba <artur@biva.com.br>
Commit: Artur Malabarba <artur@biva.com.br>

    New variable: aggressive-indent-protected-current-commands
---
 aggressive-indent.el | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/aggressive-indent.el b/aggressive-indent.el
index 311f3d9..607d83a 100644
--- a/aggressive-indent.el
+++ b/aggressive-indent.el
@@ -132,6 +132,14 @@ commands will NOT be followed by a re-indent."
   :type '(repeat symbol)
   :package-version '(aggressive-indent . "0.1"))
 
+(defcustom aggressive-indent-protected-current-commands
+  '(query-replace-regexp query-replace)
+  "Like `aggressive-indent-protected-commands', but for the current command.
+For instance, with the default value, this variable prevents
+indentation during `query-replace' (but not after)."
+  :type '(repeat symbol)
+  :package-version '(aggressive-indent . "1.8.4"))
+
 (defcustom aggressive-indent-comments-too nil
   "If non-nil, aggressively indent in comments as well."
   :type 'boolean
@@ -155,6 +163,7 @@ change."
 ;;; Preventing indentation
 (defconst aggressive-indent--internal-dont-indent-if
   '((memq last-command aggressive-indent-protected-commands)
+    (memq this-command aggressive-indent-protected-current-commands)
     (region-active-p)
     buffer-read-only
     undo-in-progress
@@ -318,6 +327,15 @@ Return non-nil only if the line's indentation actually 
changed."
           (indent-region line-end (1- (point))))
         (skip-chars-forward "[:blank:]")))))
 
+(defun aggressive-indent--extend-end-to-whole-sexps (beg end)
+  "Return a point >= END, so that it covers whole sexps from BEG."
+  (save-excursion
+    (goto-char beg)
+    (while (and (< (point) end)
+                (not (eobp)))
+      (forward-sexp 1))
+    (point)))
+
 ;;;###autoload
 (defun aggressive-indent-indent-region-and-on (l r)
   "Indent region between L and R, and then some.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]