GNU bug report logs - #21648
25.0.50; [PATCH] Add ability to specify radix for the yanked number in calc-yank

Previous Next

Package: emacs;

Reported by: Kaushal Modi <kaushal.modi <at> gmail.com>

Date: Thu, 8 Oct 2015 15:10:01 UTC

Severity: wishlist

Tags: patch

Found in version 25.0.50

Done: Kaushal Modi <kaushal.modi <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jay Belanger <jay.p.belanger <at> gmail.com>
To: Kaushal Modi <kaushal.modi <at> gmail.com>
Cc: 21648 <at> debbugs.gnu.org, jay.p.belanger <at> gmail.com
Subject: bug#21648: 25.0.50; [PATCH] Add ability to specify radix for the yanked number in calc-yank
Date: Thu, 08 Oct 2015 20:04:06 -0500
Hi!

> ​Done! I have implemented C-u C-y functionality which will prompt user to enter radix between 2 and 36.​
>
>> And perhaps some sort of message
>> if the entered radix isn't a number from 2 to 36 (the allowed radixes).
>
> Is that check needed in calc-yank? If I enter an invalid radix like
> 37, I get the generic error "Bad format in yanked data".​

But the data might be fine; the problem is with the radix.

>> ​Also, you probably want to make sure that calc-yank behaves
>> appropriately when a number isn't being yanked.
>
> Can you please provide feedback on how to incorporate that based on the below updated code?

To determine whether or not a string represents a number, you could have
Calc parse it, I suppose.  But that would be wasteful.
It might be better to add a function, maybe called
`math-numberstring-p', which returns t is the argument is a string
which represents a Calc number.  Then along with
  (or ((null radix)
      (string-match-p "\\`[0-9]+#" thing-raw)
      ...
you could add
      (not (math-numberstring-p thing-raw))

Oh, also, calc-yank can yank more than one line.  Currently, if

111
1111

is killed and yanked with C-8 C-y,
the result is

2:  73
1:  1111

and you'd probably want

2:  73
1:  585

Also, the message
  (message
  (concat "No radix is "
   "prepended for prefix "
  "value of %0d. Valid "
  "numeric prefixes are "
  "0, 2, 6, 8.")
   radix)
is a bit long.

> I can submit a PATCH once the new definition is confirmed.

I can commit this for you without a patch.

Jay




This bug report was last modified 9 years and 224 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.