emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Corrupted TBLFM after table edit
@ 2014-01-09  7:01 Michael Brand
  2014-01-09 10:03 ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Brand @ 2014-01-09  7:01 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode

Hi all

If you use release_8.2.4-14-geb28fe4 or newer and are using Org table
spreadsheet #+TBLFM then downgrade your Org version before editing
tables. In the files where you already edited a table with such an Org
release check all #+TBLFM in that file for corruption as shown below.


Hi Bastien

The change for release_8.2.4-14-geb28fe4

    commit eb28fe41dc5517e2f1d4d782eb0b5da08b90af53
    Author: Bastien Guerry <bzg@altern.org>
    Date:   Sun Dec 22 10:09:53 2013 +0100

      org-table.el (ogr-table-fix-formulas): Handle multiple #+tblfm: lines

on maint and master corrupts #+TBLFM when e. g. swapping the columns c
and d with M-<left>/M-<right> by changing $1 and $2 also in all tables
below the edit.

* ab
  | a | b |
  |---+---|
  | 0 | 1 |
  #+TBLFM: $2 = $1 + 1
* cd
  | c | d |
  |---+---|
  | 2 | 3 |
  #+TBLFM: $2 = $1 + 1
* ef
  | e | f |
  |---+---|
  | 4 | 5 |
  #+TBLFM: $2 = $1 + 1
* gh
  | g | h |
  |---+---|
  | 6 | 7 |
  #+TBLFM: $2 = $1 + 1

Michael

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Corrupted TBLFM after table edit
  2014-01-09  7:01 Corrupted TBLFM after table edit Michael Brand
@ 2014-01-09 10:03 ` Bastien
  2014-01-09 11:04   ` Michael Brand
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2014-01-09 10:03 UTC (permalink / raw)
  To: Michael Brand; +Cc: Org Mode

Hi Michael,

Michael Brand <michael.ch.brand@gmail.com> writes:

> If you use release_8.2.4-14-geb28fe4 or newer and are using Org table
> spreadsheet #+TBLFM then downgrade your Org version before editing
> tables. In the files where you already edited a table with such an Org
> release check all #+TBLFM in that file for corruption as shown
> below.

This is now fixed, thanks.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Corrupted TBLFM after table edit
  2014-01-09 10:03 ` Bastien
@ 2014-01-09 11:04   ` Michael Brand
  2014-01-09 11:14     ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Brand @ 2014-01-09 11:04 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode

Hi Bastien

On Thu, Jan 9, 2014 at 11:03 AM, Bastien <bzg@gnu.org> wrote:
> This is now fixed, thanks.

The release_8.2.5c-8-ga2619b7 this refers to solves only a part of the
bugs introduced with the greedy (re-search-forward "^\\S-*$\\|\\'" nil
t). It does not work before the first headline, does not cover #+TBLFM
in list items etc. without end.

I suggest to solve this completely differently by replacing the greedy
(re-search-forward "^\\S-*$\\|\\'" nil t) and not using s-end any
more. I would change the "while" to

    (while (let ((case-fold-search t)) (looking-at "[ \t]*#\\+tblfm:"))
      [...]
      (forward-line))

which is simple and water-proof.

Michael

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Corrupted TBLFM after table edit
  2014-01-09 11:04   ` Michael Brand
@ 2014-01-09 11:14     ` Bastien
  2014-01-09 19:17       ` Michael Brand
  0 siblings, 1 reply; 5+ messages in thread
From: Bastien @ 2014-01-09 11:14 UTC (permalink / raw)
  To: Michael Brand; +Cc: Org Mode

Hi Michael,

Michael Brand <michael.ch.brand@gmail.com> writes:

> I suggest to solve this completely differently by replacing the greedy
> (re-search-forward "^\\S-*$\\|\\'" nil t) and not using s-end any
> more. I would change the "while" to
>
>     (while (let ((case-fold-search t)) (looking-at "[ \t]*#\\+tblfm:"))
>       [...]
>       (forward-line))
>
> which is simple and water-proof.

Yes, sure, please go ahead -- thanks in advance,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Corrupted TBLFM after table edit
  2014-01-09 11:14     ` Bastien
@ 2014-01-09 19:17       ` Michael Brand
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Brand @ 2014-01-09 19:17 UTC (permalink / raw)
  To: Bastien; +Cc: Org Mode

Hi Bastien

On Thu, Jan 9, 2014 at 12:14 PM, Bastien <bzg@altern.org> wrote:
> Michael Brand <michael.ch.brand@gmail.com> writes:
>> I suggest to solve this completely differently by replacing the greedy
>> (re-search-forward "^\\S-*$\\|\\'" nil t) and not using s-end any
>> more. I would change the "while" to
>>
>>     (while (let ((case-fold-search t)) (looking-at "[ \t]*#\\+tblfm:"))
>>       [...]
>>       (forward-line))
>>
>> which is simple and water-proof.
>
> Yes, sure, please go ahead -- thanks in advance,

Done.

Michael

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-09 19:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-09  7:01 Corrupted TBLFM after table edit Michael Brand
2014-01-09 10:03 ` Bastien
2014-01-09 11:04   ` Michael Brand
2014-01-09 11:14     ` Bastien
2014-01-09 19:17       ` Michael Brand

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).