From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id 0DnrD9d3UGbMTQEAe85BDQ:P1 (envelope-from ) for ; Fri, 24 May 2024 13:19:51 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 0DnrD9d3UGbMTQEAe85BDQ (envelope-from ) for ; Fri, 24 May 2024 13:19:51 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=NF4xGa7z; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1716549591; 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=2hTvFJiK6q7uPkz9NGaFAgS2oyQFgX+SY64cNaSX0Gk=; b=ru6fofblW9tdJExoM3YRrfUFhfeSZFlCDjPObBPI0oJ95qu/XVnHRwm5Pu7O1B6cl9ig/2 svEXkCU+2ca0zUXtp3bclbd2BUA1TOxBft+y3FXaBvJcL3IhiopsmER2DEZngQEoA6dqyw L2dU7/rv+xYszhyzLvkpA1YZegUjQ2D6dkdW/tQaHesIgPDSyusJLSPTC6gxxg6j4m2W9p DKY7CuacfkgEqwsK1FFTfUc0cWgBuCli6nbbV7xw/dR03BQHYium+jJZp/STagZrBPVJWF BbMAaHMVzeN0wP/ATtxMRxnfE7ko4zYIepWOOO2Nh9u2PSBSgWfeIyFZyrPBrQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=NF4xGa7z; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1716549591; a=rsa-sha256; cv=none; b=i72iunVn4fNbiL8E+3JorTr20teatFY9Q4V0TAMbhZr6uxF4/06xlU712J1TDo3pcMtLNG bmqftxHQKhHucMVtRbPpWch4dJoA0dbLG8kKiNA6oqItbmM2mU/6072HSJ4OKTzhaUSjgb 2xCQf7TXq9utIJTs3BK6YecZb5MGn6rvqzGMCCKt843+n7jp4AU3SrdncyBqUaCJMXzkhu Aww0h5JqmwifCWZJXbOynsnp3r52PHPKn414Q6NoGdW4y3CpoxMp4FuAT302hEApEIFTgl Udeq5E6GHzApGDaaMr2jaZC1C2wou3EVvGfCM56aubrjcAotjKrPJi0YSQ4F3g== 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 D12BD270A8 for ; Fri, 24 May 2024 13:19:50 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sASwo-0005aM-CA; Fri, 24 May 2024 07:18:54 -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 1sASwk-0005YP-F6 for emacs-orgmode@gnu.org; Fri, 24 May 2024 07:18:50 -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 1sASwi-0004w2-6B for emacs-orgmode@gnu.org; Fri, 24 May 2024 07:18:50 -0400 Received: by mail-pg1-x543.google.com with SMTP id 41be03b00d2f7-66629f45359so2714059a12.3 for ; Fri, 24 May 2024 04:18:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716549524; x=1717154324; darn=gnu.org; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=2hTvFJiK6q7uPkz9NGaFAgS2oyQFgX+SY64cNaSX0Gk=; b=NF4xGa7zwm9hlArw1CSc04UNH3/dFqT0GOBZz5mJ1KW+supAldGz8IPyd1P0EYic23 Np60/puP9IFTjuEBMROqeaTiKagVboG8oJFQzO40UvZtai3vu1UTL+9qPMP00dU5xC8W 1sT7aGnFUtEXWKq9dy+aMnDWKY6yubetVQT0CEIvlO3xFh/QrEVv1/taNbtOdK/BsLlf rAx3ilTuP0vRQmuJrPfYlyBW45UHHBV2pkhKdbZgbPiwAMOtCutfJoVewICxYPwaIUgH 6NZCbwYC1GztHrlSufy1MzojO+45QweN/AX1MD8YlamYUIBy6iCI0G/i4QLJZekxRNWb Ureg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716549524; x=1717154324; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2hTvFJiK6q7uPkz9NGaFAgS2oyQFgX+SY64cNaSX0Gk=; b=WLudH+PvekG4Ohwp9OHdgkMk1gD/2tKaGU+paSN5LWgUqiNeSO2LNbySphXcYZMED5 stdp3Sr8l6S80so82DIdom4Sb0F9nUsNymd7+D8S3S4MxGWuIFLcu0GZK2W8rk7aqTyN WjLn7cJS0+Qd4RDr9Pkrt0XSzngispEaeMMG3Nt1MsFs3UgJudyjut8kQjr75pj8VmUV Z3R0r2PcwydTM9v79cZSm6MKSCrw9rzRK2MILy4lfkgsxe9Q9YpV23+mUSyqSXn42fde UcWfwowa0amwRbMrY/4JD45gKuxIBJE0wxFQ8Hz9FkR4Wd9Eemh/WrvE1GmGLzOsuLW3 /KPQ== X-Gm-Message-State: AOJu0YxoGzrTf0hgN1a9jvye1XEHdZDcA9+oI2i3/ByZcEoPTNa5IUL0 4G+62ioU7ghy6eJZN+D+mniU0m2OLOTsjpG2oNAkWCOG1IKtVdVRi7tKsnFV X-Google-Smtp-Source: AGHT+IEGUdKl60c5O/n/kIA6NcMbcsQ8W7q8JjNRLM6hlfECLzr2/EW6ZSk8dkVwGOjGGqquZmdhOQ== X-Received: by 2002:a05:6a20:4329:b0:1af:3869:d761 with SMTP id adf61e73a8af0-1b212d5b11bmr2517795637.3.1716549524323; Fri, 24 May 2024 04:18:44 -0700 (PDT) Received: from localhost ([103.232.241.147]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2bdd9ece075sm3090000a91.9.2024.05.24.04.18.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 04:18:43 -0700 (PDT) From: Visuwesh To: emacs-orgmode@gnu.org Subject: [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 16:48:35 +0530 Message-ID: <87cypbjw50.fsf@gmail.com> 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: -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.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-Spam-Score: -9.68 X-Migadu-Queue-Id: D12BD270A8 X-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -9.68 X-TUID: sYSEAilsCOyO --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. ------------------------------------------------------------------------ Consider the following table, and try to execute the PLOT line #+PLOT: ind:1 deps:(3) type:2d with:lp | Sede | Max cites | H-index | |-----------+-----------+---------| | Chile | 257.72 | 21.39 | | Leeds | 165.77 | 19.68 | | Sao Paolo | 71.00 | 11.50 | | Stockholm | 134.19 | 14.33 | | Morelia | 257.56 | 17.67 | and watch it fail (see the error message in the *gnuplot* buffer). Although the 2d option in org-plot/preset-plot-types has :check-ind-type set to a non-nil value, org-plot/gnuplot does not check the value of :check-ind-type assigned in the 2d type given in the user-option. 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. BTW, the earlier check in the function for :data-dump should also fail because (plist-get (assoc 'grid org-plot/preset-plot-types) :data-dump) ;; =3D>= nil but (plist-get (cdr (assoc 'grid org-plot/preset-plot-types)) :data-dump) ;= ; =3D> non-nil where type =E2=89=A1 (assoc 'grid org-plot/preset-plot-types) in org-plot/gnuplot. [ I cannot reproduce the grid example in worg's org-plot.org file, but even with the fix, I cannot reproduce it; more below. ] 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? 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. For now, I have attached a patch that fixes all the issues. With the patch, i can run the example covered in the bug report. The grid example given in worg passes but it doesn't look as expected. I am not sure what to blame here. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=org-plot-fix.diff diff --git a/lisp/org-plot.el b/lisp/org-plot.el index 283d993..3be1b2f 100644 --- a/lisp/org-plot.el +++ b/lisp/org-plot.el @@ -679,8 +679,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) (unless type @@ -691,17 +691,13 @@ (defun org-plot/gnuplot (&optional params) (setf params (plist-put params :labels (car table))) ; headers to labels (setf table (delq 'hline (cdr table)))) ; clean non-data from table - ;; Collect options. - (save-excursion (while (and (equal 0 (forward-line -1)) - (looking-at "[[:space:]]*#\\+")) - (setf params (org-plot/collect-options params)))) ;; Dump table to datafile (let ((dump-func (plist-get type :data-dump))) (if dump-func - (funcall dump-func table data-file num-cols params) + (funcall dump-func table data-file params num-cols) (org-plot/gnuplot-to-data table data-file params))) ;; Check type of ind column (timestamp? text?) - (when (plist-get params :check-ind-type) + (when (plist-get type :check-ind-type) (let* ((ind (1- (plist-get params :ind))) (ind-column (mapcar (lambda (row) (nth ind row)) table))) (cond ((< ind 0) nil) ; ind is implicit --=-=-= Content-Type: text/plain Emacs : GNU Emacs 30.0.50 (build 8, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.0, Xaw scroll bars) of 2024-05-07 Package: Org mode version 9.7-pre (N/A @ /home/viz/lib/emacs/straight/build/org/) --=-=-=--