iqbalansari/emacs-emojify

emojify fails in eshell buffer

Closed this issue · 5 comments

I was running a node thing inside an eshell buffer and when some emojis showed up I got this error:

background-color-at-point: Wrong type argument: listp, (foreground-color . "#8FA1B3")
Error in post-command-hook (emojify-update-visible-emojis-background-after-command): (wrong-type-argument listp (foreground-color . "#8FA1B3"))
set-transient-map PCH: (wrong-type-argument listp (foreground-color . "#8FA1B3")) [3 times]

Here is the backtrace:

Debugger entered--Lisp error: (wrong-type-argument listp (foreground-color . "#8FA1B3"))
  faces--attribute-at-point(:background background-color)
  background-color-at-point()
  (save-excursion (goto-char beg) (background-color-at-point))
  (or (emojify--region-background-maybe beg end) (save-excursion (goto-char beg) (background-color-at-point)))
  emojify--get-image-background(3758327 3758328)
  (plist-put (cdr (get-text-property emoji-start 'display)) :background (emojify--get-image-background emoji-start emoji-end))
  (let ((emoji-end (+ emoji-start (length (get-text-property emoji-start 'emojify-text))))) (plist-put (cdr (get-text-property emoji-start 'display)) :background (emojify--get-image-background emoji-start emoji-end)) (setq --emojify-loop-current-pos emoji-end))
  (while (and (> --emojify-loop-end --emojify-loop-current-pos) (setq emoji-start (text-property-any --emojify-loop-current-pos --emojify-loop-end 'emojified t))) (let ((emoji-end (+ emoji-start (length (get-text-property emoji-start 'emojify-text))))) (plist-put (cdr (get-text-property emoji-start 'display)) :background (emojify--get-image-background emoji-start emoji-end)) (setq --emojify-loop-current-pos emoji-end)))
  (let ((--emojify-loop-current-pos beg) (--emojify-loop-end end) emoji-start) (while (and (> --emojify-loop-end --emojify-loop-current-pos) (setq emoji-start (text-property-any --emojify-loop-current-pos --emojify-loop-end 'emojified t))) (let ((emoji-end (+ emoji-start (length (get-text-property emoji-start 'emojify-text))))) (plist-put (cdr (get-text-property emoji-start 'display)) :background (emojify--get-image-background emoji-start emoji-end)) (setq --emojify-loop-current-pos emoji-end))))
  (save-restriction (widen) (let ((--emojify-loop-current-pos beg) (--emojify-loop-end end) emoji-start) (while (and (> --emojify-loop-end --emojify-loop-current-pos) (setq emoji-start (text-property-any --emojify-loop-current-pos --emojify-loop-end 'emojified t))) (let ((emoji-end (+ emoji-start (length (get-text-property emoji-start 'emojify-text))))) (plist-put (cdr (get-text-property emoji-start 'display)) :background (emojify--get-image-background emoji-start emoji-end)) (setq --emojify-loop-current-pos emoji-end)))))
  (save-excursion (save-restriction (widen) (let ((--emojify-loop-current-pos beg) (--emojify-loop-end end) emoji-start) (while (and (> --emojify-loop-end --emojify-loop-current-pos) (setq emoji-start (text-property-any --emojify-loop-current-pos --emojify-loop-end 'emojified t))) (let ((emoji-end (+ emoji-start (length (get-text-property emoji-start 'emojify-text))))) (plist-put (cdr (get-text-property emoji-start ...)) :background (emojify--get-image-background emoji-start emoji-end)) (setq --emojify-loop-current-pos emoji-end))))))
  (progn (save-excursion (save-restriction (widen) (let ((--emojify-loop-current-pos beg) (--emojify-loop-end end) emoji-start) (while (and (> --emojify-loop-end --emojify-loop-current-pos) (setq emoji-start (text-property-any --emojify-loop-current-pos --emojify-loop-end 'emojified t))) (let ((emoji-end (+ emoji-start (length (get-text-property emoji-start 'emojify-text))))) (plist-put (cdr ...) :background (emojify--get-image-background emoji-start emoji-end)) (setq --emojify-loop-current-pos emoji-end)))))))
  (unwind-protect (progn (save-excursion (save-restriction (widen) (let ((--emojify-loop-current-pos beg) (--emojify-loop-end end) emoji-start) (while (and (> --emojify-loop-end --emojify-loop-current-pos) (setq emoji-start (text-property-any --emojify-loop-current-pos --emojify-loop-end 'emojified t))) (let ((emoji-end (+ emoji-start (length (get-text-property emoji-start 'emojify-text))))) (plist-put ... :background ...) (setq --emojify-loop-current-pos emoji-end))))))) (set-match-data save-match-data-internal 'evaporate))
  (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-excursion (save-restriction (widen) (let ((--emojify-loop-current-pos beg) (--emojify-loop-end end) emoji-start) (while (and (> --emojify-loop-end --emojify-loop-current-pos) (setq emoji-start (text-property-any --emojify-loop-current-pos --emojify-loop-end 'emojified t))) (let ((emoji-end (+ emoji-start (length (get-text-property emoji-start 'emojify-text))))) (plist-put (cdr (get-text-property emoji-start 'display)) :background (emojify--get-image-background emoji-start emoji-end)) (setq --emojify-loop-current-pos emoji-end))))))) (set-match-data save-match-data-internal 'evaporate)))
  (progn (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-excursion (save-restriction (widen) (let ((--emojify-loop-current-pos beg) (--emojify-loop-end end) emoji-start) (while ... ...))))) (set-match-data save-match-data-internal 'evaporate))))
  (unwind-protect (progn (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-excursion (save-restriction (widen) (let ((--emojify-loop-current-pos beg) (--emojify-loop-end end) emoji-start) ...)))) (set-match-data save-match-data-internal 'evaporate)))) (if modified nil (restore-buffer-modified-p nil)))
  (let* ((modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) (inhibit-modification-hooks t)) (unwind-protect (progn (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-excursion (save-restriction ... ...))) (set-match-data save-match-data-internal 'evaporate)))) (if modified nil (restore-buffer-modified-p nil))))
  (let ((inhibit-point-motion-hooks t) (emojify-current-point (point)) (emojify-region-beg (if (region-active-p) (progn (region-beginning)))) (emojify-region-end (if (region-active-p) (progn (region-end))))) (let* ((modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) (inhibit-modification-hooks t)) (unwind-protect (progn (let ((save-match-data-internal (match-data))) (unwind-protect (progn (save-excursion ...)) (set-match-data save-match-data-internal 'evaporate)))) (if modified nil (restore-buffer-modified-p nil)))))
  (progn (let ((inhibit-point-motion-hooks t) (emojify-current-point (point)) (emojify-region-beg (if (region-active-p) (progn (region-beginning)))) (emojify-region-end (if (region-active-p) (progn (region-end))))) (let* ((modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) (inhibit-modification-hooks t)) (unwind-protect (progn (let ((save-match-data-internal ...)) (unwind-protect (progn ...) (set-match-data save-match-data-internal ...)))) (if modified nil (restore-buffer-modified-p nil))))))
  (if (equal emojify-display-style 'image) (progn (let ((inhibit-point-motion-hooks t) (emojify-current-point (point)) (emojify-region-beg (if (region-active-p) (progn (region-beginning)))) (emojify-region-end (if (region-active-p) (progn (region-end))))) (let* ((modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) (inhibit-modification-hooks t)) (unwind-protect (progn (let (...) (unwind-protect ... ...))) (if modified nil (restore-buffer-modified-p nil)))))))
  emojify--update-emojis-background-in-region(3749309 3758556)
  (let* ((region-beginning point) (region-end (min (+ region-beginning (* (frame-height) (frame-width))) (point-max)))) (emojify--update-emojis-background-in-region region-beginning region-end))
  emojify--update-emojis-background-in-region-starting-at(3749309)
  emojify-update-visible-emojis-background-after-window-scroll(#<window 18 on Aweshell: ~/code/kue/fero/dev/> 3749309)
  redisplay_internal\ \(C\ function\)()
  redisplay()
  sit-for(0.15)
  golden-ratio-scroll-highlight(3749343 3749415 0.15)
  golden-ratio-scroll-screen-up()
  funcall-interactively(golden-ratio-scroll-screen-up)
  call-interactively(golden-ratio-scroll-screen-up nil nil)
  command-execute(golden-ratio-scroll-screen-up)

and this is what was shown in the buffer right after the error:

bildo

Hello @shackra, thanks for the bug report, what is the version of Emacs and emojify that you are using?

Emacs is compiled from the master branch, so it is 27.x, and the emojify version is commit 782ac30 (I use straight.el for managing my packages)

It seems Emacs' background-color-at-point do not handle cons as value of face overlay property (https://www.gnu.org/software/emacs/manual/html_node/elisp/Overlay-Properties.html). I have pushed a fix for this on master, could you please give it a try?

On my work laptop everything goes smoothly

bildo

I still need to check on my home PC (which is where the issue occurred)

Okay, it is fixed now!