branch: elpa/swift-mode commit 544c265faf79c5d448734bfe2f46fc7828e4de2b Author: taku0 <mxxouy6x3m_git...@tatapa.org> Commit: taku0 <mxxouy6x3m_git...@tatapa.org>
Move macro before its use --- swift-mode-beginning-of-defun.el | 46 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/swift-mode-beginning-of-defun.el b/swift-mode-beginning-of-defun.el index a76f746..6be6bf6 100644 --- a/swift-mode-beginning-of-defun.el +++ b/swift-mode-beginning-of-defun.el @@ -826,6 +826,29 @@ In comments or strings, skip a sentence. Otherwise, skip a stateement." (t (swift-mode:backward-sentence-inside-code))))) +(defmacro swift-mode:with-temp-comment-buffer (&rest body) + "Eval BODY inside a temporary buffer keeping sentence related variables." + (declare (indent 0) (debug t)) + (let ((current-sentence-end (make-symbol "current-sentence-end")) + (current-paragraph-start (make-symbol "current-paragraph-start")) + (current-paragraph-separate (make-symbol "current-paragraph-separate")) + (current-paragraph-ignore-fill-prefix + (make-symbol "current-paragraph-ignore-fill-prefix")) + (current-fill-prefix (make-symbol "current-fill-prefix"))) + `(let ((,current-sentence-end (sentence-end)) + (,current-paragraph-start paragraph-start) + (,current-paragraph-separate paragraph-separate) + (,current-paragraph-ignore-fill-prefix paragraph-ignore-fill-prefix) + (,current-fill-prefix fill-prefix)) + (with-temp-buffer + (setq-local sentence-end ,current-sentence-end) + (setq-local paragraph-start ,current-paragraph-start) + (setq-local paragraph-separate ,current-paragraph-separate) + (setq-local paragraph-ignore-fill-prefix + ,current-paragraph-ignore-fill-prefix) + (setq-local fill-prefix ,current-fill-prefix) + ,@body)))) + (defun swift-mode:forward-sentence-inside-comment (is-single-line) "Skip forward a sentence in a comment. @@ -944,29 +967,6 @@ IS-SINGLE-LINE should be non-nil when called inside a single-line comment." (goto-char comment-block-beginning-position) (swift-mode:backward-sentence-inside-code t))))) -(defmacro swift-mode:with-temp-comment-buffer (&rest body) - "Eval BODY inside a temporary buffer keeping sentence related variables." - (declare (indent 0) (debug t)) - (let ((current-sentence-end (make-symbol "current-sentence-end")) - (current-paragraph-start (make-symbol "current-paragraph-start")) - (current-paragraph-separate (make-symbol "current-paragraph-separate")) - (current-paragraph-ignore-fill-prefix - (make-symbol "current-paragraph-ignore-fill-prefix")) - (current-fill-prefix (make-symbol "current-fill-prefix"))) - `(let ((,current-sentence-end (sentence-end)) - (,current-paragraph-start paragraph-start) - (,current-paragraph-separate paragraph-separate) - (,current-paragraph-ignore-fill-prefix paragraph-ignore-fill-prefix) - (,current-fill-prefix fill-prefix)) - (with-temp-buffer - (setq-local sentence-end ,current-sentence-end) - (setq-local paragraph-start ,current-paragraph-start) - (setq-local paragraph-separate ,current-paragraph-separate) - (setq-local paragraph-ignore-fill-prefix - ,current-paragraph-ignore-fill-prefix) - (setq-local fill-prefix ,current-fill-prefix) - ,@body)))) - (defun swift-mode:comment-block-end-position-single-line () "Return the position of the end of a single-line comment block.