From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id JzjQAeUQcmBXRAEAgWs5BA (envelope-from ) for ; Sat, 10 Apr 2021 22:56:05 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id qD05NuQQcmDZNAAA1q6Kng (envelope-from ) for ; Sat, 10 Apr 2021 20:56:04 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2FF782ADA5 for ; Sat, 10 Apr 2021 22:56:04 +0200 (CEST) Received: from localhost ([::1]:41162 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVKeA-0006t6-RH for larch@yhetil.org; Sat, 10 Apr 2021 16:56:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVKdB-0006rE-8h for emacs-orgmode@gnu.org; Sat, 10 Apr 2021 16:55:01 -0400 Received: from out2.migadu.com ([2001:41d0:2:aacc::]:64381) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVKd7-0003Ld-8T for emacs-orgmode@gnu.org; Sat, 10 Apr 2021 16:55:00 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1618088092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=lgVwgaNDejeCJcYqlhceS4QZzs9ClEBEKxVzDlwVZLU=; b=pCqzGLNQ4jiN+pjBNVstKfulsx41WVwEp0Mz48CBZ4OJZDfFTyz8TwCP0nHGSgR+pbKAZG QJvsIo/tNyqY+DmgweDDiDuXwyd9QjHgfZRf0EUNn3ecQ6bqMF/9IZT3Gpb1CGECPOxlGS 3g8rOfeO4NhGtuu32EnIZro1iGv3GN14b+x3Fj1+RdNnKB8IeS86niNWr1mNUiPQQqmIkv rj2ZrsIYF0hyxyw3iGdHyKso5TOdgsIxir0ES4xgIJ+1DxRmaw53/0a2iuqzItEd2yVNqI SyWqiRn3lyoxbxjXaeiBCJQOCDip9M4gO4XjQA62vND8U/rpkMTY0MRjYuBZRw== From: Kyle Meyer To: "Daniel E. Doherty" Subject: Re: Bug: Display Inline Images from Subdirectory [9.4.4 (9.4.4-33-g5450d6-elpaplus @ /home/ded/.emacs.d/elpa/org-plus-contrib-20210322/)] In-Reply-To: <87k0pdj7p0.fsf@ddoherty.net> References: <8735w3kshh.fsf@ddoherty.net> <87blaq6glc.fsf@alphaville.usersys.redhat.com> <87k0pdj7p0.fsf@ddoherty.net> Date: Sat, 10 Apr 2021 16:54:50 -0400 Message-ID: <87tuodoo6d.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Auth-User: kyle@kyleam.com Received-SPF: pass client-ip=2001:41d0:2:aacc::; envelope-from=kyle@kyleam.com; helo=out2.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1618088164; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=lgVwgaNDejeCJcYqlhceS4QZzs9ClEBEKxVzDlwVZLU=; b=F3dpvDKNPcQwZ/tANtA3DmZ+qIV+OtJ9iGeIJCrxx6A9ht0k0pKKJlWSbrJe+dzNaFM5Dq lFOVH6JGF4mycLqdXQcQyCxo6meJoyShW+SMlMHIlDPCCa3rPs5CxbzeKx2sF2KNwMixRp G5IOTReE7IcPiijatiMinq8VJgV3s3mSIumPvGnxBgGkzjZJSYtpsOsJs31bJG3iBALqcM bLvhbAMAGbLJ5d6X+RDXEZ5EPnBZ/XwiGCLRuEHGcKcbl3MgEpmfl3oRYHfCoFQbqHJbA5 bu3DXLycMxECSLsqfnet5xHa+I1cf/DhsNOuT9aI3sxOyyxlc/hQ/6gGIaTiBQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618088164; a=rsa-sha256; cv=none; b=HacqsvdiLSiKbZBDU8DAc5SCF5cZnEPlWOfkd1hJ/szeShQo2EFVjlxCYN28HSee326is2 EhDq1BJ21K4JMyJm/Haf2fgBuWk+3FOcI6XFbVjropxOJPS+BXAtp2L7pZfWzAuYjPH2g2 MiqiNZD0AJqsGRtQOBRsr0b98ASIoW7av1SCnFt2RTeyrZz1bPzna3WW6CBghzqLpIGvP/ RhwA0PA0EJRzFnDKKNNapWmzjXdxXMuelGKeLQAg4ns+K8n6fcEKwwnEaXqMqismWs7Bgg pinYfIx7758cvJjZfzW9KUFkixSpBVkk8G11zDe1cDmPg0YK+YaEMpIYFm1Giw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=kyleam.com header.s=key1 header.b=pCqzGLNQ; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.64 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=kyleam.com header.s=key1 header.b=pCqzGLNQ; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 2FF782ADA5 X-Spam-Score: -2.64 X-Migadu-Scanner: scn0.migadu.com X-TUID: xcH61cM88t/j Daniel E. Doherty writes: > Nick, > > Thanks for trying this out. I tried this again using emacs -Q with both > emacs27 and emacs28, and I still get the same result, i.e., it produces > the link but does not display it inline. Both versions supported > display of SVG graphics files. Hmm, I see the same behavior you're describing: your custom function doesn't trigger the inline display when :dir is used. Let's look at the custom function... > | (defun ded:org-babel-inline-display-subtree () > | "Redisplay inline images in subtree if cursor in source block with > :result graphics." > | > | (when (org-in-src-block-p) > | (let (beg end) > | (save-mark-and-excursion > | (org-mark-subtree) > | (setq beg (point)) > | (setq end (mark))) > | (when-let ((info (org-babel-get-src-block-info t)) > | (params (org-babel-process-params (nth 2 info))) > | (result-params (cdr (assq :result-params params))) > | ((member "graphics" result-params))) > | (org-display-inline-images nil nil beg end))))) > | > | (add-hook 'org-babel-after-execute-hook > #'ded:org-babel-inline-display-subtree) So, org-display-inline-images is probably the place to start debugging. You can step through its execution [1] and compare the "no :dir" vs ":dir" cases. When I did that, I noticed that a (expand-file-name "dot/lehman.svg") leads to a non-existent "/path/to/dot/dot/lehman.svg" (note the repeating "dot/"). That's because :dir temporarily changes the directory, and org-babel-after-execute-hook executes in that context. To work around that, you could avoid using org-babel-after-execute-hook and instead advise org-babel-execute-src-block so that your function is called afterward. Another approach would be to let-bind the default-directory in your function: (when (org-in-src-block-p) (let ((default-directory (if-let ((fname (buffer-file-name))) (file-name-directory fname) default-directory)) ...) ...)) [1] (info "(elisp)Instrumenting")