]> code.delx.au - gnu-emacs-elpa/commitdiff
Merge commit '3557254c6873aeb0b5070248aa0faf2ff0d29d04'
authorArtur Malabarba <bruce.connor.am@gmail.com>
Wed, 5 Aug 2015 21:52:46 +0000 (22:52 +0100)
committerArtur Malabarba <bruce.connor.am@gmail.com>
Wed, 5 Aug 2015 21:52:46 +0000 (22:52 +0100)
1  2 
packages/aggressive-indent/aggressive-indent.el

index 989ab51fc4f0e3b5f5ff1cfac0dbf2fee35b5bee,636504d3aa72e053e5d5339035cf59af545747ec..d6d201dbaa5850abd2014fc0d3da6fec2cd9ad9b
@@@ -1,10 -1,10 +1,10 @@@
 -;;; aggressive-indent.el --- Minor mode to aggressively keep your code always indented
 +;;; aggressive-indent.el --- Minor mode to aggressively keep your code always indented  -*- lexical-binding:t -*-
  
 -;; Copyright (C) 2014 Free Software Foundation, Inc.
 +;; Copyright (C) 2014, 2015 Free Software Foundation, Inc
  
  ;; 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
@@@ -70,7 -70,7 +70,7 @@@
  ;;
  ;; This program is free software; you can redistribute it and/or
  ;; modify it under the terms of the GNU General Public License
 -;; as published by the Free Software Foundation; either version 2
 +;; as published by the Free Software Foundation; either version 3
  ;; of the License, or (at your option) any later version.
  ;;
  ;; This program is distributed in the hope that it will be useful,
@@@ -171,9 -171,18 +171,18 @@@ commands will NOT be followed by a re-i
    '((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))