branch: elpa/adoc-mode commit 0ea3de138a7b9b3e059aeb7ed1d56a3657532b11 Author: sensorflo <sensor...@gmail.com> Commit: sensorflo <sensor...@gmail.com>
refactored adoc-kwf-attriblist - moved let form deeper down - renamed end2 -> attribute-list-end - added comments --- adoc-mode.el | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/adoc-mode.el b/adoc-mode.el index 2de6492396..5d05c16011 100644 --- a/adoc-mode.el +++ b/adoc-mode.el @@ -1276,25 +1276,27 @@ text having adoc-reserved set to 'block-del." (and found (not prevented)))) (defun adoc-kwf-attriblist (end) - (let* ((end2 end) - pos-or-id) - (while (< (point) end) - (goto-char (or (text-property-not-all (point) end 'adoc-attribute-list nil) - end)) - (when (< (point) end) - (setq pos-or-id 0) - (setq end2 (or (text-property-any (point) end 'adoc-attribute-list nil) - end)) - (while (re-search-forward (adoc-re-attribute-list-elt) end2 t) - (when (match-beginning 1) - (setq pos-or-id (buffer-substring-no-properties (match-beginning 1) (match-end 1))) - (put-text-property (match-beginning 1) (match-end 1) 'face markup-attribute-face)) - (let ((group (if (match-beginning 2) 2 3)) - (face (adoc-attribute-elt-face pos-or-id (get-text-property (match-beginning 0) 'adoc-attribute-list)))) - (put-text-property (match-beginning group) (match-end group) 'face face)) - (when (numberp pos-or-id) (setq pos-or-id (1+ pos-or-id))))))) - - (goto-char end2)))) + ;; for each attribute list before END + (while (< (point) end) + (goto-char (or (text-property-not-all (point) end 'adoc-attribute-list nil) + end)) + (when (< (point) end) + (let ((attribute-list-end + (or (text-property-any (point) end 'adoc-attribute-list nil) + end)) + (pos-or-id 0)) + + ;; for each attribute in current attribute list + (while (re-search-forward (adoc-re-attribute-list-elt) attribute-list-end t) + (when (match-beginning 1) + (setq pos-or-id (buffer-substring-no-properties (match-beginning 1) (match-end 1))) + (put-text-property (match-beginning 1) (match-end 1) 'face markup-attribute-face)) + (let ((group (if (match-beginning 2) 2 3)) + (face (adoc-attribute-elt-face pos-or-id (get-text-property (match-beginning 0) 'adoc-attribute-list)))) + (put-text-property (match-beginning group) (match-end group) 'face face)) + (when (numberp pos-or-id) (setq pos-or-id (1+ pos-or-id)))) + + (goto-char attribute-list-end)))) nil) (defun adoc-facespec-subscript ()