emacs-emojify

fork of https://github.com/iqbalansari/emacs-emojify
Log | Files | Refs | LICENSE

commit c3ac5d4bb1b0a157b5f3598131c6deea6b372c30
parent 155411f7c2cf30ec9b6197b046dbe183be0db54a
Author: Iqbal Ansari <iqbalansari02@yahoo.com>
Date:   Sun, 15 Nov 2015 15:55:26 +0530

Restrict scanning area to the visible area while checking whether for
list

This is not always accurate but is faster than earlier scan for obvious
reasons

Diffstat:
Memojify.el | 25+++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/emojify.el b/emojify.el @@ -314,16 +314,21 @@ since our mechanisms do not work in it." (eq (org-element-type (org-element-at-point)) 'src-block)))) (defun emojify-looking-at-end-of-list-maybe (point) - "Determine if POINT is end of a list." - (let ((list-start (ignore-errors (scan-sexps point -1)))) - (when list-start - ;; If we got a list start make sure both start and end - ;; belong to same string/comment - (let ((syntax-beg (syntax-ppss list-start)) - (syntax-end (syntax-ppss point))) - (and list-start - (eq (nth 8 syntax-beg) - (nth 8 syntax-end))))))) + "Determine if POINT is end of a list. + +This is not accurate since it restricts the region to scan to +the visible area." + (save-restriction + (narrow-to-region (window-start) (window-end)) + (let ((list-start (ignore-errors (scan-sexps point -1)))) + (when list-start + ;; If we got a list start make sure both start and end + ;; belong to same string/comment + (let ((syntax-beg (syntax-ppss list-start)) + (syntax-end (syntax-ppss point))) + (and list-start + (eq (nth 8 syntax-beg) + (nth 8 syntax-end)))))))) (defun emojify-valid-text-context-p (beg end) "Determine if the okay to display for text between BEG and END."