emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Table formula changes are not always necessary when moving rows
@ 2011-02-28 11:43 Tom
  2011-03-05 22:40 ` Bastien
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Tom @ 2011-02-28 11:43 UTC (permalink / raw)
  To: emacs-orgmode

I have a table in which I sum the values of all rows in the last
row: vsum(@1..@-I-1). The problem is when move a row with M-up
before the first row (e.g. I press M-up on the second row) then
org modifies this formula to vsum(@2..@-I-1).

This is not always the expected behavior, because in this case I
just want to move the data in the rows, but still want to sum the
values of all the rows from the first to the last. A similar case
is when I want to insert a row before the first row of such a
table. In that case too the formulas should be left alone,
because I still want to sum all the rows, including the newly
inserted first row.

In such cases when the formula is modified Org should either
print warning to the echo area, so the user notices when the
formulas are changing because of the move, or it should ask the
user what to do ("do you want to modify the formulas?").

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

* Re: Table formula changes are not always necessary when moving rows
  2011-02-28 11:43 Table formula changes are not always necessary when moving rows Tom
@ 2011-03-05 22:40 ` Bastien
  2011-03-07 17:53 ` Carsten Dominik
  2011-03-17  6:03 ` Carsten Dominik
  2 siblings, 0 replies; 10+ messages in thread
From: Bastien @ 2011-03-05 22:40 UTC (permalink / raw)
  To: Tom; +Cc: emacs-orgmode

Hi Tom,

Tom <adatgyujto@gmail.com> writes:

> In such cases when the formula is modified Org should either
> print warning to the echo area, so the user notices when the
> formulas are changing because of the move, or it should ask the
> user what to do ("do you want to modify the formulas?").

I've added `org-table-fix-formulas-confirm': set it yo 'y-or-n-p 
if you want to manually confirm formulas fixes.

It defaults to nil, as I think the default behavior is the most 
expected one.

For the record, for temporarily avoid formulas fixes, I think it's
quicker to just add a "#" to #+TBLFM -- so the ##+TBLFM line won't
be affected by editing the structure of the table.

HTH,

-- 
 Bastien

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

* Re: Table formula changes are not always necessary when moving rows
  2011-02-28 11:43 Table formula changes are not always necessary when moving rows Tom
  2011-03-05 22:40 ` Bastien
@ 2011-03-07 17:53 ` Carsten Dominik
  2011-03-07 18:38   ` Tom
  2011-03-17  6:03 ` Carsten Dominik
  2 siblings, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2011-03-07 17:53 UTC (permalink / raw)
  To: Tom; +Cc: emacs-orgmode


On 28.2.2011, at 12:43, Tom wrote:

> I have a table in which I sum the values of all rows in the last
> row: vsum(@1..@-I-1). The problem is when move a row with M-up
> before the first row (e.g. I press M-up on the second row) then
> org modifies this formula to vsum(@2..@-I-1).
> 
> This is not always the expected behavior, because in this case I
> just want to move the data in the rows, but still want to sum the
> values of all the rows from the first to the last. A similar case
> is when I want to insert a row before the first row of such a
> table. In that case too the formulas should be left alone,
> because I still want to sum all the rows, including the newly
> inserted first row.
> 
> In such cases when the formula is modified Org should either
> print warning to the echo area, so the user notices when the
> formulas are changing because of the move, or it should ask the
> user what to do ("do you want to modify the formulas?").

Aside to Bastien's help for this issue, a variable that will
prompt you before the formulas are rewritten, consider this:
Most of the time is should be possible to rewrite the formula
in a stable way.  You did not show your example, but from the
formula I would assume that you start the table immediately
with data, without a header line org a horizontal separator line.
If you did, you could do vsum(@I..II) and have a formula that is
stable against row switches.

Hope this helps.

- Carsten

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

* Re: Table formula changes are not always necessary when moving rows
  2011-03-07 17:53 ` Carsten Dominik
@ 2011-03-07 18:38   ` Tom
  0 siblings, 0 replies; 10+ messages in thread
From: Tom @ 2011-03-07 18:38 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik <at> gmail.com> writes:
>  You did not show your example, but from the
> formula I would assume that you start the table immediately
> with data, without a header line org a horizontal separator line.
> If you did, you could do vsum(@I..II) and have a formula that is
> stable against row switches.
>

No, I do have a header and separator lines in the table I only 
simplified the  formula for the sake of the example.

But I didn't know about this @I syntax. It looks like I can use it
to specify the formulas relative to separator lines in the table, 
so it probably solves the problem.

Thanks.

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

* Re: Table formula changes are not always necessary when moving rows
  2011-02-28 11:43 Table formula changes are not always necessary when moving rows Tom
  2011-03-05 22:40 ` Bastien
  2011-03-07 17:53 ` Carsten Dominik
@ 2011-03-17  6:03 ` Carsten Dominik
  2011-03-17 10:02   ` Christian Moe
                     ` (2 more replies)
  2 siblings, 3 replies; 10+ messages in thread
From: Carsten Dominik @ 2011-03-17  6:03 UTC (permalink / raw)
  To: Tom; +Cc: emacs-orgmode


On 28.2.2011, at 12:43, Tom wrote:

> I have a table in which I sum the values of all rows in the last
> row: vsum(@1..@-I-1). The problem is when move a row with M-up
> before the first row (e.g. I press M-up on the second row) then
> org modifies this formula to vsum(@2..@-I-1).


Hi Tom,

I have thought a bit more about this issue.  I do agree that,
in particular when specifying ranges, it may not always
desirable to have the formulas automatically adapt when
rows and columns are swapped.

I have just pushed a change that makes $< and @< refer in
a stable way to the first column and row, respectively.
You can also use @<<< to mean the second row and @>>
the second to last row.

I hope this will prove to be useful for such cases.

Regards

P.S. Nick (Dokos), I also added them to get the symmetry with
the @> and $> references :)

> 
> This is not always the expected behavior, because in this case I
> just want to move the data in the rows, but still want to sum the
> values of all the rows from the first to the last. A similar case
> is when I want to insert a row before the first row of such a
> table. In that case too the formulas should be left alone,
> because I still want to sum all the rows, including the newly
> inserted first row.
> 
> In such cases when the formula is modified Org should either
> print warning to the echo area, so the user notices when the
> formulas are changing because of the move, or it should ask the
> user what to do ("do you want to modify the formulas?").
> 
> 
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Table formula changes are not always necessary when moving rows
  2011-03-17  6:03 ` Carsten Dominik
