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 14:26:07 -0500 Message-ID: <87wpux88mo.fsf@gmail.com> References: <87oag9fim6.fsf@gmail.com> Reply-To: jay.p.belanger@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1444332809 25260 80.91.229.3 (8 Oct 2015 19:33:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 Oct 2015 19:33:29 +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 Thu Oct 08 21:33:16 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 1ZkGwG-0005jj-GQ for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Oct 2015 21:33:16 +0200 Original-Received: from lists.gnu.org ([208.118.235.17]:38250) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkGwE-0003QD-HK for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Oct 2015 15:33:14 -0400 Original-Received: from localhost ([::1]:36729 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkGwE-00039c-Cm for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Oct 2015 15:33:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkGsE-0002ta-T9 for bug-gnu-emacs@gnu.org; Thu, 08 Oct 2015 15:29:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkGsA-0002NB-Sv for bug-gnu-emacs@gnu.org; Thu, 08 Oct 2015 15:29:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44070) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkGsA-0002N7-PU for bug-gnu-emacs@gnu.org; Thu, 08 Oct 2015 15:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZkGsA-00017r-Gr for bug-gnu-emacs@gnu.org; Thu, 08 Oct 2015 15:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jay Belanger Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Oct 2015 19:29:02 +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.14443325204300 (code B ref 21648); Thu, 08 Oct 2015 19:29:02 +0000 Original-Received: (at 21648) by debbugs.gnu.org; 8 Oct 2015 19:28:40 +0000 Original-Received: from localhost ([127.0.0.1]:33041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZkGro-00017H-6x for submit@debbugs.gnu.org; Thu, 08 Oct 2015 15:28:40 -0400 Original-Received: from mail-io0-f171.google.com ([209.85.223.171]:33502) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZkGrl-000179-MX for 21648@debbugs.gnu.org; Thu, 08 Oct 2015 15:28:38 -0400 Original-Received: by iofh134 with SMTP id h134so69655610iof.0 for <21648@debbugs.gnu.org>; Thu, 08 Oct 2015 12:28:37 -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:in-reply-to :message-id:user-agent:mime-version:content-type; bh=kgCYp/sYLYD1VpCaTGRImMbUXBK9BBhuI2oFMfLHTNk=; b=rN+YGokmDDq6O7UVq54zLQ/nwhA/U5XerJxRBqhax1FJcernGCiUFD8UZGvW68tWlM NokK/OrjsvB2cZugXoH4cfy2gXgjwKCuivCFfmt11VyFasiUWrkxjykl0MfpOCHT6SLw /iGS+wTNdWefNj9UynaG4DdvwOwBp6AP38Ri353J9+RsKhaulmWVdKrYMhHDc03duF1j GYb1tjxRVaozU77Pt5YoQ6H0d0L1IYU818dor72/7hPyEe8v5uXhLQIL8M5V+zRdaVmI bc2Egvnfn4BThQd0xLboKOFUNpblraAcex48A5ENV/LYFttFc7lfTVM1SXIbEzIlzco7 NTRQ== X-Received: by 10.107.41.211 with SMTP id p202mr11018984iop.132.1444332517104; Thu, 08 Oct 2015 12:28:37 -0700 (PDT) Original-Received: from vh213601 (vh213601.truman.edu. [150.243.162.59]) by smtp.gmail.com with ESMTPSA id g9sm4237213igg.7.2015.10.08.12.28.35 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 08 Oct 2015 12:28:36 -0700 (PDT) In-Reply-To: (Kaushal Modi's message of "Thu, 8 Oct 2015 12:59:11 -0400") 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-Received-From: 208.118.235.43 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: GNU/Linux 2.6.x Xref: news.gmane.org gmane.emacs.bugs:107458 Archived-At: >> With the patch, if the yanked number already has the radix prefix, there >> is an error. It might make more sense to have Calc do an appropriate >> conversion. > I did not try that case as I meant to use the prefix only when the copied number does > not have a calc-style prefix. But that's a valid point. If the copied number has > calc-style prefix, what should have a higher priority? If the copied number has a calc-style prefix, then the number should be interpreted in that base. I can be entered onto the stack in the new base. That's done now; if Calc is using base 5 and 2#111 is yanked, then 5#12 appears on the stack. > Either way, it will be easy with some string manipulation. You'd probably want Calc to do the conversion. >> It might make more sense to have calc-yank use the current Calc's current radix rather >> than a prefix radix. > I need some clarification for this point. Did you mean that if the > user has set the calc radix to hex by using "d6" and now if they yank > a number "1000" it gets yanked automatically as "16#1000". Yes; that's what I meant. > If yes, I believe it will cause a huge disturbance in the way people > might have already got used to yanking in calc. You are probably right. I would prefer the yanking to pay attention to the current Calc setting, but I really don't like changing age-old behavior. Your method is a good approach. >> Also, the number of radixes in the patch is less than Calc allows. > I assumed the use cases of only the common radixes used in programming. How about I > display a prompt for the user to enter any radix they like (I believe calc supports up > to radix 36) if the prefix is specifically '(4) ( a list prefix created when user uses > C-u specifically for prefix). > > So now, C-2 C-y will prefix the yanked number with "2#". But C-u C-y will show a prompt > where the user will enter radix. If the user entered 9, the prefix appended will be > "9#". Does this option sound fair? Yes; it sounds like a nice approach. And perhaps some sort of message if the entered radix isn't a number from 2 to 36 (the allowed radixes). Thanks again, Jay