commit e23e1e43f1642f9bbd216849f42bd45b1f0e9434
parent 55b2e9ac9ec5aa24eb2f7cc5cf2ce1d85dbc7ac3
Author: Iqbal Ansari <iqbalansari02@yahoo.com>
Date: Mon, 16 Nov 2015 22:30:12 +0530
Move advices after minor mode definition
This avoids the byte compilation warning about undefined variables
Diffstat:
M | emojify.el | | | 58 | +++++++++++++++++++++++++++++----------------------------- |
1 file changed, 29 insertions(+), 29 deletions(-)
diff --git a/emojify.el b/emojify.el
@@ -647,35 +647,6 @@ of `after-change-functions' to understand the meaning of BEG, END and LEN."
-(defadvice text-scale-increase (after emojify-resize-emojis (&rest ignored))
- "Advice `text-scale-increase' to trigger resizing of emojis on resize."
- (when emojify-mode
- (emojify-redisplay-emojis)))
-
-(ad-activate #'text-scale-increase)
-
-(defadvice isearch-repeat (around emojify-redisplay-after-isearch-left (direction))
- "Advice `isearch-repeat' to run emojify's point motion hooks.
-
-By default isearch disables point-motion hooks while repeating (see
-`isearch-invisible') breaking emojify's uncovering logic, this advice explicitly
-runs (only emojify's) point motion hooks."
- (let ((old-pos (point)))
- (prog1 ad-do-it
- (when emojify-mode
- (let ((old-pos-props (text-properties-at old-pos))
- (new-pos-props (text-properties-at (point))))
- (unless (equal old-pos (point))
- (when (and (plist-get old-pos-props 'emojified)
- (plist-get old-pos-props 'point-left))
- (funcall (plist-get old-pos-props 'point-left) old-pos (point)))
- (when (and (plist-get new-pos-props 'emojified)
- (plist-get new-pos-props 'point-entered))
- (funcall (plist-get new-pos-props 'point-entered) old-pos (point)))))))))
-
-
-(ad-activate #'isearch-repeat)
-
(defun emojify-turn-on-emojify-mode ()
"Turn on `emojify-mode' in current buffer."
@@ -724,5 +695,34 @@ runs (only emojify's) point motion hooks."
emojify-mode emojify-mode
:init-value nil)
+(defadvice text-scale-increase (after emojify-resize-emojis (&rest ignored))
+ "Advice `text-scale-increase' to trigger resizing of emojis on resize."
+ (when emojify-mode
+ (emojify-redisplay-emojis)))
+
+(ad-activate #'text-scale-increase)
+
+(defadvice isearch-repeat (around emojify-redisplay-after-isearch-left (direction))
+ "Advice `isearch-repeat' to run emojify's point motion hooks.
+
+By default isearch disables point-motion hooks while repeating (see
+`isearch-invisible') breaking emojify's uncovering logic, this advice explicitly
+runs (only emojify's) point motion hooks."
+ (let ((old-pos (point)))
+ (prog1 ad-do-it
+ (when emojify-mode
+ (let ((old-pos-props (text-properties-at old-pos))
+ (new-pos-props (text-properties-at (point))))
+ (unless (equal old-pos (point))
+ (when (and (plist-get old-pos-props 'emojified)
+ (plist-get old-pos-props 'point-left))
+ (funcall (plist-get old-pos-props 'point-left) old-pos (point)))
+ (when (and (plist-get new-pos-props 'emojified)
+ (plist-get new-pos-props 'point-entered))
+ (funcall (plist-get new-pos-props 'point-entered) old-pos (point)))))))))
+
+
+(ad-activate #'isearch-repeat)
+
(provide 'emojify)
;;; emojify.el ends here