From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Basil L. Contovounesios" Subject: Bug: org-string-display throws on image display property [9.1.9 (release_9.1.9-65-g5e4542 @ /home/blc/.local/share/emacs/27.0.50/lisp/org/)] Date: Sun, 02 Sep 2018 01:28:18 +0100 Message-ID: <874lf8hhel.fsf@tcd.ie> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fwGFj-0007Lh-Bd for emacs-orgmode@gnu.org; Sat, 01 Sep 2018 20:28:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fwGFi-0000ok-A6 for emacs-orgmode@gnu.org; Sat, 01 Sep 2018 20:28:31 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:44697) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fwGFh-0000oO-Vs for emacs-orgmode@gnu.org; Sat, 01 Sep 2018 20:28:30 -0400 Received: by mail-ed1-x52b.google.com with SMTP id s10-v6so11541884edb.11 for ; Sat, 01 Sep 2018 17:28:29 -0700 (PDT) Received: from localhost ([2a02:8084:4f41:8c80:f695:9e35:3068:c170]) by smtp.gmail.com with ESMTPSA id m9-v6sm7372318edc.10.2018.09.01.17.28.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Sep 2018 17:28:27 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Severity: minor 0. emacs -Q 1. M-x toggle-debug-on-error RET 2. Evaluate the following: (require 'org) (org-string-display (propertize " " 'display '(image :type svg :file "/path/to/image.svg"))) This gives the following error backtrace: --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=backtrace.txt Content-Description: Error backtrace Debugger entered--Lisp error: (wrong-type-argument sequencep t) #f(compiled-function (s property filter) #)(t invisible #f(compiled-function (props) #)) #f(compiled-function (s) #)(t) #f(compiled-function (props) #)((display (image :type svg :file "/path/to/image.svg"))) #f(compiled-function (s property filter) #)(#(" " 0 1 (display (image :type svg :file "/path/to/image.svg"))) display #f(compiled-function (props) #)) #f(compiled-function (build-from-parts prune-invisible s) #)(#f(compiled-function (s property filter) #) #f(compiled-function (s) #) #(" " 0 1 (display (image :type svg :file "/path/to/image.svg")))) org-string-display(#(" " 0 1 (display (image :type svg :file "/path/to/image.svg")))) eval((org-string-display (propertize " " 'display '(image :type svg :file "/path/to/image.svg"))) nil) elisp--eval-last-sexp(t) eval-last-sexp(t) eval-print-last-sexp(nil) funcall-interactively(eval-print-last-sexp nil) call-interactively(eval-print-last-sexp nil nil) command-execute(eval-print-last-sexp) --=-=-= Content-Type: text/plain I realise that org-string-display is a relatively obscure function that was probably not designed with image or other complex display properties in mind, but AFAICT the following is a pretty obvious "fix", given that the surrounding code expects 'value' to be a string or nil, but never t: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=org-string-display.diff diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index 583633605f..5ab069e6a2 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -108,7 +108,7 @@ org-string-display ;; string (face...). (let* ((display (plist-get props 'display)) (value (if (stringp display) display - (cl-some #'stringp display)))) + (cl-find-if #'stringp display)))) (when value (apply #'propertize ;; Displayed string could contain --=-=-= Content-Type: text/plain With this change, the return value of org-string-display does not really make sense for images, but at least the function doesn't barf on complex but valid display properties. WDYT? Thanks, -- Basil Emacs : GNU Emacs 27.0.50 (build 3, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2018-09-01 Package: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /home/blc/.local/share/emacs/27.0.50/lisp/org/) --=-=-=--