commit c74deb3a4755758f070592a1c5df08cce76658e5 parent ebff49dc8379003772d6c465c80ec68a64f68725 Author: Iqbal Ansari <iqbalansari02@yahoo.com> Date: Wed, 28 Oct 2015 08:25:50 +0530 Make sure text is the original buffer when in point-entered, point-left hooks :sweat: Diffstat:
M | emojify.el | | | 11 | +++++++---- |
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/emojify.el b/emojify.el @@ -193,7 +193,8 @@ BEG and END are the beginning and end of the region respectively" (while (search-forward-regexp emoji-regexps end t) (let ((match-beginning (match-beginning 0)) (match-end (match-end 0)) - (match (match-string-no-properties 0))) + (match (match-string-no-properties 0)) + (buffer (current-buffer))) ;; Display unconditionally in non-prog mode (when (and (or (not (derived-mode-p 'prog-mode)) @@ -212,10 +213,12 @@ BEG and END are the beginning and end of the region respectively" (`image (emojify-get-image match))) 'emojified t 'point-entered (lambda (x y) - (emojify-undisplay-emojis-in-region match-beginning match-end t)) + (when (equal buffer (current-buffer)) + (emojify-undisplay-emojis-in-region match-beginning match-end t))) 'point-left (lambda (x y) - (when (or (< match-end y) - (< y match-beginning)) + (when (and (equal buffer (current-buffer)) + (or (< match-end y) + (< y match-beginning))) (emojify-display-emojis-in-region match-beginning match-end))))))))))) (defun emojify-undisplay-emojis-in-region (beg end &optional point-entered-p)