summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2016-10-19 21:02:30 -0700
committerSean Whitton <spwhitton@spwhitton.name>2016-10-19 21:02:30 -0700
commite7985a7cb450c4c74cd01dcde5039d68137c832c (patch)
tree9b8af257f89401a2c2bd382a171585fd81a932cc
parenta58c01b2ef770ddd85ad4533c29f9309eb6cade6 (diff)
parent998407f56009f441a7cb83d678118d4d8e68f661 (diff)
Merge tag '1.8.3'
-rw-r--r--aggressive-indent.el23
1 files changed, 20 insertions, 3 deletions
diff --git a/aggressive-indent.el b/aggressive-indent.el
index e6dba72..a354dab 100644
--- a/aggressive-indent.el
+++ b/aggressive-indent.el
@@ -4,7 +4,7 @@
;; Author: Artur Malabarba <emacs@endlessparentheses.com>
;; URL: https://github.com/Malabarba/aggressive-indent-mode
-;; Version: 1.8.1
+;; Version: 1.8.3
;; Package-Requires: ((emacs "24.1") (cl-lib "0.5"))
;; Keywords: indent lisp maint tools
;; Prefix: aggressive-indent
@@ -105,7 +105,7 @@ Please include this in your report!"
(defvar aggressive-indent-mode)
;;; Configuring indentarion
-(defcustom aggressive-indent-dont-electric-modes '(ruby-mode)
+(defcustom aggressive-indent-dont-electric-modes nil
"List of major-modes where `electric-indent' should be disabled."
:type '(choice
(const :tag "Never use `electric-indent-mode'." t)
@@ -124,6 +124,9 @@ Please include this in your report!"
doc-view-mode
dos-mode
erc-mode
+ feature-mode
+ fortran-mode
+ f90-mode
jabber-chat-mode
haml-mode
haskell-mode
@@ -136,6 +139,7 @@ Please include this in your report!"
netcmd-mode
python-mode
sass-mode
+ scala-mode
slim-mode
special-mode
shell-mode
@@ -183,7 +187,7 @@ change."
:package-version '(aggressive-indent . "0.3"))
;;; Preventing indentation
-(defvar aggressive-indent--internal-dont-indent-if
+(defconst aggressive-indent--internal-dont-indent-if
'((memq this-command aggressive-indent-protected-commands)
(region-active-p)
buffer-read-only
@@ -239,6 +243,12 @@ This is for internal use only. For user customization, use
'(and (derived-mode-p 'coq-mode)
(not (string-match "\\.[[:space:]]*$"
(thing-at-point 'line))))))
+(eval-after-load 'ruby-mode
+ '(add-to-list 'aggressive-indent--internal-dont-indent-if
+ '(when (derived-mode-p 'ruby-mode)
+ (let ((line (thing-at-point 'line)))
+ (and (stringp line)
+ (string-match "\\b\\(if\\|case\\|do\\|begin\\) *$" line))))))
(defcustom aggressive-indent-dont-indent-if '()
"List of variables and functions to prevent aggressive indenting.
@@ -367,6 +377,12 @@ or messages."
(setq aggressive-indent--changed-list
(cdr aggressive-indent--changed-list)))))
+(defcustom aggressive-indent-sit-for-time 0.05
+ "Time, in seconds, to wait before indenting.
+If you feel aggressive-indent is causing Emacs to hang while
+typing, try tweaking this number."
+ :type 'float)
+
(defun aggressive-indent--indent-if-changed ()
"Indent any region that changed in the last command loop."
(when aggressive-indent--changed-list
@@ -375,6 +391,7 @@ or messages."
(unless (or (run-hook-wrapped 'aggressive-indent--internal-dont-indent-if #'eval)
(aggressive-indent--run-user-hooks))
(while-no-input
+ (sit-for aggressive-indent-sit-for-time t)
(redisplay)
(aggressive-indent--proccess-changed-list-and-indent)))))))