From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jay Belanger Newsgroups: gmane.emacs.bugs 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 Message-ID: <87fv1k3la1.fsf@gmail.com> References: <87oag9fim6.fsf@gmail.com> <87wpux88mo.fsf@gmail.com> Reply-To: jay.p.belanger@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1444352737 27074 80.91.229.3 (9 Oct 2015 01:05:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 9 Oct 2015 01:05:37 +0000 (UTC) Cc: 21648@debbugs.gnu.org To: Kaushal Modi Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Oct 09 03:05:26 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from eggs.gnu.org ([208.118.235.92]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZkM7d-0006KH-0e for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Oct 2015 03:05:21 +0200 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkM7T-0000tL-Ie for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Oct 2015 21:05:21 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:38568) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkM7S-0000rQ-Ug for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Oct 2015 21:05:10 -0400 Original-Received: from localhost ([::1]:37874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkM7S-0004cj-Qs for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Oct 2015 21:05:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkM7O-0004ao-H6 for bug-gnu-emacs@gnu.org; Thu, 08 Oct 2015 21:05:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkM7L-0000de-7Y for bug-gnu-emacs@gnu.org; Thu, 08 Oct 2015 21:05:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44264) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkM7L-0000dZ-4z for bug-gnu-emacs@gnu.org; Thu, 08 Oct 2015 21:05:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZkM7K-0002FG-1D for bug-gnu-emacs@gnu.org; Thu, 08 Oct 2015 21:05:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Jay Belanger Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Oct 2015 01:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21648 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 21648-submit@debbugs.gnu.org id=B21648.14443526918612 (code B ref 21648); Fri, 09 Oct 2015 01:05:01 +0000 Original-Received: (at 21648) by debbugs.gnu.org; 9 Oct 2015 01:04:51 +0000 Original-Received: from localhost ([127.0.0.1]:33235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZkM78-0002Ep-Ou for submit@debbugs.gnu.org; Thu, 08 Oct 2015 21:04:51 -0400 Original-Received: from mail-ob0-f169.google.com ([209.85.214.169]:36112) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZkM76-0002Eh-9G for 21648@debbugs.gnu.org; Thu, 08 Oct 2015 21:04:48 -0400 Original-Received: by obcgx8 with SMTP id gx8so51815585obc.3 for <21648@debbugs.gnu.org>; Thu, 08 Oct 2015 18:04:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:reply-to:cc:date:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=cdguX0UnQh5MqMpeKGp8+V0WZf4/2JOL2LXsMDNqx4w=; b=PUwNDqAYU+ZspNBYWF/zzT04jFN5FOmSovCGpC0TqGqaazEzAqw4Zi34kS0gDYMW4p 0Y4fOEwFiN+OR+jZYDE0DzFVnALlwUMgJ6TYI+4Wi23yXL+LKN7nIW//123MfupCpXFM WViHCIYHePaSSI1KUHgU6Rr8WR8oxKBIH6fEyaWS7k0syqdiZRVdrD49AvacaSuOiE+E gcteEy2l4FGQGCgN/4lbeOL3lHjRGIpkeklqFpLmVht0xGFDm6EUknhMic5GPuK8knN5 gTupjHG2GMLwaXkd3us3ktr9nu3ZExON2P8HX7gMPCV4zkkc/c0JkGokaIpuMvZsorO6 zyuQ== X-Received: by 10.182.16.135 with SMTP id g7mr6420957obd.67.1444352687724; Thu, 08 Oct 2015 18:04:47 -0700 (PDT) Original-Received: from belanger-home (67-60-185-108.cpe.cableone.net. [67.60.185.108]) by smtp.gmail.com with ESMTPSA id s127sm20690557oia.21.2015.10.08.18.04.46 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 08 Oct 2015 18:04:46 -0700 (PDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 Xref: news.gmane.org gmane.emacs.bugs:107471 Archived-At: Hi! > =E2=80=8BDone! I have implemented C-u C-y functionality which will prompt= user to enter radix between 2 and 36.=E2=80=8B > >> 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".=E2=80=8B But the data might be fine; the problem is with the radix. >> =E2=80=8BAlso, 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 b= elow 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