From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id yOHjOjYfbWZqDQAAqHPOHw:P1 (envelope-from ) for ; Sat, 15 Jun 2024 04:57:27 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id yOHjOjYfbWZqDQAAqHPOHw (envelope-from ) for ; Sat, 15 Jun 2024 06:57:27 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=OyLaSpr3; 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-Seal: i=1; s=key1; d=yhetil.org; t=1718427446; a=rsa-sha256; cv=none; b=EXeMi89Zle4Z+juiBXoYzrSmoFORHNWWUPvwaWT8EIZ15l4U/Wyf6tCxkv61wiKAPSzSek XvyMrDj1h/OmhhMmkdrNPMqJ+qCWsNPk9BnmCaEx41QemSIv9oQAro4vFkWVl4zFaBOjqt SS4hBNEvRZhfB9f7PdXuXMbd4HcfiXIoG1Q7QQsKwiq2s3VUc24GVNJ8pjb5wbmixScE12 C/ECubRqLq9WFeCCdzGs1EW7pb3e+H/44PYa0O2rH3/G6Hr4h7EZlNmuoCM5pCSZowheJ6 nT5mzAv2ghDDq4bwwvTZQ2zfSzMakRCG6L9cZ5mmSt0P+EYZ3W9C+dhD4VU8dg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=OyLaSpr3; 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=1718427446; 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=E/BEYUyhWLnWgIR/UspYOICRkeYpCFhXLZZa6DCxZ00=; b=ZETmqL/x7zjco6t2sED8TGAdVycmbbyOiUhTebtoVy160Hvp5wnVcrpEMHBv2B8TGxk6zl ZhcEOcb5z6jNHAWxNuhCeHlCvnKx0Xhh/RW98QbXF4QJGSDrqNGZtaJXkb7AteI/5mHJm8 a3io6kjqcvDki4qQgDv3QfvAEexVRm+mUDHdwhdRq3XEFct999aEX6rtilwHkvsAfcz+1e dVK7h16IfeGYRpFTG63X8OpCJJz5W9+2Wn4255TWuyw23YdzgLV2VYUoVKS8p/3GUQyvDH 8WYmesK8jY6lTn+LDNM/l2ebwCDwV96+Fn0bwQfcEyWIbyMraxj+RkCu8SKNCw== 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 79E351C1D1 for ; Sat, 15 Jun 2024 06:57:26 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sILSa-0007Wl-T8; Sat, 15 Jun 2024 00:56:16 -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 1sILSX-0007TV-3n for emacs-orgmode@gnu.org; Sat, 15 Jun 2024 00:56:13 -0400 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sILSV-0001o8-9k for emacs-orgmode@gnu.org; Sat, 15 Jun 2024 00:56:12 -0400 Received: by mail-pg1-x543.google.com with SMTP id 41be03b00d2f7-681ad26f4a5so1843068a12.2 for ; Fri, 14 Jun 2024 21:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718427369; x=1719032169; 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=E/BEYUyhWLnWgIR/UspYOICRkeYpCFhXLZZa6DCxZ00=; b=OyLaSpr3Z0vJhPK5Ky51WWqmzEg6NxkaywIiT2MGsu8hxlS961W/Bivy9sYJmrEu8E 0gBvy1voMJ+1/N2QWP+9rdKjHVuO+ykye+vPQAWFASjoEC66g0Vxqz2BGfSan4t4nek6 M8bTRJGyh7su6UKejEs22tzzt/r/yJO8ZDlDhxScslxl7p305gGLJ5t2yhPRt0dpxIUk vRlZgh4m40589ezHFtSAOSIh99qSesq2ADHBcUhUJbUSc0NltiW7rRtADRVAD/V9WozA BsgTCy4E980LZyfmHqbqpriiWDq3MlLdlmbPhA5gP/MCchE+Vye07m07DzTpGD3j42+v 57fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718427369; x=1719032169; 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=E/BEYUyhWLnWgIR/UspYOICRkeYpCFhXLZZa6DCxZ00=; b=gJGpPiitJRJhtjG8+qRuKy+hsCPsWsWNVtvTJmkH1xp79tUOeulogIHLRWDA+vzigi ECahQlGb9jw6FE1oF/WUKmFszY5mVYevJJ2EVgGZ4B6hFxQPBjg8cmgQ9c92jXx6I/kB xo8QKyb3zUizGeUU3w9DYD/iSr61OXkHThkt6VLBHEFYUCKIhrQTA2kWJz6Ip+Ix11R6 PiulcHORkH+rMoh0GKrS9x7ImSfsH+UfgRmwiXNgELeLIY/GV++Nq3otCSEiAybQow6o ceY+T5DZO+wm9sj5b3LlmgS8s9zKfR3Z/2c2SWz8Yd9EoA3+7xYGu5U92cMKPM0OpGrj fNxg== X-Gm-Message-State: AOJu0Ywh/kHl6PHNh+8xc0sV+Vh5YVn1Bk2f7x+IJQCYX6HSp+UQIxfk WfUu7Q4bVdUrB/XeayX95d3CTQ9DmaZ//rBpceFRFOAVDkZLq7lf X-Google-Smtp-Source: AGHT+IEyAttZDq8yl3zAO/vDNhMfuIHT9Y1VZPCs7FdbhpdGx7xiIgS5zL11kLI7gXiWCroKx3xMXQ== X-Received: by 2002:a17:902:db11:b0:1f6:869d:25bd with SMTP id d9443c01a7336-1f8627df7a7mr54814645ad.37.1718427368860; Fri, 14 Jun 2024 21:56:08 -0700 (PDT) Received: from localhost ([103.232.241.147]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f855f18724sm41166075ad.234.2024.06.14.21.56.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 21:56:07 -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: <87o783k4v9.fsf@localhost> (Ihor Radchenko's message of "Fri, 14 Jun 2024 13:53:30 +0000") Date: Sat, 15 Jun 2024 10:26:02 +0530 Message-ID: <87a5jm6bz1.fsf@gmail.com> References: <87mso7sl6g.fsf@gmail.com> <87cyowua5n.fsf@localhost> <87v82d48wb.fsf@gmail.com> <87o783k4v9.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::543; envelope-from=visuweshm@gmail.com; helo=mail-pg1-x543.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 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, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 79E351C1D1 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -7.88 X-Spam-Score: -7.88 X-TUID: 4Fu409dcpsK8 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable [=E0=AE=B5=E0=AF=86=E0=AE=B3=E0=AF=8D=E0=AE=B3=E0=AE=BF =E0=AE=9C=E0=AF=82= =E0=AE=A9=E0=AF=8D 14, 2024] Ihor Radchenko wrote: > Visuwesh writes: > >>>> This is more of a FR than a bug but it would be nice to have working >>>> replot-on-resize when the gnuplot terminal is qt, x11, etc. To have >>>> this functional, the data-file needs to be not deleted. >>> >>> It should be doable. >>> We can simply use `org-babel-temp-stable-file' and leave cleaning up to >>> `org-babel-remove-temporary-stable-directory'. >> >> The data writing functions themselves require a filename so the file >> content cannot be used as DATA to org-babel-temp-stable-file. What >> should be DATA instead? (list table params)? > > All the things that contribute to what is written to the data file: > > ;; Dump table to datafile > (let ((dump-func (plist-get type :data-dump))) > (if dump-func > (funcall dump-func table data-file num-cols params) > (org-plot/gnuplot-to-data table data-file params))) > > So, you can set DATA to (list (or dump-func 'org-plot/gnuplot-to-data) ta= ble num-cols params) Done in the attached patch. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-org-plot-Make-data-file-stable-for-replot-on-resize.patch >From 0b81eb9da94cdf311bf54748b03d33a550d431cd 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, 7 insertions(+), 5 deletions(-) diff --git a/lisp/org-plot.el b/lisp/org-plot.el index 283d993..8adfbc8 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 @@ -696,7 +694,11 @@ (defun org-plot/gnuplot (&optional params) (looking-at "[[:space:]]*#\\+")) (setf params (org-plot/collect-options params)))) ;; Dump table to datafile - (let ((dump-func (plist-get type :data-dump))) + (let* ((dump-func (plist-get type :data-dump))) + (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 --=-=-=--