From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Brooks Newsgroups: gmane.emacs.bugs Subject: bug#66944: 30.0.50; [PATCH] make calc parse fractions written using U+2044 FRACTION SLASH Date: Sat, 27 Jan 2024 06:26:04 -0800 Message-ID: <877cjuam4j.fsf@db48x.net> References: <87o7g8r4t8.fsf@db48x.net> <87wmsdnrgw.fsf@db48x.net> <861qa39m8g.fsf@gnu.org> <87bk96apkq.fsf@db48x.net> <861qa298qf.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12046"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 66944@debbugs.gnu.org, stefankangas@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 27 15:27:18 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rTjeP-0002sb-51 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 27 Jan 2024 15:27:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTje5-0005ZI-L4; Sat, 27 Jan 2024 09:26:57 -0500 Original-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 1rTje3-0005Yz-Fa for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 09:26:55 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rTje3-0008As-7g for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 09:26:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rTjeA-0001ZB-2q for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 09:27:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Brooks Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 Jan 2024 14:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66944 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66944-submit@debbugs.gnu.org id=B66944.17063655825976 (code B ref 66944); Sat, 27 Jan 2024 14:27:02 +0000 Original-Received: (at 66944) by debbugs.gnu.org; 27 Jan 2024 14:26:22 +0000 Original-Received: from localhost ([127.0.0.1]:53686 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTjdW-0001YJ-22 for submit@debbugs.gnu.org; Sat, 27 Jan 2024 09:26:22 -0500 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:55813) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTjdT-0001Y5-9V for 66944@debbugs.gnu.org; Sat, 27 Jan 2024 09:26:21 -0500 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id F3B435C0179; Sat, 27 Jan 2024 09:26:06 -0500 (EST) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sat, 27 Jan 2024 09:26:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=db48x.net; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1706365566; x=1706451966; bh=2VTHp29idX b1ltkLvGaEdUc3mE1tyfbXukUdrU0lkSc=; b=VCFCwg1A/pBzK3kKWAD1Ju1LYX 7N/g1763G7ByP/hZTxecIExiUPy0P3lOsV/lVyXzgGnHEdenCN695BsBdnO2Nw8M rv2cniMoshGUO5sX2cKEwFVx953Fc9j0VBgsSW0KlOZqwdFtOIYroU3eyp1FWdmT 0R1lVWc2e6lhyQZWmKNNUN/qLysmQcl5gVrHCnlmNyvNxLqkQL5Xtm4IFIZWFyRP FohVbyR/UNgQm70++SysiO5i4OBF5E/sbTuENyp4uhoQ7uTjXPMkGvdFfgrrG6UB 2TGxasqAiw63uiJREgjQ+cnnpEnG57s+aW/bJfyqySs2ofFHXf4scDENoXgw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1706365566; x=1706451966; bh=2VTHp29idXb1ltkLvGaEdUc3mE1t yfbXukUdrU0lkSc=; b=h96qqX1dPvGj1azUYeGmjye8vyDpJ0mM8mt3L4L6Cn4W GFYgucxgj0WKMtm9Dqzh2ZzNdvwHPbida2zu6DmNYFqOkGM8CQVnhUzg3S3UKqvy JCMCeViGP1h8QUFIVX4NtjE7nqofkfnBhQmNRt6I0RioXGEeW1tdABkaOlIG3KHr kU4EDqfkDh+XY/Vp5/9JrtPM4awpxc7MMeRCrB5kzK7xBnNGoXKEYe8jGJZl865M /k7N+/LRdd24rK+Bw3v4F3aoXUkBhyt+lEwHfvVz5lqX8xTntbHrNwwIK1BR+cx1 noUWVNSEae3AxWrrR2ZAqFJ5qV6SUJsxf7uKybOrVg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdelledgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefujghffffkfgggtgesmhdtreertderjeenucfhrhhomhepffgrnhhi vghluceurhhoohhkshcuoegusgegkeigsegusgegkeigrdhnvghtqeenucggtffrrghtth gvrhhnpeefgfevgeetheejgeegveetkedugedugfeuvddugfegvdetkeehtdekvefgfefh geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegusg egkeigsegusgegkeigrdhnvght X-ME-Proxy: Feedback-ID: ie0194691:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 27 Jan 2024 09:26:06 -0500 (EST) In-Reply-To: <861qa298qf.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 27 Jan 2024 16:00:40 +0200") Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGOfPtRkwAAABJQ TFRFpKfbdou67PD6JjJgAwUWXGSeIcyLHgAAAkZJREFUOI1VU8Fy6yAMxLi+Q13fCZ3cnQL3dqTc 7RD+/1feStDXVnXHDuvVSivZTMba2GPdw3gyCGcMAFxTyrTd9dwGoxHiZX9PmRFUHYAQlGGtXY+F Uk0SJOxgJiUEnH1qkitT9D+pQub7qGAmUbR6bu3CvI96Yv6QqkBBMrsyfZccr1/RDXGDTLf4P7ZY glVxe2V+/ACXWO1gvDO9/gDRpFFVmPluvLcmBjd5H6d8DEte+Pbk4rcY/Fa5tLKLOtCZsuQKYhpa LOkYDT7hESya7/WIET3lfQBqX0pwFtbI832Is0ayMUR9B+12xjgPCQ089cfwkCkX6L5TPmRelJTh zMS0Sz1PyjLAMCUWjcmgQLWQMds+e3aaauZDf9dU9A2/8kPVF2odCUoMKHkfjJR+mbgC+DRiycw5 3XSqGe6HmhN/AWjHypkAXOAFW5EiuA1ge2GiZuMb0s1fSEXcATeLUfbyEY2L8yPOmdSsdghQXx3K pz2eoeXuYvMCINVFDrCdNfVUp4eJ6cSEbjbgFjBEvonGGTrgv9cHjAc8aVgSAPoxaONbzfwhDIhR at7IIS7fAGiDSwIA9alhhTBzfA7YM2FY6eMwayrIGK8FDFmshmUA43WqhFtpvoqG9HHaJ7fqtgTz 8EWVkgZgtsylFliHDgk0MB7KAEC45C/rgnGvanNLXyzOeTzcT2nw/N44gfrtYXRQLoz9Q3TgmJRx 2Mx/Q51qzpm+l3m8z2SWBqC5+PZXAtNYlGFf/gKfHfjFkDT4x7od7R+w3Ls+ZdQBuQAAAABJRU5E rkJggg== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:279005 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: > Thanks, but I'm not sure @U{HEX} will always work in the printed > output. Did you try to say "make calc.pdf" in doc/emisc/? If not, > can you try that? No, I hadn=E2=80=99t, and no, it doesn=E2=80=99t work. > If you see errors about @U when generating PDF format, we will need to > make use of @U conditional by using @ifnottex, and in @iftex case omit > the @U{HEX} parts. I certainly can do that, but it is super disappointing. Apparently it supports some unicode characters but not all of them. Do you know if it is hard to make it support new ones? db48x --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-Calc-parses-fractions-written-using-U-2044-FRACTION-.patch Content-Transfer-Encoding: quoted-printable Content-Description: third =?utf-8?Q?time=E2=80=99s?= the charm >From 616f49fc8c8384ba47acb69c1bb3ac495c6ada57 Mon Sep 17 00:00:00 2001 From: Daniel Brooks Date: Sun, 5 Nov 2023 01:03:37 -0700 Subject: [PATCH] Calc parses fractions written using U+2044 FRACTION SLASH MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit Fractions of the form 123=E2=81=84456 are handled as if written 123:456. No= te in particular the difference in behavior from U+2215 DIVISION SLASH and U+002F SOLIDUS, which result in division rather than a rational fraction. * lisp/calc/calc-aent.el (math-read-replacement-list): Substitute a colon for any fraction slash. * test/lisp/calc/calc-tests.el (calc-frac-input): Test various fraction types. * doc/misc/calc.texi (Fractions): Mention fraction slash, precomposed fractions. Copyright-paperwork-exempt: yes --- doc/misc/calc.texi | 16 ++++++++++++++++ etc/NEWS | 11 ++++++++++- lisp/calc/calc-aent.el | 1 + test/lisp/calc/calc-tests.el | 25 +++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index c651b007173..e386d6664aa 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi @@ -10571,6 +10571,22 @@ Fractions @samp{@var{radix}#@var{num}:@var{denom}} (or in the analogous three-part form). The numerator and denominator always use the same radix. =20 +@ifnottex +Fractions may also be entered with @kbd{@U{2044}} (U+2044 FRACTION +SLASH) in place of any @kbd{:}. Precomposed fraction characters from +@kbd{@U{00BD}} (U+00BD VULGAR FRACTION ONE HALF) through +@kbd{@U{215E}} (U+215E VULGAR FRACTION SEVEN EIGHTHS) as supported as +well. Thus @samp{2:3}, @samp{2@U{2044}3}, and @samp{@U{2154}} are all +equivalent. +@end ifnottex +@iftex +Fractions may also be entered with U+2044 FRACTION SLASH in place of +any @kbd{:}. Precomposed fraction characters from U+00BD VULGAR +FRACTION ONE HALF through U+215E VULGAR FRACTION SEVEN EIGHTHS as +supported as well. +@end iftex + + @node Floats @section Floats =20 diff --git a/etc/NEWS b/etc/NEWS index e29a787a0cc..2b3741fb5dc 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -983,7 +983,16 @@ URIs are now prefixed with "https://" instead. +++ *** New command 'customize-dirlocals'. This command pops up a buffer to edit the settings in ".dir-locals.el". - +** Calc ++++ +*** Calc parses fractions written using U+2044 FRACTION SLASH +Fractions of the form 123=E2=81=84456 are handled as if written 123:456. = Note +in particular the difference in behavior from U+2215 DIVISION SLASH +and U+002F SOLIDUS, which result in division rather than a rational +fraction. You may also be interested to know that precomposed +fraction characters, such as =C2=BD (U+00BD VULGAR FRACTION ONE HALF), are +also recognized as rational fractions. They have been since 2004, but +it looks like it was never mentioned in the NEWS, or even the manual. * New Modes and Packages in Emacs 30.1 =20 diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el index 66ede3295ae..1dcb9ad1c85 100644 --- a/lisp/calc/calc-aent.el +++ b/lisp/calc/calc-aent.el @@ -505,6 +505,7 @@ math-read-replacement-list ("=E2=85=9D" "(5:8)") ; 5/8 ("=E2=85=9E" "(7:8)") ; 7/8 ("=E2=85=9F" "1:") ; 1/... + ("=E2=81=84" ":") ; arbitrary fractions of the form 123=E2=81=84456 ;; superscripts ("=E2=81=B0" "0") ; 0 ("=C2=B9" "1") ; 1 diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el index 5b11dd950ba..e724295e8e0 100644 --- a/test/lisp/calc/calc-tests.el +++ b/test/lisp/calc/calc-tests.el @@ -734,6 +734,31 @@ calc-latex-input (var c var-c)))))) (calc-set-language nil))) =20 +(ert-deftest calc-frac-input () + ;; precomposed fraction + (should (equal (math-read-expr "=C2=BD") + '(frac 1 2))) + ;; ascii solidus + (should (equal (math-read-expr "123/456") + '(/ 123 456))) + (should (equal (math-read-expr "a/b") + '(/ (var a var-a) (var b var-b)))) + ;; fraction slash + (should (equal (math-read-expr "123=E2=81=84456") + '(frac 41 152))) + (should (equal (math-read-expr "a=E2=81=84b") + '(error 1 "Syntax error"))) + ;; division slash + (should (equal (math-read-expr "123=E2=88=95456") + '(/ 123 456))) + (should (equal (math-read-expr "a=E2=88=95b") + '(/ (var a var-a) (var b var-b)))) + ;; division sign + (should (equal (math-read-expr "123=C3=B7456") + '(frac 41 152))) + (should (equal (math-read-expr "a=C3=B7b") ; I think this one is wrong + '(error 1 "Syntax error")))) + (defvar var-g) =20 ;; Test `let'. --=20 2.43.0 --=-=-=--