emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Timothy <tecosaur@gmail.com>
To: tbanelwebmin <tbanelwebmin@free.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] bad table formula recorded in some cases
Date: Wed, 21 Jul 2021 18:50:59 +0800	[thread overview]
Message-ID: <8735s8rld9.fsf@gmail.com> (raw)
In-Reply-To: <43910853-03cb-c226-f46d-4736d0e6cca6@free.fr>


Hi Thierry,

Thanks for this! Looking at the change you suggest, do you know why the
(match-string 2) bit might have been added in the first place? I'm just
wondering if there might be some edge-case adversely affected by this ---
hence trading one bug for another :P

--
Timothy

tbanelwebmin <tbanelwebmin@free.fr> writes:

> Small bug, small fix.
>
> Suppose we have a table embedded in a begin-end block.
>
> #+begin: aaa :param value
> | a | b |
> | a | b |
> #+end:
>
> Suppose we want to add a formula, with C-c =
> We end up with an incorrect result:
>
> #+begin: aaa :param value
> | a | 33 |
> | a |  b |
>  :param value $2=33
> #+end:
>
> The fix: in org-table.el, line 2177, change
>   (insert (or (match-string 2) "#+TBLFM:")))
> to
>   (insert "#+TBLFM:"))
>
> Then we get the correct result:
>
> #+begin: aaa :param value
> | a | 33 |
> | a |  b |
> #+TBLFM: $2=33
> #+end:
>
> Why? Because (match-string 2) is supposed to refer to the (looking-at)
> instruction 7 lines above. But (match-string 2) is in the else branch,
> which means that (looking-at) failed. Therefore (match-string 2) returns
> garbage.
>
> Thanks to Uwe Brauer for pointing to this bug.


  reply	other threads:[~2021-07-21 10:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 16:04 [PATCH] bad table formula recorded in some cases tbanelwebmin
2021-07-21 10:50 ` Timothy [this message]
2021-07-21 14:25   ` tbanelwebmin
2021-07-21 15:07     ` Timothy
2021-07-21 18:37       ` tbanelwebmin
2021-09-26  6:55 ` Bastien

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8735s8rld9.fsf@gmail.com \
    --to=tecosaur@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tbanelwebmin@free.fr \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).