Skip to content

Commit 544c265

Browse files
committed
Move macro before its use
1 parent 6d4fab5 commit 544c265

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

swift-mode-beginning-of-defun.el

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,29 @@ In comments or strings, skip a sentence. Otherwise, skip a stateement."
826826
(t
827827
(swift-mode:backward-sentence-inside-code)))))
828828

829+
(defmacro swift-mode:with-temp-comment-buffer (&rest body)
830+
"Eval BODY inside a temporary buffer keeping sentence related variables."
831+
(declare (indent 0) (debug t))
832+
(let ((current-sentence-end (make-symbol "current-sentence-end"))
833+
(current-paragraph-start (make-symbol "current-paragraph-start"))
834+
(current-paragraph-separate (make-symbol "current-paragraph-separate"))
835+
(current-paragraph-ignore-fill-prefix
836+
(make-symbol "current-paragraph-ignore-fill-prefix"))
837+
(current-fill-prefix (make-symbol "current-fill-prefix")))
838+
`(let ((,current-sentence-end (sentence-end))
839+
(,current-paragraph-start paragraph-start)
840+
(,current-paragraph-separate paragraph-separate)
841+
(,current-paragraph-ignore-fill-prefix paragraph-ignore-fill-prefix)
842+
(,current-fill-prefix fill-prefix))
843+
(with-temp-buffer
844+
(setq-local sentence-end ,current-sentence-end)
845+
(setq-local paragraph-start ,current-paragraph-start)
846+
(setq-local paragraph-separate ,current-paragraph-separate)
847+
(setq-local paragraph-ignore-fill-prefix
848+
,current-paragraph-ignore-fill-prefix)
849+
(setq-local fill-prefix ,current-fill-prefix)
850+
,@body))))
851+
829852
(defun swift-mode:forward-sentence-inside-comment (is-single-line)
830853
"Skip forward a sentence in a comment.
831854
@@ -944,29 +967,6 @@ IS-SINGLE-LINE should be non-nil when called inside a single-line comment."
944967
(goto-char comment-block-beginning-position)
945968
(swift-mode:backward-sentence-inside-code t)))))
946969

947-
(defmacro swift-mode:with-temp-comment-buffer (&rest body)
948-
"Eval BODY inside a temporary buffer keeping sentence related variables."
949-
(declare (indent 0) (debug t))
950-
(let ((current-sentence-end (make-symbol "current-sentence-end"))
951-
(current-paragraph-start (make-symbol "current-paragraph-start"))
952-
(current-paragraph-separate (make-symbol "current-paragraph-separate"))
953-
(current-paragraph-ignore-fill-prefix
954-
(make-symbol "current-paragraph-ignore-fill-prefix"))
955-
(current-fill-prefix (make-symbol "current-fill-prefix")))
956-
`(let ((,current-sentence-end (sentence-end))
957-
(,current-paragraph-start paragraph-start)
958-
(,current-paragraph-separate paragraph-separate)
959-
(,current-paragraph-ignore-fill-prefix paragraph-ignore-fill-prefix)
960-
(,current-fill-prefix fill-prefix))
961-
(with-temp-buffer
962-
(setq-local sentence-end ,current-sentence-end)
963-
(setq-local paragraph-start ,current-paragraph-start)
964-
(setq-local paragraph-separate ,current-paragraph-separate)
965-
(setq-local paragraph-ignore-fill-prefix
966-
,current-paragraph-ignore-fill-prefix)
967-
(setq-local fill-prefix ,current-fill-prefix)
968-
,@body))))
969-
970970
(defun swift-mode:comment-block-end-position-single-line ()
971971
"Return the position of the end of a single-line comment block.
972972

0 commit comments

Comments
 (0)