@ 2011-03-17 10:02   ` Christian Moe
  2011-03-17 11:23     ` Carsten Dominik
  2011-03-17 14:15   ` Nick Dokos
  2011-03-20  8:48   ` Achim Gratz
  2 siblings, 1 reply; 10+ messages in thread
From: Christian Moe @ 2011-03-17 10:02 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode, Tom



> You can also use @<<<  to mean the second row

Did you mean @<<
?

Yours,
Christian

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

* Re: Table formula changes are not always necessary when moving rows
  2011-03-17 10:02   ` Christian Moe
@ 2011-03-17 11:23     ` Carsten Dominik
  0 siblings, 0 replies; 10+ messages in thread
From: Carsten Dominik @ 2011-03-17 11:23 UTC (permalink / raw)
  To: mail; +Cc: emacs-orgmode, Tom


On Mar 17, 2011, at 11:02 AM, Christian Moe wrote:

> 
> 
>> You can also use @<<<  to mean the second row
> 
> Did you mean @<<

No, I meant "third" :D

> ?
> 
> Yours,
> Christian

- Carsten

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

* Re: Table formula changes are not always necessary when moving rows
  2011-03-17  6:03 ` Carsten Dominik
  2011-03-17 10:02   ` Christian Moe
@ 2011-03-17 14:15   ` Nick Dokos
  2011-03-20  8:48   ` Achim Gratz
  2 siblings, 0 replies; 10+ messages in thread
From: Nick Dokos @ 2011-03-17 14:15 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: nicholas.dokos, emacs-orgmode, Tom

Carsten Dominik <carsten.dominik@gmail.com> wrote:

> 
> On 28.2.2011, at 12:43, Tom wrote:
> 
> > I have a table in which I sum the values of all rows in the last
> > row: vsum(@1..@-I-1). The problem is when move a row with M-up
> > before the first row (e.g. I press M-up on the second row) then
> > org modifies this formula to vsum(@2..@-I-1).
> 
> 
> Hi Tom,
> 
> I have thought a bit more about this issue.  I do agree that,
> in particular when specifying ranges, it may not always
> desirable to have the formulas automatically adapt when
> rows and columns are swapped.
> 
> I have just pushed a change that makes $< and @< refer in
> a stable way to the first column and row, respectively.
> You can also use @<<< to mean the second row and @>>
> the second to last row.
> 

I hope you mean @<< above: otherwise the symmetry is spoiled :-)

> I hope this will prove to be useful for such cases.
> 
> Regards
> 
> P.S. Nick (Dokos), I also added them to get the symmetry with
> the @> and $> references :)
> 
And a thing of beauty it is, too! ;-)

Much appreciated,
Nick

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

* Re: Table formula changes are not always necessary when moving rows
  2011-03-17  6:03 ` Carsten Dominik
  2011-03-17 10:02   ` Christian Moe
  2011-03-17 14:15   ` Nick Dokos
@ 2011-03-20  8:48   ` Achim Gratz
  2011-03-20  9:06     ` Carsten Dominik
  2 siblings, 1 reply; 10+ messages in thread
From: Achim Gratz @ 2011-03-20  8:48 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:
> I have just pushed a change that makes $< and @< refer in
> a stable way to the first column and row, respectively.
> You can also use @<<< to mean the second row and @>>
> the second to last row.

Commit 3dd47457 has introduced a complaint about an assignment to free
variable "char" (which actally happens in setq).  I think the fix would
be to add "char" to the preceding let clause.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Waldorf MIDI Implementation & additional documentation:
http://Synth.Stromeko.net/Downloads.html#WaldorfDocs

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

* Re: Re: Table formula changes are not always necessary when moving rows
  2011-03-20  8:48   ` Achim Gratz
@ 2011-03-20  9:06     ` Carsten Dominik
  0 siblings, 0 replies; 10+ messages in thread
From: Carsten Dominik @ 2011-03-20  9:06 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode


On 20.3.2011, at 09:48, Achim Gratz wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> I have just pushed a change that makes $< and @< refer in
>> a stable way to the first column and row, respectively.
>> You can also use @<<< to mean the second row and @>>
>> the second to last row.
> 
> Commit 3dd47457 has introduced a complaint about an assignment to free
> variable "char" (which actally happens in setq).  I think the fix would
> be to add "char" to the preceding let clause.

Indeed, thanks.

- Carsten

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

end of thread, other threads:[~2011-03-20  9:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-28 11:43 Table formula changes are not always necessary when moving rows Tom
2011-03-05 22:40 ` Bastien
2011-03-07 17:53 ` Carsten Dominik
2011-03-07 18:38   ` Tom
2011-03-17  6:03 ` Carsten Dominik
2011-03-17 10:02   ` Christian Moe
2011-03-17 11:23     ` Carsten Dominik
2011-03-17 14:15   ` Nick Dokos
2011-03-20  8:48   ` Achim Gratz
2011-03-20  9:06     ` Carsten Dominik

Code repositories for project(s) associated with this 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).