]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/aggressive-indent/aggressive-indent.el
Merge commit '3557254c6873aeb0b5070248aa0faf2ff0d29d04'
[gnu-emacs-elpa] / packages / aggressive-indent / aggressive-indent.el
index 989ab51fc4f0e3b5f5ff1cfac0dbf2fee35b5bee..d6d201dbaa5850abd2014fc0d3da6fec2cd9ad9b 100644 (file)
@@ -4,7 +4,7 @@
 
 ;; Author: Artur Malabarba <emacs@endlessparentheses.com>
 ;; URL: http://github.com/Malabarba/aggressive-indent-mode
-;; Version: 1.1
+;; Version: 1.1.2
 ;; Package-Requires: ((emacs "24.1") (names "20150125.9") (cl-lib "0.5"))
 ;; Keywords: indent lisp maint tools
 ;; Prefix: aggressive-indent
@@ -171,9 +171,18 @@ commands will NOT be followed by a re-indent."
   '((memq this-command aggressive-indent-protected-commands)
     (region-active-p)
     buffer-read-only
+    undo-in-progress
     (null (buffer-modified-p))
     (and (boundp 'smerge-mode) smerge-mode)
-    (string-match "\\`[[:blank:]]*\n?\\'" (or (thing-at-point 'line) ""))
+    (let ((line (thing-at-point 'line)))
+      (when (stringp line)
+        (or (string-match "\\`[[:blank:]]*\n?\\'" line)
+            ;; If the user is starting to type a comment.
+            (and (stringp comment-start)
+                 (string-match (concat "\\`[[:blank:]]*"
+                                       (substring comment-start 0 1)
+                                       "[[:blank:]]*$")
+                               line)))))
     (let ((sp (syntax-ppss)))
       ;; Comments.
       (or (and (not aggressive-indent-comments-too) (elt sp 4))