commit d9c12833c92c6d0f4d4d7c8b709f48c52bf8cddb parent 91fd9e4c0df40a0a7b32e3f86087b727c300070f Author: Iqbal Ansari <iqbalansari02@yahoo.com> Date: Mon, 2 Nov 2015 22:34:08 +0530 Use `defadvice` to advice `isearch-repeat` Also make it improve it Diffstat:
M | emojify.el | | | 18 | ++++++++++-------- |
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/emojify.el b/emojify.el @@ -577,14 +577,16 @@ of `after-change-functions' to understand the meaning of BEG, END and LEN." (ad-activate #'text-scale-increase) -;; TODO: Backport to defadvice -(defun emojify-redisplay-after-isearch-left (orig &rest args) - (let ((start (line-beginning-position)) - (end (line-end-position))) - (prog1 (apply orig args) - (emojify-redisplay-emojis start end)))) - -(advice-add 'isearch-repeat :around #'emojify-redisplay-after-isearch-left) +(defadvice isearch-repeat (around emojify-redisplay-after-isearch-left (&rest ignored)) + "Redisplay emojis after isearch." + (when emojify-mode + (let ((start (line-beginning-position)) + (end (line-end-position))) + (prog1 ad-do-it + (when (< (point) end) + (emojify-redisplay-emojis start end)))))) + +(ad-activate #'isearch-repeat) (defun emojify-turn-on-emojify-mode () "Turn on `emojify-mode' in current buffer."