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/)]
Date: Fri, 24 May 2024 22:49:55 +0530 [thread overview]
Message-ID: <8734q7jfes.fsf@gmail.com> (raw)
In-Reply-To: <871q5rv1qy.fsf@localhost> (Ihor Radchenko's message of "Fri, 24 May 2024 12:21:57 +0000")
[வெள்ளி மே 24, 2024] Ihor Radchenko wrote:
> Visuwesh <visuweshm@gmail.com> writes:
>
>> Unless I misunderstood the code, the line
>>
>> ;; Check type of ind column (timestamp? text?)
>> (when (plist-get params :check-ind-type)
>>
>> should be
>>
>> ;; Check type of ind column (timestamp? text?)
>> (when (plist-get (cdr type) :check-ind-type)
>>
>> because (1) org-plot/collect-options only adds a select number of
>> keywords to the plist and :check-ind-type is not a part of the select
>> members, and (2) org-plot/gnuplot is never called with a non-nil value
>> for the optional argument PARAMS in tree.
>
> I do not think that it is right.
> AFAIU, the idea is that `org-plot/preset-plot-types' provides some
> default options, but the user can overwrite these defaults in the #+PLOT
> line. What you propose will disregard the values of
>
> :set :line :map :title :file :ind :timeind :timefmt :textind
> :deps :labels :xlabels :ylabels :xmin :xmax :ymin :ymax :ticks
>
> if they are customized by user in `org-plot/preset-plot-types'.
I don't follow your conclusion since this change will only affect the
value of :check-ind-type leaving the rest of the settings unaffected.
> I believe that the right way to address the problem will be
> `org-combine-plists' on the (1) org-plot/preset-plot-types; (2)
> org-plot/gnuplot-default-options; (3) #+PLOT lines in the buffer.
Looking at the definition of org-plot/add-options-to-plist and the Info
manual, I am not sure if :check-ind-type is supposed to be customised by
the PLOT line. It seems to be more of an internal setting. If you
agree to this, I can change the check to
(when (or (plist-get type :check-ind-type) (plist-get params :check-ind-type))
to heed the value of :check-ind-type in org-plot/gnuplot-default-options
(since PARAMS has the default values included earlier in the defun).
>> [...]
>> The other code smell I see is that the function checks for the PLOT line
>> twice. Once near the beginning of the function, and once just after the
>> cleaning up of hline. Is this simply an oversight?
>
> It is kinda intentional, but broken.
>
> Historically, users can put #+PLOT lines _after_ the table.
> However, after refactoring org-table.el, this is no longer working.
> See https://list.orgmode.org/orgmode/87o7a0p9ba.fsf@localhost/
OK, I will leave the check in then.
>> Coming to the grid example, the doc-string of org-plot/preset-plot-types
>> options says:
>>
>> - :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)
>>
>> but in fact, org-plot/gnuplot passes one more argument to the :data-dump
>> function:
>>
>> ;; 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)))
>>
>> but here's the catch: the :data-dump function in the grid option expects
>> the order
>>
>> (lambda (table data-file params _num-cols)
>>
>> which breaks things down the line. What should be the actual order
>> here? I looked at the history of those lines briefly using C-x v h but
>> I don't have the time to look into it properly to decide on the actual
>> argument order.
>
> The best order is de-facto calling convention in the code:
>
> (funcall dump-func table data-file num-cols params)
>
> The docstring and the default value should be fixed accordingly.
OK, will do this in a future patch.
next prev parent reply other threads:[~2024-05-25 5:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-24 11:18 [BUG] org-plot: Unable to use text xtics with type:2d (+ more) [9.7-pre (N/A @ /home/viz/lib/emacs/straight/build/org/)] Visuwesh
2024-05-24 12:21 ` Ihor Radchenko
2024-05-24 17:19 ` Visuwesh [this message]
2024-06-11 5:41 ` Visuwesh
2024-06-12 12:41 ` Ihor Radchenko
2024-06-13 7:04 ` Visuwesh
2024-06-13 7:18 ` Visuwesh
2024-06-15 9:51 ` Ihor Radchenko
2024-06-17 5:06 ` Visuwesh
2024-06-17 17:13 ` Ihor Radchenko
2024-06-18 5:10 ` Visuwesh
2024-06-18 14:29 ` Ihor Radchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8734q7jfes.fsf@gmail.com \
--to=visuweshm@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).