[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 820db3c 035/108: Don't indent inside comments, but allow a
From: |
Artur Malabarba |
Subject: |
[elpa] master 820db3c 035/108: Don't indent inside comments, but allow as an option. |
Date: |
Wed, 25 Mar 2015 18:38:58 +0000 |
branch: master
commit 820db3cc196344f87e472897a4e867479029684b
Author: Wilfred Hughes <address@hidden>
Commit: Wilfred Hughes <address@hidden>
Don't indent inside comments, but allow as an option.
---
aggressive-indent.el | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/aggressive-indent.el b/aggressive-indent.el
index af6d2ac..2f28fd3 100644
--- a/aggressive-indent.el
+++ b/aggressive-indent.el
@@ -123,12 +123,18 @@ commands will NOT be followed by a re-indent."
:type '(repeat symbol)
:package-version '(aggressive-indent . "0.1"))
+(defcustom comments-too nil
+ "If non-nil, aggressively indent in comments as well."
+ :type 'boolean)
+
(defvar -internal-dont-indent-if
'((memq this-command aggressive-indent-protected-commands)
(region-active-p)
buffer-read-only
(null (buffer-modified-p))
- (string-match "\\`[[:blank:]]*\n?\\'" (thing-at-point 'line)))
+ (string-match "\\`[[:blank:]]*\n?\\'" (thing-at-point 'line))
+ (and (aggressive-indent--in-comment-p)
+ (not aggressive-indent-comments-too)))
"List of forms which prevent indentation when they evaluate to non-nil.
This is for internal use only. For user customization, use
`aggressive-indent-dont-indent-if' instead.")
@@ -303,6 +309,11 @@ Like `aggressive-indent-indent-region-and-on', but wrapped
in a
(push l changed-list-left)
(push r changed-list-right))
+(defun -in-comment-p ()
+ "Return non-nil if point is inside a comment.
+Assumes that the syntax table is sufficient to find comments."
+ (nth 4 (syntax-ppss)))
+
;;; Minor modes
:autoload
- [elpa] master 6a4296b 028/108: Add demo for non-Lisp mode, (continued)
- [elpa] master 6a4296b 028/108: Add demo for non-Lisp mode, Artur Malabarba, 2015/03/25
- [elpa] master 215ddf7 030/108: Don't use do-softly for now., Artur Malabarba, 2015/03/25
- [elpa] master 81fadf1 029/108: Add modes to prefer defun., Artur Malabarba, 2015/03/25
- [elpa] master e4d3601 026/108: Implement a smarter engine for non-lisp modes., Artur Malabarba, 2015/03/25
- [elpa] master e774765 031/108: Merge branch 'region-indent', Artur Malabarba, 2015/03/25
- [elpa] master 7762250 032/108: Don't indent on empty line., Artur Malabarba, 2015/03/25
- [elpa] master 6e1d5a1 027/108: Merge pull request #12 from Bruce-Connor/region-indent, Artur Malabarba, 2015/03/25
- [elpa] master c15c56d 033/108: Skip empty lines when indenting blocks, Artur Malabarba, 2015/03/25
- [elpa] master 82c5d78 034/108: Merge pull request #17 from pmachata/master, Artur Malabarba, 2015/03/25
- [elpa] master b4b8dc3 037/108: Merge branch 'master' of github.com:Bruce-Connor/aggressive-indent-mode, Artur Malabarba, 2015/03/25
- [elpa] master 820db3c 035/108: Don't indent inside comments, but allow as an option.,
Artur Malabarba <=
- [elpa] master 201ec03 025/108: Indent changed region instead of defun for modes which aren't emacs-lisp., Artur Malabarba, 2015/03/25
- [elpa] master c4957eb 041/108: Fix bug on buffers with no final newline., Artur Malabarba, 2015/03/25
- [elpa] master d3948b0 036/108: Don't execute syntax-ppss if the controlling variable is t., Artur Malabarba, 2015/03/25
- [elpa] master c35bc62 039/108: Skip indenting lines only barely touched by changed region., Artur Malabarba, 2015/03/25
- [elpa] master 130b938 040/108: Redundant group specification., Artur Malabarba, 2015/03/25
- [elpa] master 69b5adc 042/108: Merge pull request #20 from tuhdo/master, Artur Malabarba, 2015/03/25
- [elpa] master c81d5c2 044/108: Add erc-mode to excluded-modes, Artur Malabarba, 2015/03/25
- [elpa] master 278084b 047/108: Add more to excluded-modes, Artur Malabarba, 2015/03/25
- [elpa] master d0a4bae 048/108: Typo, Artur Malabarba, 2015/03/25
- [elpa] master 7d8d0d2 038/108: Version bump, Artur Malabarba, 2015/03/25