emacs-emojify

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

commit 553303dda9e1b68b03cf612efceef7fc88fe6e0b
parent 6acb1b52f7bf6fc4252d6b69566d70280d71625b
Author: Iqbal Ansari <iqbal.ansari@ignitesol.com>
Date:   Wed, 18 Nov 2015 11:18:11 +0530

Add emojify-debug-mode, make sure we do not signal error during redisplays

Diffstat:
Memojify.el | 18++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/emojify.el b/emojify.el @@ -82,6 +82,17 @@ This provides a compatibility version for previous versions." ;; Utility functions +(defvar emojify-debug-mode nil + "Signal errors when emoji redisplay fails. + +By default emojify silences any errors during emoji redisplay. This is done +since emojis are redisplayed using jit-lock (the same mechanism used for +font-lock) as such any bugs in the code can cause other important things to +fail. + +Set `emojify-debug-mode' to non-nil to instruct emojify to not silence any +errors during operation.") + (defun emojify--get-relevant-region () "Try getting region in buffer that completely covers the current window." (let* ((window-size (- (window-end) (window-start))) @@ -628,8 +639,11 @@ Redisplay emojis in the visible region if BEG and END are not specified" (let* ((area (emojify--get-relevant-region)) (beg (or beg (car area))) (end (or end (cdr area)))) - (emojify-undisplay-emojis-in-region beg end) - (emojify-display-emojis-in-region beg end))) + (if emojify-debug-mode + (progn (emojify-undisplay-emojis-in-region beg end) + (emojify-display-emojis-in-region beg end)) + (ignore-errors (emojify-undisplay-emojis-in-region beg end) + (emojify-display-emojis-in-region beg end))))) (defun emojify-after-change-function (beg end _len) "Redisplay emojis in region after change.