From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id eBSNGLvEb2aR8AAAqHPOHw:P1 (envelope-from ) for ; Mon, 17 Jun 2024 05:08:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id eBSNGLvEb2aR8AAAqHPOHw (envelope-from ) for ; Mon, 17 Jun 2024 07:08:11 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="A4Q8WUf/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1718600891; 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=UiYbuYyDoiT036db0nIoHP96qPkY42TPo11aRRkscAY=; b=NmedaFg1nr3G4XkzF6Kl5FTbdkRd1U/as/IsoWTsx2fTnK89EGRzgjiUaxUX6SLCkB5rZ4 +Vqul/487iTDoYgYBPk468aEyuCtcZXMKP+XLqw+RcsU04oM1Mq6A51pzHCiRSvtwgNnox NrTfEXcwaCR3bQsTUZ/g8uN0Xg/oHZTgd5UAeRxsIkNbURbZTX0SwI+XmlAV7sYN+TXeID sksGK5y+tGlkJ2Uyxwq7RsKF62+idkHBu93t5I89+8jHd0kKuy8CmEBMkMX/b5uNuIzAkQ fMEaeXmhG71WFogtWoW+z12so0Belpd5Lnl0Gv/lybo1ik3ZviJQBYEnX2Oj5A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1718600891; a=rsa-sha256; cv=none; b=V1jPVg5a0Zqsm63RiRa50wn0RvRmsvqavBFT2kDwaHxotXQ7T8yiJ35d31+cbwLiaufeWv WaS0SyZuUmiyMNa9CPNiD8VdTJ142Z4Z1fHOWzqu01J+/rX7SfvvGdi5PCdmtuG38DD/uO RQIltUHcifdSXFLMItYAH/EiqWZecgdf7xgHIvoL267HRuBYp2TfZH13EEuAwzFdGwFbNd gh12PVL1OYS/auRhztPxesfZ2lfdBtlKCY0BdQyBbznzgIxgx9DTYRxaDDPQ2ycQUAyGBx EWXBBHi1BR0O6bzj1Jz0P3dxTNS1DGSHMYBmr94CmE3K7jItD2iU6b/eypu0Uw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="A4Q8WUf/"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" 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 196CDE275 for ; Mon, 17 Jun 2024 07:08:11 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJ4ag-0002Tt-Dr; Mon, 17 Jun 2024 01:07:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sJ4ae-0002TZ-Tw for emacs-orgmode@gnu.org; Mon, 17 Jun 2024 01:07:36 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sJ4ad-0006NH-3f for emacs-orgmode@gnu.org; Mon, 17 Jun 2024 01:07:36 -0400 Received: by mail-pf1-x444.google.com with SMTP id d2e1a72fcca58-7042cb2abc8so2833367b3a.0 for ; Sun, 16 Jun 2024 22:07:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718600853; x=1719205653; darn=gnu.org; h=mime-version:user-agent:references:message-id:date:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=UiYbuYyDoiT036db0nIoHP96qPkY42TPo11aRRkscAY=; b=A4Q8WUf/uecHhxW0Wp+pIqZ0JVB1T45Ugp4V8binvfnzKN8Gndwqm5/6QeK/QSk+v6 IefEaNQZ+o+Z5BkxhqA2vLA1r6epH4Q6rxQIdkyQBk8AcOjnOxAc+LFSVjdD4XdvqZrH /e14mo6MjepNMrq7f2jDH2igkRgGB5dOFRkBg1FBkACJ1zngGmEK2a09n4lf+BExdsX/ qWJA8bQaemyzFT8mJ/xZwwMznySLqU/U768O9RGExfyoOZPDA6owSvTf9Xclh0FpUdsQ asY1tr6Ram13dwOpZTjw1kAaDWQ/he1nsU0WtvSGSDLZ/CzG6fyauUi9JUXhwALRHZ5B AdYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718600853; x=1719205653; h=mime-version:user-agent:references:message-id:date:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UiYbuYyDoiT036db0nIoHP96qPkY42TPo11aRRkscAY=; b=NaJKreAYfpEy3QC/Ozy/4sp6YXSMI8L51zA7LxptKO7rXEMbJAiPCC+FGddSyWX0ah BoOWjirM7NDQonHJFMQRsVlKgo5YfNum/nCf2dGqIfk5pdMMvygynOeis0s0r98ozRNw N53Pas84NiViWx62WmQLddSeeffPvRl9WZ4x9EbPdCv2Q5mV42YjufjEb/529egL6yFh nnGX2b5ZkltJBUzWwEpX/mh6JV5KFfUW86O0TJWHwkgH30lV3Pav6XxYHRAQk9sjzExv /Rd7SLTtNoeYV4zfoNG9zm2M7V989PJT9ndJCoKufQSB1da8uXZFloFSPf4eQPgMylMJ Jz/A== X-Gm-Message-State: AOJu0Yy32BzNl1L2TfDgUhvkusuFY1lISSbXtpXd6b0rgcafocYDWpjK MRmo2nHRZIjEVjJH8V7OXNwKhYwTglFVP0mCrpBp1H3coRduoD60 X-Google-Smtp-Source: AGHT+IFkL2cDpQfCp0jdUB/naXId4UAmdLKY3w5+yL/ye7WPsNaJ93UVaCUofL+L16L151dHbmkyRw== X-Received: by 2002:aa7:85c2:0:b0:704:34c2:b0bd with SMTP id d2e1a72fcca58-705d71d5e3bmr7808199b3a.27.1718600853015; Sun, 16 Jun 2024 22:07:33 -0700 (PDT) Received: from localhost ([103.232.241.147]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-705ef260437sm2895953b3a.85.2024.06.16.22.07.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jun 2024 22:07:32 -0700 (PDT) From: Visuwesh To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [BUG/FR] org-plot: replot on resize [9.7-pre (N/A @ /home/viz/lib/emacs/straight/build/org/)] In-Reply-To: <87frtegwd3.fsf@localhost> (Ihor Radchenko's message of "Sat, 15 Jun 2024 13:37:44 +0000") Date: Mon, 17 Jun 2024 10:26:22 +0530 Message-ID: <87plsg416x.fsf@gmail.com> References: <87mso7sl6g.fsf@gmail.com> <87cyowua5n.fsf@localhost> <87v82d48wb.fsf@gmail.com> <87o783k4v9.fsf@localhost> <87a5jm6bz1.fsf@gmail.com> <87frtegwd3.fsf@localhost> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::444; envelope-from=visuweshm@gmail.com; helo=mail-pf1-x444.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -6.69 X-Spam-Score: -6.69 X-Migadu-Queue-Id: 196CDE275 X-Migadu-Scanner: mx11.migadu.com X-TUID: wxSgtxykBbmx --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [=E0=AE=9A=E0=AE=A9=E0=AE=BF =E0=AE=9C=E0=AF=82=E0=AE=A9=E0=AF=8D 15, 2024]= Ihor Radchenko wrote: > Visuwesh writes: > >>> So, you can set DATA to (list (or dump-func 'org-plot/gnuplot-to-data) = table num-cols params) >> >> Done in the attached patch. > > Thanks! > >> ;; Dump table to datafile >> - (let ((dump-func (plist-get type :data-dump))) >> + (let* ((dump-func (plist-get type :data-dump))) > > Why let*? Oops, leftover change from a previous iteration of the patch. Now fixed. >> + (setq data-file (org-babel-temp-stable-file >> + (list (or dump-func 'org-plot/gnuplot-to-data) >> + table num-cols params) >> + "org-plot")) > > Please add in-code comment explaining why we need `org-babel-temp-stable-= file'. Now done. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-org-plot-Make-data-file-stable-for-replot-on-resize.patch >From a922946b3965e117dc3bbbe5a4f3c67dcc832d68 Mon Sep 17 00:00:00 2001 From: Visuwesh Date: Sat, 15 Jun 2024 10:25:19 +0530 Subject: [PATCH] org-plot: Make data-file stable for replot-on-resize * lisp/org-plot.el (org-plot/gnuplot): Use a stable data-file to make replot-on-resize in GUI terminals work. Reported-by: Visuwesh Link: https://orgmode.org/list/87mso7sl6g.fsf@gmail.com --- lisp/org-plot.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/org-plot.el b/lisp/org-plot.el index 283d993..83483b2 100644 --- a/lisp/org-plot.el +++ b/lisp/org-plot.el @@ -662,8 +662,7 @@ (defun org-plot/gnuplot (&optional params) (looking-at "[[:space:]]*#\\+")) (setf params (org-plot/collect-options params)))) ;; collect table and table information - (let* ((data-file (make-temp-file "org-plot")) - (table (let ((tbl (save-excursion + (let* ((table (let ((tbl (save-excursion (org-plot/goto-nearest-table) (org-table-to-lisp)))) (when (pcase (plist-get params :transpose) @@ -681,12 +680,11 @@ (defun org-plot/gnuplot (&optional params) (nth 0 table)))) (type (assoc (plist-get params :plot-type) org-plot/preset-plot-types)) - gnuplot-script) + gnuplot-script data-file) (unless type (user-error "Org-plot type `%s' is undefined" (plist-get params :plot-type))) - (run-with-idle-timer 0.1 nil #'delete-file data-file) (when (eq (cadr table) 'hline) (setf params (plist-put params :labels (car table))) ; headers to labels @@ -697,6 +695,12 @@ (defun org-plot/gnuplot (&optional params) (setf params (org-plot/collect-options params)))) ;; Dump table to datafile (let ((dump-func (plist-get type :data-dump))) + ;; Use a stable temporary file to ensure that 'replot' upon + ;; resizing a GUI gnuplot terminal window works. + (setq data-file (org-babel-temp-stable-file + (list (or dump-func 'org-plot/gnuplot-to-data) + table num-cols params) + "org-plot")) (if dump-func (funcall dump-func table data-file num-cols params) (org-plot/gnuplot-to-data table data-file params))) -- 2.43.0 --=-=-=--