emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master fae66eb 096/108: Optimize syntax-ppss calls


From: Artur Malabarba
Subject: [elpa] master fae66eb 096/108: Optimize syntax-ppss calls
Date: Wed, 25 Mar 2015 18:39:23 +0000

branch: master
commit fae66ebe04f3501009010f0c4ba4bca3feb8b80a
Author: Artur Malabarba <address@hidden>
Commit: Artur Malabarba <address@hidden>

    Optimize syntax-ppss calls
---
 aggressive-indent.el |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/aggressive-indent.el b/aggressive-indent.el
index 72544c8..21353a4 100644
--- a/aggressive-indent.el
+++ b/aggressive-indent.el
@@ -188,9 +188,11 @@ commands will NOT be followed by a re-indent."
     (null (buffer-modified-p))
     (and (boundp 'smerge-mode) smerge-mode)
     (string-match "\\`[[:blank:]]*\n?\\'" (or (thing-at-point 'line) ""))
-    (and (not aggressive-indent-comments-too)
-         (aggressive-indent--in-comment-p))
-    (aggressive-indent--in-string-p))
+    (let ((sp (syntax-ppss)))
+      ;; Comments.
+      (or (and (not aggresive-indent-comments-too) (elt sp 4))
+          ;; Strings.
+          (elt sp 3))))
   "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.")
@@ -346,17 +348,6 @@ 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)))
-
-(defun -in-string-p ()
-  "Return non-nil if point is inside a string.
-Assumes that the syntax table is sufficient for recognizing
-strings."
-  (nth 3 (syntax-ppss)))
-
 
 ;;; Minor modes
 :autoload



reply via email to

[Prev in Thread] Current Thread [Next in Thread]