emacs-emojify

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

commit 7319df22d2ab9665716529ee811dc1d3c8e768e9
parent d241198495f612375c32da0e4c8af36441a4ddd8
Author: Iqbal Ansari <iqbalansari02@yahoo.com>
Date:   Sat, 28 Nov 2015 23:23:23 +0530

Add `emojify-execute-ignoring-errors-unless-debug` to easily run form
conditionally ignoring errors

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

diff --git a/emojify.el b/emojify.el @@ -97,6 +97,14 @@ fail. Set `emojify-debug-mode' to non-nil to instruct emojify to not silence any errors during operation.") +(defmacro emojify-execute-ignoring-errors-unless-debug (&rest forms) + (declare (debug t) (indent 0)) + `(if emojify-debug-mode + (progn + ,@forms) + (ignore-errors + ,@forms))) + (defun emojify-message (format-string &rest args) "Log debugging messages to buffer named 'emojify-log'. @@ -731,11 +739,9 @@ 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)))) - (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))))) + (emojify-execute-ignoring-errors-unless-debug + (emojify-undisplay-emojis-in-region beg end) + (emojify-display-emojis-in-region beg end)))) (defun emojify-after-change-extend-region-function (beg end _len) "Extend the region to be emojified.