commit 5ba9d59ec44bf018f858c4326faf30b31c8fc320 parent 2cfc5a9353935a5f06a99b3aa040025d35c4839e Author: Iqbal Ansari <iqbal.ansari@ignitesol.com> Date: Fri, 2 Sep 2016 12:40:58 +0530 Improve test to check if emoji's closing brace is part of a list Do not consider the closing brace to be part of a list if the starting brace itself is part of an emoji Diffstat:
M | emojify.el | | | 4 | +++- |
M | test/emojify-test.el | | | 14 | ++++++++++++++ |
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/emojify.el b/emojify.el @@ -458,7 +458,9 @@ the visible area." (save-restriction (narrow-to-region beg end) (let ((list-start (ignore-errors (scan-sexps point -1)))) - (when list-start + (when (and list-start + ;; Ignore the starting brace if it is an emoji + (not (get-text-property list-start 'emojified))) ;; If we got a list start make sure both start and end ;; belong to same string/comment (let ((syntax-beg (syntax-ppss list-start)) diff --git a/test/emojify-test.el b/test/emojify-test.el @@ -306,6 +306,20 @@ (emojify-tests-with-emojified-static-buffer ";; 8)" (emojify-tests-should-be-emojified (+ 3 (point-min)))) + (emojify-tests-with-emojified-static-buffer ":( +:)" + (fundamental-mode) + (emojify-redisplay-emojis-in-region) + (emojify-tests-should-be-emojified (point-min)) + (emojify-tests-should-be-emojified (line-beginning-position 2))) + + (emojify-tests-with-emojified-static-buffer "( +:)" + (fundamental-mode) + (emojify-redisplay-emojis-in-region) + (emojify-tests-should-not-be-emojified (point-min)) + (emojify-tests-should-not-be-emojified (line-beginning-position 2))) + (emojify-tests-with-emojified-static-buffer ";; (lambda () 8)" (emacs-lisp-mode) (emojify-redisplay-emojis-in-region)