]> code.delx.au - gnu-emacs-elpa/blobdiff - aggressive-indent.el
Don't narrow-to-defun when checking parens
[gnu-emacs-elpa] / aggressive-indent.el
index 31cee7253e4d622aa76d3aacbd6e7f4eac9515b7..7055f9cee77548b562010c09a3a86f61070b1ed9 100644 (file)
@@ -349,9 +349,12 @@ or messages."
   "List of (left right) limit of regions changed in the last command loop.")
 (make-variable-buffer-local 'aggressive-indent--changed-list)
 
+(defvar-local aggressive-indent--balanced-parens t
+  "Non-nil if the current-buffer has balanced parens.")
+
 (defun aggressive-indent--indent-if-changed ()
   "Indent any region that changed in the last command loop."
-  (when aggressive-indent--changed-list
+  (when (and aggressive-indent--changed-list aggressive-indent--balanced-parens)
     (save-excursion
       (save-selected-window
         (unless (or (run-hook-wrapped 'aggressive-indent--internal-dont-indent-if #'eval)
@@ -368,9 +371,6 @@ or messages."
                 (setq aggressive-indent--changed-list
                       (cdr aggressive-indent--changed-list))))))))))
 
-(defvar-local aggressive-indent--balanced-parens t
-  "Non-nil if the current-buffer has balanced parens.")
-
 (defun aggressive-indent--check-parens ()
   "Check if parens are balanced in the current buffer.
 Store result in `aggressive-indent--balanced-parens'."
@@ -378,7 +378,6 @@ Store result in `aggressive-indent--balanced-parens'."
         (save-excursion
           (ignore-errors
             (save-restriction
-              (narrow-to-defun)
               (check-parens)
               t)))))