From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id WNujHv6lg2DomwAAgWs5BA (envelope-from ) for ; Sat, 24 Apr 2021 07:00:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id UPUsGv6lg2AQdgAAB5/wlQ (envelope-from ) for ; Sat, 24 Apr 2021 05:00:46 +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 C879F24C65 for ; Sat, 24 Apr 2021 07:00:45 +0200 (CEST) Received: from localhost ([::1]:51010 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1laAPL-0005Mr-Vw for larch@yhetil.org; Sat, 24 Apr 2021 01:00:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35532) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1laAOc-0005LR-8V for emacs-orgmode@gnu.org; Sat, 24 Apr 2021 00:59:58 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:36655) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1laAOa-00047r-Eu for emacs-orgmode@gnu.org; Sat, 24 Apr 2021 00:59:57 -0400 Received: by mail-pg1-x536.google.com with SMTP id j7so27154195pgi.3 for ; Fri, 23 Apr 2021 21:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=user-agent:from:to:subject:message-id:date:mime-version; bh=/tulPbWy5d0PVh2HCKQ/Ve9Hj0O/EsTl3IUMQ53RdlU=; b=UuBdkKvUA0j+SWGh583A9DkLYWwF8aiRGt3hBJkixr8SSelIVvRCVb96+WryVTrsMr /hFvv8n9xoKTcp9V4UXycgDfoxGms3IODMf9i+aSqgywPoxwQlY7M5zwxgcRQATpg2LZ 0GP+BWkEycIefMxRmF9DDgzLsa44DXFxWmW92pefeM8oU+qDZrJVkKTb/XyU3WxBREm0 3APs911HhVJcYL1c/u0WO/vLZCq477Hn/w89MPkqLkguWDGLNU5xcSJLOKa47ITr+tC1 nERgGQGpDx9guzJaPNsRcy8GG/nfA5Z5f+4FKFTTFBA5Ab2aLpusi3N0bbIr+KOYtOr6 KVJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:subject:message-id:date :mime-version; bh=/tulPbWy5d0PVh2HCKQ/Ve9Hj0O/EsTl3IUMQ53RdlU=; b=LzkXtanCOoeXC99+2ggpSajyKrOuC2uABP0Ho3s119kFIZsbeHkHgWRUEthZYtd+eJ ZSL+ZKsmhh49h8YZjb++fFMFXfdyn0VJcr7/DNjMVv4g6ngqdo5tQas3SNM9sEhQuPFJ DQefYccIySC9qnGThbmdrMYCTPLmKCl8pxgOUVfg4q1r33jP9Sgq58ZlVex3R4TrfoBG pIHVUsCA4Gq6KIj/5HTUfMCojPD26F0ngWKFb66/fEwWmVMLCdmIeFz0OV+vxRULYIsD A9F32G7o0uL/8+GH8fiiqEGeiduMtPgwA1FqJDxPUjOJS7lejLZfEaHPm1tQWpZZwWIl bqog== X-Gm-Message-State: AOAM532mSQGvU5jZdnQ2mOE+9VYYNK9dIpHRBpbs+/FHxPz+7jMUlOSt FFNQdpqb5SKXIo2MqG0fh9cAC+/+P3I= X-Google-Smtp-Source: ABdhPJxo6jm1IAYPrMWWVTJLHioL7T27YEhWp7cqqnuxiewU+J+Pk/TJJWXfVAq8QLzXSEQhGn6G1Q== X-Received: by 2002:a62:bd13:0:b029:25c:5ec4:c2f3 with SMTP id a19-20020a62bd130000b029025c5ec4c2f3mr6869046pff.35.1619240393700; Fri, 23 Apr 2021 21:59:53 -0700 (PDT) Received: from localhost (180-150-91-8.b4965b.per.nbn.aussiebb.net. [180.150.91.8]) by smtp.gmail.com with ESMTPSA id f5sm5893389pfd.62.2021.04.23.21.59.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Apr 2021 21:59:53 -0700 (PDT) User-agent: mu4e 1.4.15; emacs 28.0.50 From: Timothy To: org-mode-email Subject: [PATCH] Refresh inline plotted images Message-ID: <87r1j0mg56.fsf@gmail.com> Date: Sat, 24 Apr 2021 12:59:49 +0800 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::536; envelope-from=tecosaur@gmail.com; helo=mail-pg1-x536.google.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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: , 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=1619240445; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=/tulPbWy5d0PVh2HCKQ/Ve9Hj0O/EsTl3IUMQ53RdlU=; b=UcJ0XuOWcg/phy2MkIOkCjpKigqB9mek7Im/PE+0BnklrO4CJezs6Tq05w7pej7IYaPwNx fXzC7xNfVFcoGIIh8s9Doof6WtDRhG+CEdQ6qFe/A+szcIoNZ8fVqxJLBZMdnQ/q0HRj3r TDqqyPqewNIqdMUCQ4lsnR4F/LWJ6y4CIcJl0TLBWOOQ9G0XrYpHBQYgAneRe2iOSm9yc2 VCZfeh94yLhGL74Lv/d2b/t2aAj9/Qn7OSxW6LNOvjUzUkKQZWK7QSUJdjjBxH+BCJsQnB DVniOW+DCurlr/iOl/F859USzqouSuc6Jz7EhXpLum0ZKWubkNvMZQ5tg9xTvg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1619240445; a=rsa-sha256; cv=none; b=RpJNPxJBd2ZdRh3J/uxX0toE68op8fcZs1iNFwgRpMExc6QGueJ0VHyLNcK296xUH1tkMe 1aUcnBC6YMXdfo4AwPZjIm6a2cpjMpc3K25ByzgrJnyPWZl7IlDan5yiLHS8OU4a5Tw37a EIYaLx0i4CabjbPo+0t1M6N3tczElwfQl1hTn6/hFFVOMGUcSXTv+zrQZx2bTMMVkwP1Hr P9MFhSz9XLWknB1pc+MQz+QmOPFMC4ESyKJFaC9n0IdLpMesLkJYqy93ytEdTi/LB0V7p/ oFkEYC1e3rw6lg5X5oF+8BdRGXlnW6M8sdWosVNcUmRUkNje0gSq/NVCCTONcQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=UuBdkKvU; dmarc=pass (policy=none) header.from=gmail.com; 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: -3.14 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=UuBdkKvU; dmarc=pass (policy=none) header.from=gmail.com; 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: C879F24C65 X-Spam-Score: -3.14 X-Migadu-Scanner: scn0.migadu.com X-TUID: 3s00d2ulsq3i --=-=-= Content-Type: text/plain Hi All, This patch improves the result of running org-plot in the following situation #+plot: ... file:"somefile.png" [[file:somefile.png]] Previously, when somefile.png is re-plotted the [[file:]] inline image did not refresh. With this patch, after plotting, overlays of the replotted image are refreshed. -- Timothy --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-plot-Refresh-inline-images-after-plotting.patch >From 5c848c186f2dd4d77b0dcc1035b3c889a4b023a2 Mon Sep 17 00:00:00 2001 From: TEC Date: Sat, 24 Apr 2021 12:49:26 +0800 Subject: [PATCH] org-plot: Refresh inline images after plotting * lisp/org-plot.el (org-plot/redisplay-img-in-buffer): New function which searches the current Org buffer for overlays of a certain image, and refreshes those overlays. (org-plot/gnuplot): Use `org-plot/redisplay-img-in-buffer' after plotting to redisplay any associated inline images. --- lisp/org-plot.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/org-plot.el b/lisp/org-plot.el index 28cff94f2..65bc71074 100644 --- a/lisp/org-plot.el +++ b/lisp/org-plot.el @@ -610,6 +610,13 @@ (defun org-plot/gnuplot-script (table data-file num-cols params &optional prefac ",\\\n ")))) script))) +(defun org-plot/redisplay-img-in-buffer (img-file) + "Find any overlays for IMG-FILE in the current Org buffer, and refresh them." + (dolist (img-overlay org-inline-image-overlays) + (when (string= img-file (plist-get (cdr (overlay-get img-overlay 'display)) :file)) + (when (file-exists-p img-file) + (image-refresh (overlay-get img-overlay 'display)))))) + ;;----------------------------------------------------------------------------- ;; facade functions ;;;###autoload @@ -697,7 +704,10 @@ (defun org-plot/gnuplot (&optional params) (gnuplot-mode) (gnuplot-send-buffer-to-gnuplot)) ;; Cleanup. - (bury-buffer (get-buffer "*gnuplot*"))))) + (bury-buffer (get-buffer "*gnuplot*")) + ;; Refresh any displayed images + (when (plist-get params :file) + (org-plot/redisplay-img-in-buffer (expand-file-name (plist-get params :file))))))) (provide 'org-plot) -- 2.31.1 --=-=-=--