diff options
author | sh-ow <sh-ow@users.noreply.github.com> | 2016-04-14 00:14:47 +0200 |
---|---|---|
committer | sh-ow <sh-ow@users.noreply.github.com> | 2016-04-14 00:14:47 +0200 |
commit | 9b30fe4123b1b2b14f4234a5c4bf2ef5301904e0 (patch) | |
tree | 4e99303ea56d77087c5a5e94beb1924936fb4c44 | |
parent | f60ba1e8066444a513eb95187cdd75a28745c940 (diff) |
don't use reverse function on string
-rw-r--r-- | prog-mode/.yas-setup.el | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/prog-mode/.yas-setup.el b/prog-mode/.yas-setup.el index b5c78e3..d70faf0 100644 --- a/prog-mode/.yas-setup.el +++ b/prog-mode/.yas-setup.el @@ -1,16 +1,21 @@ (defun yas-with-comment (str) (format "%s%s%s" comment-start str comment-end)) +(defun yas-string-reverse (str) + (apply #'string + (reverse + (string-to-list str)))) + (defun yas-get-comment-start () (substring comment-start 0 (dotimes (i (length comment-start)) - (unless (or (eq (aref (reverse comment-start) i) nil) - (eq (aref (reverse comment-start) i) 32)) + (unless (or (eq (aref (yas-string-reverse comment-start) i) nil) + (eq (aref (yas-string-reverse comment-start) i) 32)) (return (- (length comment-start) i)))))) (defun yas-get-comment-end () (if (eq (length comment-end) 0) - (reverse (yas-get-comment-start)) + (yas-string-reverse (yas-get-comment-start)) (substring comment-end (dotimes (i (length comment-end)) (unless (or (eq (aref comment-end i) nil) |