From 66af19c7df5b1ef2d3252593b4eb33a101dc1582 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 12 Feb 2015 21:48:40 -0200 Subject: fix images --- sx-question-print.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sx-question-print.el') diff --git a/sx-question-print.el b/sx-question-print.el index 7244a6a..160074d 100644 --- a/sx-question-print.el +++ b/sx-question-print.el @@ -427,7 +427,7 @@ Image links are downloaded and displayed, if url)) url) (when image-p - (sx-question-mode--create-image url (1- (point))))))))))) + (sx-question-mode--create-image url (- (point) 2)))))))))) (defun sx-question-mode--create-image (url point) "Get and create an image from URL and insert it at POINT. @@ -445,7 +445,8 @@ Its size is bound by `sx-question-mode-image-max-width' and (list :width (min sx-question-mode-image-max-width (window-body-width nil 'pixel) image-width)))))))) - (sx-request-get-url url callback))) + (sx-request-get-url url callback) + (overlay-put ov 'face 'default))) (defun sx-question-mode--insert-link (text url) "Return a link propertized version of TEXT-OR-IMAGE. @@ -459,7 +460,7 @@ URL is used as 'help-echo and 'url properties." (forward-char 1) (delete-char 1))) ;; Images need to be at the start of a line. - (when (and imagep (not (looking-at-p "^"))) + (unless (or text (looking-at-p "^")) (insert "\n")) (insert-text-button (or text " ") ;; Mouse-over @@ -472,7 +473,7 @@ URL is used as 'help-echo and 'url properties." 'sx-button-copy url :type 'sx-button-link) ;; Images need to be at the end of a line too. - (insert "\n")) + (unless text (insert "\n"))) (defun sx-question-mode-find-reference (id &optional fallback-id) "Find url identified by reference ID in current buffer. -- cgit v1.2.3