emacs-emojify

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

commit 825c77af9bd870ae508f635cff996a1d78e36f40
parent 2845db3671d8089b23e8fb21a966a479bf099160
Author: Iqbal Ansari <iqbalansari02@yahoo.com>
Date:   Sat,  1 Apr 2017 00:25:41 +0530

Remove custom logic to find background color at point use builtin 'background-color-at-point'

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

diff --git a/emojify.el b/emojify.el @@ -914,26 +914,17 @@ directly defined on the face." (emojify-overlays-at beg t))))) (car (last overlay-backgrounds)))) -(defun emojify--face-background-at-point (beg) - "Get the background color for emoji at BEG." - (save-excursion - (goto-char beg) - (let ((point-face (face-at-point))) - (when point-face - (face-background point-face))))) - (defun emojify--get-image-background (beg end) "Get the color to be used as background for emoji between BEG and END. Ideally `emojify--overlay-background' should have been enough to handle selection, but for some reason it does not work well." - (or (emojify--region-background-face-maybe beg end) - ;; TODO: `emojify--face-background-at-point' might already be - ;; handling overlay faces as such `emojify--overlay-background' - ;; might be redundant, need to verify this though - (emojify--overlay-background beg) - (emojify--face-background-at-point beg) - (face-background 'default))) + ;; We do a separate check for region since `background-color-at-point' + ;; does not always detect background color inside regions properly + (or (emojify--region-background-face-maybe beg end) + (save-excursion + (goto-char beg) + (background-color-at-point)))) (defun emojify--get-image-display (data buffer beg end &optional target-buffer) "Get the display text property to display the emoji as an image.