From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Display inline images for shortcuts links Date: Thu, 17 Aug 2017 15:59:26 +0200 Message-ID: <87shgqpa69.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1diLKe-0005ci-MP for emacs-orgmode@gnu.org; Thu, 17 Aug 2017 09:59:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1diLKa-00040z-RE for emacs-orgmode@gnu.org; Thu, 17 Aug 2017 09:59:32 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:53716) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1diLKa-000400-KR for emacs-orgmode@gnu.org; Thu, 17 Aug 2017 09:59:28 -0400 In-Reply-To: (Fabrice Popineau's message of "Thu, 17 Aug 2017 14:20:45 +0200") 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: Fabrice Popineau Cc: "emacs-orgmode@gnu.org" Hello, Fabrice Popineau writes: > Would it be possible to enable inline images for shortcuts links ? > Currently, the function `org-display-inline-images' checks for a hard coded > file: link. > In the case of : > > #+LINK: temp file:c:/temp/%h > > [[file:cover.jpg]] > > [[temp:cover.jpg]] > > The first link will be matched, but not the second one. > (Unless I missed something?) Fixed, in master. > A small patch like the one attached enables to display inline images for > all links. > But maybe relying on the org-element API is not the smarter move here. org-element API is already used in the function (e.g., `org-element-property' ...). However `org-element-parse-buffer' is a bit heavy for the task, in particular in the supposedly common case where inline image are not the most common link type throughout the buffer. I simply extended the link search to all link abbrevs, discarding those that do not ultimately match a file. Does it solve your issue? Regards, -- Nicolas Goaziou