all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Raffael Stocker <r.stocker@mnet-mail.de>
To: "Mattias Engdegård" <mattias.engdegard@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	67536@debbugs.gnu.org
Subject: bug#67536: 29.1; Calc mode's math-read-preprocess-string conses unnecessarily
Date: Sat, 02 Dec 2023 20:26:58 +0100	[thread overview]
Message-ID: <yplmmsusbdf4.fsf@mnet-mail.de> (raw)
In-Reply-To: <D46D30D0-C7A5-49F3-86BD-143D52AE475A@gmail.com>


Mattias Engdegård <mattias.engdegard@gmail.com> writes:

> There are minor points that could be addressed: `mapc` is often better
> replaced with `dolist`;

Is this the case? As ‘mapc’ is implemented directly in C and ‘dolist’
falls back to ‘while’, I thought it would be the other way around.  But
of course I never compared them.

> the first position of a buffer is 1, not 0;

Yes, I could have done that one better.  I was to lazy to check...

> and perhaps iterating through all elements of math-read-replacement-list isn't ideal.
> Here's a variant which computes a single regexp to do the job and should cons a bit less.

I thought about the possibility of doing this, but I didn't want to open
that can of worms.  Not iterating definitely sounds right, though.

However, I checked your proposed version and there is an issue with
replacement of sub- and superscripts.  Here are a few test strings I
used on my version, with the comparison strings supplied by the
original:

--8<---------------cut here---------------start------------->8---
(string= (math-read-preprocess-string "±⁷⁽⁽⁽⁽₄₄ds₇⅟⅟l⅛⅛µ3¾⁶⁴₍∞≤")
         "+/-^(7(((()_(44)ds_(7)1:1:l(1:8)(1:8)μ3(3:4)^(64)_(()inf<=")
(string= (math-read-preprocess-string "dsfjlsajflk klfsld flsd fkls fkl jfjls")
         "dsfjlsajflk klfsld flsd fkls fkl jfjls")
(string= (math-read-preprocess-string "") "")
--8<---------------cut here---------------end--------------->8---

The last two tests work fine (as there are no replacements), but for the
first, your function produces this incorrect result:

"+/-^(7)^(()^(()^(()^(()_(4)_(4)ds_(7)1:1:l(1:8)(1:8)μ3(3:4)^(6)^(4)_(()inf<="

> Raffael, maybe you could see if this makes a difference in Org table performance.

I'm looking forward to doing so.

Regards,
Raffael





  reply	other threads:[~2023-12-02 19:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29 21:29 bug#67536: 29.1; Calc mode's math-read-preprocess-string conses unnecessarily Raffael Stocker
2023-11-30  7:00 ` Eli Zaretskii
2023-11-30 18:28   ` Raffael Stocker
2023-11-30 19:14     ` Eli Zaretskii
2023-12-01 17:34       ` Raffael Stocker
2023-12-01 18:12         ` Eli Zaretskii
2023-12-01 21:10           ` Raffael Stocker
2023-12-02  8:03             ` Eli Zaretskii
2023-12-02 14:56               ` Mattias Engdegård
2023-12-02 19:26                 ` Raffael Stocker [this message]
2023-12-03 10:43                   ` Mattias Engdegård
2023-12-03 11:13                     ` Raffael Stocker
2023-12-03 11:58                       ` Mattias Engdegård
2023-12-05 18:14                     ` Raffael Stocker
2023-12-16  9:40                       ` Eli Zaretskii
2023-12-18 10:55                         ` Mattias Engdegård
2023-12-18 11:39                           ` Raffael Stocker
2023-12-19 16:16                             ` Mattias Engdegård
2023-12-19 17:09                               ` Raffael Stocker
2023-12-19 18:15                                 ` Mattias Engdegård

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=yplmmsusbdf4.fsf@mnet-mail.de \
    --to=r.stocker@mnet-mail.de \
    --cc=67536@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=mattias.engdegard@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /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.