all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Narendra Joshi <narendraj9@gmail.com>
To: "Mattias Engdegård" <mattiase@acm.org>
Cc: 40155@debbugs.gnu.org
Subject: bug#40155: 27.0.90; `math-truc' called with `nil' during `calc-graph-fast' call
Date: Fri, 27 Mar 2020 21:54:06 +0100	[thread overview]
Message-ID: <CAHCj4z5nHB4MV-ZFLhUN30brBm3X4wADwQD2Xuye35K+EtPRHQ@mail.gmail.com> (raw)
In-Reply-To: <F33F5D12-DC0C-410D-B511-401BF43BE6AA@acm.org>

[-- Attachment #1: Type: text/plain, Size: 1249 bytes --]

Hi Mattias,

Thanks for the explanation. The patch fixes the original issue and
other calculations I tried didn't seem to be affected.

I found out that `calc` doesn't set the LineStyles (and maybe
PointStyles as well but I am not sure how to hand those over to
gnuplot command) properly for the gnuplot command. I think it should
do something similar to the patch I have attached.

Best,
Narendra

On Fri, Mar 27, 2020 at 6:37 PM Mattias Engdegård <mattiase@acm.org> wrote:
>
> Thanks for the report. Explanation:
>
> The graph code does
>
> (and (Math-num-integerp lstyle) (math-trunc lstyle))
>
> but Math-num-integerp returns true for nil, and math-trunc returns the argument if it satisfies Math-integerp, which used to return true for nil as well. Thus, the expression above 'works' (ie, returns nil) when lstyle is nil as well.
>
> However, Math-integerp was changed in Emacs 27 to use native bignums, and no longer returns true for nil, resulting in the error. Changing Math-num-integerp to return false for nil would make the code work again, this time in the way originally intended.
>
> Would you try this patch? (Please try various other operations as well, in case the change had unintended consequences.)
>

[-- Attachment #2: 0001-Fix-setting-linestyle-in-calc-graph-fns.patch --]
[-- Type: text/x-patch, Size: 861 bytes --]

From 1f40f23df71946fbed75881c6dca54eda94702c2 Mon Sep 17 00:00:00 2001
From: Narendra Joshi <narendraj9@gmail.com>
Date: Fri, 27 Mar 2020 21:51:09 +0100
Subject: [PATCH] Fix setting linestyle in calc-graph fns.

---
 lisp/calc/calc-graph.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el
index 4cdfdbd4b9..be0e133c9c 100644
--- a/lisp/calc/calc-graph.el
+++ b/lisp/calc/calc-graph.el
@@ -1139,7 +1139,7 @@ calc-graph-set-styles
                     (if (and lstyle (> lstyle 0)) (int-to-string lstyle) "1")
                     " " (int-to-string pstyle))
           (if (and lstyle (> lstyle 0))
-              (insert " " (int-to-string lstyle)))))))
+              (insert " ls " (int-to-string lstyle)))))))
   (calc-graph-view-commands))
 
 (defun calc-graph-zero-x (flag)
-- 
2.20.1


  reply	other threads:[~2020-03-27 20:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 20:18 bug#40155: 27.0.90; `math-truc' called with `nil' during `calc-graph-fast' call Narendra Joshi
2020-03-27 17:37 ` Mattias Engdegård
2020-03-27 20:54   ` Narendra Joshi [this message]
2020-03-28 13:35     ` Mattias Engdegård
2020-03-28 13:58       ` Narendra Joshi

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHCj4z5nHB4MV-ZFLhUN30brBm3X4wADwQD2Xuye35K+EtPRHQ@mail.gmail.com \
    --to=narendraj9@gmail.com \
    --cc=40155@debbugs.gnu.org \
    --cc=mattiase@acm.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.