From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>
Received: from mp1.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 iAPGFz0XcWYp7AAA62LTzQ:P1
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 18 Jun 2024 05:12:29 +0000
Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp1.migadu.com with LMTPS
	id iAPGFz0XcWYp7AAA62LTzQ
	(envelope-from <emacs-orgmode-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 18 Jun 2024 07:12:29 +0200
X-Envelope-To: larch@yhetil.org
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=gmail.com header.s=20230601 header.b=ab7CP6qC;
	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=1718687549;
	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=10cZksMmESWiiOo9lrCsTBWZ7wWq2acKB4rtaI+s11U=;
	b=k4mHjm+7oEGevH4N5CVOjUSAjoIUeox9RqYhzuwjrg1hrVCZQ4LBvD4y1ymyhIIq141Bvv
	r/R/+cQ47QRYdGpkkimKKpeK0Ss+siJOnOTQwVNliG6Z2OZe7FqpfUIgpcFMJ3dIS9LX3s
	LS9Xfvy3uBhsSqu6IQJafKJACEvCuRUlCQjUNoXmRq1ScqBgcCtiONljz1N7w270y0URsu
	6fIugFkosFkrl7bCEX9/nqz7op9zFmo6lhiHZAL84JcNQk+JSC2TXAiokMKPuG8lyTKv5r
	VeGmWf0GZTjWKqc/CUSL9syZxMxLl3jsKJLI6IBykn9FFwxEqywgxQXC2lUZ9Q==
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1718687549; a=rsa-sha256; cv=none;
	b=hr27Ze/lILp1yawDXGXmiVESLoPKT/YSrdzOOwrnXY/1M6p9bPUG+vFQGNy/64dOl3Q5Un
	pfwFYQLvBWokYoeit8RRkvDAxezSMp+POroHVdcyaHHm6cBt5a0SUzLCFsx18VKLdXBr5D
	XLJPPtnw6vlgJi9MrYrSePCZtQy3MdU0Br1GDVf34vMqg++jMkBLT9dYBmyPDQk7MVeI8D
	gNuh/Ngri3pOWtMkAmHlzb36N73K1oRBKgd0MSt9eDfhBSyzBBYfXm12d9cxkhkxBz8L5p
	vk3pzAr1hFyitdIKS90S9Ob52A+Op8dCDJfw4z5wn1Mt9ASP9GEmGnYzV/Zldw==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=gmail.com header.s=20230601 header.b=ab7CP6qC;
	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 E1811752A5
	for <larch@yhetil.org>; Tue, 18 Jun 2024 07:12:28 +0200 (CEST)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <emacs-orgmode-bounces@gnu.org>)
	id 1sJR7t-0007FO-8e; Tue, 18 Jun 2024 01:11:25 -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 <visuweshm@gmail.com>)
 id 1sJR7r-0007Ez-MO
 for emacs-orgmode@gnu.org; Tue, 18 Jun 2024 01:11:23 -0400
Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <visuweshm@gmail.com>)
 id 1sJR7p-0004Ug-GI
 for emacs-orgmode@gnu.org; Tue, 18 Jun 2024 01:11:23 -0400
Received: by mail-pf1-x442.google.com with SMTP id
 d2e1a72fcca58-705fff50de2so1183455b3a.1
 for <emacs-orgmode@gnu.org>; Mon, 17 Jun 2024 22:11:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1718687479; x=1719292279; 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=10cZksMmESWiiOo9lrCsTBWZ7wWq2acKB4rtaI+s11U=;
 b=ab7CP6qCX1qqjadJY/gPdHxEjx5LLJbRpCsxDeg6qjkJuRMdwJtDhhqE6akCxsXnwk
 UOatUQqHwveov0VNt9bwsaxWnr1GpVVRqyBDON3+DEgGIIFGfOyBpBPfdKyW3JxIIRd7
 T0xYPaOrONxLG9mChZKzLOoWzIszrWvQkjIYmPgcvE+a35KaLxZ4XHu1S+guuhOt47Kj
 Fy4H0wcKQqY/CbqXOalynLhUtmrcefMVfwYaJEi7oZ7YcdJSlWVwg2P25I/jf34Zcah/
 7qb8Dgi2T1Iprh2KmSHuUVoWLCR9jeqjxgDZlmZNWpLGtEaUEImC0igvWn+VC4vsAC5/
 aTjA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1718687479; x=1719292279;
 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=10cZksMmESWiiOo9lrCsTBWZ7wWq2acKB4rtaI+s11U=;
 b=dG+rReXdB68cm6o5wdmYGTX4UWRu5bLml7I6zXRDhulg1Ej09H05de2FjGx/iFchkg
 zCi3Z4tN58cdTprw9gTkpphYx3PlaN+cpkn+gsrI5AAayLQXyrijArtL3eP/9tPTGvY6
 Ch6F2GFUGXOKCXpj+4OLXOAEfuFMK/1XCELTfnvkczN5m/4QLz4vLrg7NH5OCmZjoJ2D
 x7wjdJHrx+JPYEaeD1alP5NsqZ8p3IDiJFq1gApI/En6r5+2L/59j6bIZrXS/akBrMn+
 uKlyAqYAxHCzC5sH6gc45VMoa3VGwO43TYjsQ1R8RObiSSFCobO3/z20p6luUritR6TK
 Saww==
