[elpa] master updated (e2fb73d -> 516a8c7)
malabarba pushed a change to branch master. from e2fb73d Merge commit '16be7a12d0dbbbd0e59fc2ccf9a7c7085eb9cf5a' new 64ae275 Fully reindent before saving new b23e962 Use syntax-ppss instead of check-parens new a5000eb Fix a bug in the take-10 logic new c0a1e24 Version 1.7 new 516a8c7 Merge commit 'c0a1e24ef39e2b0f388135c2ed8f8b419346337c' Summary of changes: packages/aggressive-indent/aggressive-indent.el | 37 +++ 1 file changed, 24 insertions(+), 13 deletions(-)
[elpa] master a5000eb 3/5: Fix a bug in the take-10 logic
branch: master commit a5000ebf787eaeab41a7ab1889a91be84e8c1c90 Author: Artur Malabarba Commit: Artur Malabarba Fix a bug in the take-10 logic --- aggressive-indent.el |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aggressive-indent.el b/aggressive-indent.el index 241d0de..5c2f7b8 100644 --- a/aggressive-indent.el +++ b/aggressive-indent.el @@ -349,8 +349,9 @@ or messages." "List of (left right) limit of regions changed in the last command loop.") (make-variable-buffer-local 'aggressive-indent--changed-list) -(defvar-local aggressive-indent--balanced-parens t +(defvar aggressive-indent--balanced-parens t "Non-nil if the current-buffer has balanced parens.") +(make-variable-buffer-local 'aggressive-indent--balanced-parens) (defun aggressive-indent--proccess-changed-list-and-indent () "Indent the regions in `aggressive-indent--changed-list'." @@ -360,7 +361,7 @@ or messages." (if (cl-member-if #'derived-mode-p aggressive-indent-modes-to-prefer-defun) #'aggressive-indent--softly-indent-defun #'aggressive-indent--softly-indent-region-and-on))) ;; Take the 10 most recent changes. -(let ((cell (last aggressive-indent--changed-list 10))) +(let ((cell (nthcdr 10 aggressive-indent--changed-list))) (when cell (setcdr cell nil))) ;; (message "--") (while aggressive-indent--changed-list
[elpa] master c0a1e24 4/5: Version 1.7
branch: master commit c0a1e24ef39e2b0f388135c2ed8f8b419346337c Author: Artur Malabarba Commit: Artur Malabarba Version 1.7 --- aggressive-indent.el |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aggressive-indent.el b/aggressive-indent.el index 5c2f7b8..9530bf2 100644 --- a/aggressive-indent.el +++ b/aggressive-indent.el @@ -4,7 +4,7 @@ ;; Author: Artur Malabarba ;; URL: https://github.com/Malabarba/aggressive-indent-mode -;; Version: 1.6 +;; Version: 1.7 ;; Package-Requires: ((emacs "24.1") (cl-lib "0.5")) ;; Keywords: indent lisp maint tools ;; Prefix: aggressive-indent
[elpa] master 64ae275 1/5: Fully reindent before saving
branch: master commit 64ae275d9bb200f199d2d5d9785001249e2def15 Author: Artur Malabarba Commit: Artur Malabarba Fully reindent before saving --- aggressive-indent.el | 29 - 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/aggressive-indent.el b/aggressive-indent.el index 685f2af..5ee9e35 100644 --- a/aggressive-indent.el +++ b/aggressive-indent.el @@ -352,6 +352,23 @@ or messages." (defvar-local aggressive-indent--balanced-parens t "Non-nil if the current-buffer has balanced parens.") +(defun aggressive-indent--proccess-changed-list-and-indent () + "Indent the regions in `aggressive-indent--changed-list'." + (let ((inhibit-modification-hooks t) +(inhibit-point-motion-hooks t) +(indent-function + (if (cl-member-if #'derived-mode-p aggressive-indent-modes-to-prefer-defun) + #'aggressive-indent--softly-indent-defun #'aggressive-indent--softly-indent-region-and-on))) +;; Take the 10 most recent changes. +(let ((cell (last aggressive-indent--changed-list 10))) + (when cell (setcdr cell nil))) +;; (message "--") +(while aggressive-indent--changed-list + ;; (message "%S" (car aggressive-indent--changed-list)) + (apply indent-function (car aggressive-indent--changed-list)) + (setq aggressive-indent--changed-list +(cdr aggressive-indent--changed-list) + (defun aggressive-indent--indent-if-changed () "Indent any region that changed in the last command loop." (when (and aggressive-indent--changed-list aggressive-indent--balanced-parens) @@ -361,15 +378,7 @@ or messages." (aggressive-indent--run-user-hooks)) (while-no-input (redisplay) -(let ((inhibit-modification-hooks t) - (inhibit-point-motion-hooks t) - (indent-function - (if (cl-member-if #'derived-mode-p aggressive-indent-modes-to-prefer-defun) - #'aggressive-indent--softly-indent-defun #'aggressive-indent--softly-indent-region-and-on))) - (while aggressive-indent--changed-list -(apply indent-function (car aggressive-indent--changed-list)) -(setq aggressive-indent--changed-list - (cdr aggressive-indent--changed-list)) +(aggressive-indent--proccess-changed-list-and-indent))) (defun aggressive-indent--check-parens () "Check if parens are balanced in the current buffer. @@ -413,9 +422,11 @@ Store result in `aggressive-indent--balanced-parens'." (aggressive-indent--local-electric t)) (aggressive-indent--check-parens) (add-hook 'after-change-functions #'aggressive-indent--keep-track-of-changes nil 'local) +(add-hook 'before-save-hook #'aggressive-indent--proccess-changed-list-and-indent nil 'local) (add-hook 'post-command-hook #'aggressive-indent--indent-if-changed nil 'local)) ;; Clean the hooks (remove-hook 'after-change-functions #'aggressive-indent--keep-track-of-changes 'local) +(remove-hook 'before-save-hook #'aggressive-indent--proccess-changed-list-and-indent 'local) (remove-hook 'post-command-hook #'aggressive-indent--indent-if-changed 'local) (remove-hook 'post-command-hook #'aggressive-indent--softly-indent-defun 'local)))
[elpa] master 516a8c7 5/5: Merge commit 'c0a1e24ef39e2b0f388135c2ed8f8b419346337c'
branch: master commit 516a8c79fdb5e833ce740eed6b1d5d7cca4a8992 Merge: e2fb73d c0a1e24 Author: Artur Malabarba Commit: Artur Malabarba Merge commit 'c0a1e24ef39e2b0f388135c2ed8f8b419346337c' --- packages/aggressive-indent/aggressive-indent.el | 37 +++ 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/packages/aggressive-indent/aggressive-indent.el b/packages/aggressive-indent/aggressive-indent.el index 22647d1..481e7ef 100644 --- a/packages/aggressive-indent/aggressive-indent.el +++ b/packages/aggressive-indent/aggressive-indent.el @@ -4,7 +4,7 @@ ;; Author: Artur Malabarba ;; URL: https://github.com/Malabarba/aggressive-indent-mode -;; Version: 1.6 +;; Version: 1.7 ;; Package-Requires: ((emacs "24.1") (cl-lib "0.5")) ;; Keywords: indent lisp maint tools ;; Prefix: aggressive-indent @@ -349,8 +349,26 @@ or messages." "List of (left right) limit of regions changed in the last command loop.") (make-variable-buffer-local 'aggressive-indent--changed-list) -(defvar-local aggressive-indent--balanced-parens t +(defvar aggressive-indent--balanced-parens t "Non-nil if the current-buffer has balanced parens.") +(make-variable-buffer-local 'aggressive-indent--balanced-parens) + +(defun aggressive-indent--proccess-changed-list-and-indent () + "Indent the regions in `aggressive-indent--changed-list'." + (let ((inhibit-modification-hooks t) +(inhibit-point-motion-hooks t) +(indent-function + (if (cl-member-if #'derived-mode-p aggressive-indent-modes-to-prefer-defun) + #'aggressive-indent--softly-indent-defun #'aggressive-indent--softly-indent-region-and-on))) +;; Take the 10 most recent changes. +(let ((cell (nthcdr 10 aggressive-indent--changed-list))) + (when cell (setcdr cell nil))) +;; (message "--") +(while aggressive-indent--changed-list + ;; (message "%S" (car aggressive-indent--changed-list)) + (apply indent-function (car aggressive-indent--changed-list)) + (setq aggressive-indent--changed-list +(cdr aggressive-indent--changed-list) (defun aggressive-indent--indent-if-changed () "Indent any region that changed in the last command loop." @@ -361,15 +379,7 @@ or messages." (aggressive-indent--run-user-hooks)) (while-no-input (redisplay) -(let ((inhibit-modification-hooks t) - (inhibit-point-motion-hooks t) - (indent-function - (if (cl-member-if #'derived-mode-p aggressive-indent-modes-to-prefer-defun) - #'aggressive-indent--softly-indent-defun #'aggressive-indent--softly-indent-region-and-on))) - (while aggressive-indent--changed-list -(apply indent-function (car aggressive-indent--changed-list)) -(setq aggressive-indent--changed-list - (cdr aggressive-indent--changed-list)) +(aggressive-indent--proccess-changed-list-and-indent))) (defun aggressive-indent--check-parens () "Check if parens are balanced in the current buffer. @@ -377,8 +387,7 @@ Store result in `aggressive-indent--balanced-parens'." (setq aggressive-indent--balanced-parens (save-excursion (ignore-errors -(check-parens) -t +(zerop (car (syntax-ppss (point-max (defun aggressive-indent--keep-track-of-changes (l r &rest _) "Store the limits (L and R) of each change in the buffer." @@ -413,9 +422,11 @@ Store result in `aggressive-indent--balanced-parens'." (aggressive-indent--local-electric t)) (aggressive-indent--check-parens) (add-hook 'after-change-functions #'aggressive-indent--keep-track-of-changes nil 'local) +(add-hook 'before-save-hook #'aggressive-indent--proccess-changed-list-and-indent nil 'local) (add-hook 'post-command-hook #'aggressive-indent--indent-if-changed nil 'local)) ;; Clean the hooks (remove-hook 'after-change-functions #'aggressive-indent--keep-track-of-changes 'local) +(remove-hook 'before-save-hook #'aggressive-indent--proccess-changed-list-and-indent 'local) (remove-hook 'post-command-hook #'aggressive-indent--indent-if-changed 'local) (remove-hook 'post-command-hook #'aggressive-indent--softly-indent-defun 'local)))
[elpa] master b23e962 2/5: Use syntax-ppss instead of check-parens
branch: master commit b23e9627000be732b745dc300486aecba3f23595 Author: Artur Malabarba Commit: Artur Malabarba Use syntax-ppss instead of check-parens --- aggressive-indent.el |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aggressive-indent.el b/aggressive-indent.el index 5ee9e35..241d0de 100644 --- a/aggressive-indent.el +++ b/aggressive-indent.el @@ -386,8 +386,7 @@ Store result in `aggressive-indent--balanced-parens'." (setq aggressive-indent--balanced-parens (save-excursion (ignore-errors -(check-parens) -t +(zerop (car (syntax-ppss (point-max (defun aggressive-indent--keep-track-of-changes (l r &rest _) "Store the limits (L and R) of each change in the buffer."