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?").
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
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
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.
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
> You can also use @<<< to mean the second row
Did you mean @<<
?
Yours,
Christian
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
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
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
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