X-Gm-Message-State: AOJu0Yxn+C4du9DWZCBJ+fH+EnKJJU9NS9Y/K5hjkf2a0FzMbBexoEmK
 qCAlaa5xp7GfQbFg9UwHHBntqK9pOTbmhQxBdvoih6R0CmHjPukX
X-Google-Smtp-Source: AGHT+IGgAqHuNS1S/VfS0UMvczvj0Jjz0JxyUljdLKhyxTitfUEndL29zG1//F3DzlFrFfjEHUiyVA==
X-Received: by 2002:a05:6a20:4a1d:b0:1a7:9b0e:ded3 with SMTP id
 adf61e73a8af0-1bcab02420dmr2300501637.11.1718687479240; 
 Mon, 17 Jun 2024 22:11:19 -0700 (PDT)
Received: from localhost ([103.232.241.147]) by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-705ccb70f4asm8463911b3a.174.2024.06.17.22.11.17
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 17 Jun 2024 22:11:18 -0700 (PDT)
From: Visuwesh <visuweshm@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] org-plot: Unable to use text xtics with type:2d (+ more)
 [9.7-pre (N/A @ /home/viz/lib/emacs/straight/build/org/)]
In-Reply-To: <87y173a3vs.fsf@localhost> (Ihor Radchenko's message of "Mon, 17
 Jun 2024 17:13:59 +0000")
Date: Tue, 18 Jun 2024 10:40:04 +0530
Message-ID: <87jzimu98z.fsf@gmail.com>
References: <87cypbjw50.fsf@gmail.com> <871q5rv1qy.fsf@localhost>
 <8734q7jfes.fsf@gmail.com> <87wmmu72pu.fsf@localhost>
 <87zfrp4939.fsf@gmail.com> <87ikyd48f8.fsf@gmail.com>
 <87le36ilf0.fsf@localhost> <87le3440qe.fsf@gmail.com>
 <87y173a3vs.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::442;
 envelope-from=visuweshm@gmail.com; helo=mail-pf1-x442.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." <emacs-orgmode.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/emacs-orgmode>
List-Post: <mailto:emacs-orgmode@gnu.org>
List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>,
 <mailto:emacs-orgmode-request@gnu.org?subject=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.70
X-Spam-Score: -6.70
X-Migadu-Queue-Id: E1811752A5
X-Migadu-Scanner: mx11.migadu.com
X-TUID: jqUGzmonlBpO

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

[=E0=AE=A4=E0=AE=BF=E0=AE=99=E0=AF=8D=E0=AE=95=E0=AE=B3=E0=AF=8D =E0=AE=9C=
=E0=AF=82=E0=AE=A9=E0=AF=8D 17, 2024] Ihor Radchenko wrote:

> Visuwesh <visuweshm@gmail.com> writes:
>
>>>> -	   (type (assoc (plist-get params :plot-type)
>>>> -			org-plot/preset-plot-types))
>>>> +	   (type (cdr (assoc (plist-get params :plot-type)
>>>> +			     org-plot/preset-plot-types)))
>>>>             gnuplot-script)
>>>
>>> This may break the existing customization.
>>> Later in the function, TYPE is used as an argument for
>>> `org-plot/gnuplot-term-extra' and `org-plot/gnuplot-script-preamble'.
>>> Some users may have these two custom options adjusted to the older
>>> calling convention.
>>>
>>> To not break things, we should pass the full `assoc' to these functions.
>>
>> If you meant org-plot/gnuplot-script eventually calling these functions,
>> then I don't see how the above change will break things.  Even in
>> org-plot/gnuplot-script, TYPE passed to both these user options are
>>
>>     (let* ((type-name (plist-get params :plot-type))
>>            (type (cdr (assoc type-name org-plot/preset-plot-types))))
>>
>> so there should be no harm done by the above change since TYPE is not an
>> argument taken by org-plot/gnuplot-script.
>
> Agree. I accidentally moved away from the function that is actually
> being changed to org-plot/gnuplot-script that has nothing to do with
> TYPE binding you are changing in the patch.
>
> So, your code is ok here.

Thanks, so please find attached.


--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
 filename=0001-org-plot-Respect-parameters-given-in-org-plot-preset.patch

>From 9755ccb636ab8e1d855bbc386bc6bab2203a2cd5 Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@gmail.com>
Date: Tue, 18 Jun 2024 10:39:27 +0530
Subject: [PATCH] org-plot: Respect parameters given in
 `org-plot/preset-plot-types'

