From 87b7a8da052601c51bc0577484916856364401cb Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 26 Sep 2019 15:29:09 -0400 Subject: [PATCH] lang/org: fix broken inline-image previews For uses with imagemagick installed. Caused by https://code.orgmode.org/bzg/org-mode/commit/48da60f4 --- modules/lang/org/config.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 6a4f312eb..07fdfe08e 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -473,7 +473,20 @@ current workspace." "Prevent temporarily opened agenda buffers from polluting recentf." :around #'org-get-agenda-file-buffer (let ((recentf-exclude (list (lambda (_file) t)))) - (funcall orig-fn file)))) + (funcall orig-fn file))) + + ;; HACK With https://code.orgmode.org/bzg/org-mode/commit/48da60f4, inline + ;; image previews broke for users with imagemagick support built in. This + ;; reverses the problem, but should be removed once it is addressed upstream + ;; (if ever). + (defadvice! +org--fix-inline-images-for-imagemagick-users-a (orig-fn &rest args) + :around #'org-display-inline-images + (cl-letf* ((old-create-image (symbol-function #'create-image)) + ((symbol-function #'create-image) + (lambda (file-or-data &optional type data-p &rest props) + (let ((type (if (plist-get props :width) type))) + (apply old-create-image file-or-data type data-p props))))) + (apply orig-fn args)))) (defun +org-init-keybinds-h ()