* org-plot.el (org-plot/gnuplot-script-preamble)
(org-plot/gnuplot-term-extra): Explain what "plot type" means.
(org-plot/preset-plot-types): Fix docstring and correct the lambda
argument order for the 'grid' plot type.
(org-plot/gnuplot): Merge the parameters given in
`org-plot/preset-plot-types' and the #+PLOT line to ensure the former
is respected everywhere.

Reported-by: Visuwesh <visuweshm@gmail.com>
Link: https://orgmode.org/list/87cypbjw50.fsf@gmail.com
---
 lisp/org-plot.el | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/lisp/org-plot.el b/lisp/org-plot.el
index 83483b2..b436613 100644
--- a/lisp/org-plot.el
+++ b/lisp/org-plot.el
@@ -302,9 +302,10 @@ (defgroup org-plot nil
 (defcustom org-plot/gnuplot-script-preamble ""
   "String of function to be inserted before the gnuplot plot command is run.
 
-Note that this is in addition to, not instead of other content generated in
-`org-plot/gnuplot-script'.  If a function, it is called with the plot type as
-the argument, and must return a string to be used."
+Note that this is in addition to, not instead of other content generated
+in `org-plot/gnuplot-script'.  If a function, it is called with the
+parameters used by the current plot type (see
+`org-plot/preset-plot-types'), and must return a string to be used."
   :group 'org-plot
   :type '(choice string function))
 
@@ -349,7 +350,7 @@ (defcustom org-plot/preset-plot-types
     (grid :plot-cmd "splot"
 	  :plot-pre (lambda (_table _data-file _num-cols params _plot-str)
 		      (if (plist-get params :map) "set pm3d map" "set map"))
-	  :data-dump (lambda (table data-file params _num-cols)
+	  :data-dump (lambda (table data-file _num-cols params)
 		       (let ((y-labels (org-plot/gnuplot-to-grid-data
 					table data-file params)))
 			 (when y-labels (plist-put params :ylabels y-labels))))
@@ -391,8 +392,8 @@ (defcustom org-plot/preset-plot-types
 - :data-dump - Function to dump the table to a datafile for ease of
   use.
 
-  Accepts lambda function.  Default lambda body:
-  (org-plot/gnuplot-to-data table data-file params)
+  Accepts function with arguments:
+  (table data-file num-cols params)
 
 - :plot-pre - Gnuplot code to be inserted early into the script, just
   after term and output have been set.
@@ -541,7 +542,8 @@ (defcustom org-plot/gnuplot-term-extra ""
   "String or function which provides the extra term options.
 E.g. a value of \"size 1050,650\" would cause
 \"set term ... size 1050,650\" to be used.
-If a function, it is called with the plot type as the argument."
+If a function, it is called with the parameters used by the current plot
+type, see `org-plot/preset-plot-types'."
   :group 'org-plot
   :type '(choice string function))
 
@@ -678,8 +680,8 @@ (defun org-plot/gnuplot (&optional params)
 		    tbl))
 	   (num-cols (length (if (eq (nth 0 table) 'hline) (nth 1 table)
 			       (nth 0 table))))
-	   (type (assoc (plist-get params :plot-type)
-			org-plot/preset-plot-types))
+	   (type (cdr (assoc (plist-get params :plot-type)
+			     org-plot/preset-plot-types)))
            gnuplot-script data-file)
 
       (unless type
@@ -693,6 +695,10 @@ (defun org-plot/gnuplot (&optional params)
       (save-excursion (while (and (equal 0 (forward-line -1))
 				  (looking-at "[[:space:]]*#\\+"))
 			(setf params (org-plot/collect-options params))))
+      ;; Ensure that the user can override any plot parameter, and
+      ;; that the parameters set by the plot type in
+      ;; `org-plot/preset-plot-types' is respected.
+      (setq params (org-combine-plists type params))
       ;; Dump table to datafile
       (let ((dump-func (plist-get type :data-dump)))
         ;; Use a stable temporary file to ensure that 'replot' upon
-- 
2.43.0


--=-=-=--