Re: [O] [Orgmode] Re: [Feature Request] Cross headings in tables

2011-06-07 Thread Achim Gratz
Carsten Dominik carsten.domi...@gmail.com writes:
 I think a better strategy would be to find these additional
 header lines right before this section of the recalculate function:

 ;; Now evaluate the column formulas, but skip fields covered by
 ;; field formulas

 and mark those extra header lines with the org-untouchable text property.
 Then you can let the column formulas do their game, and fields marked
 by this property will automatically exempted..

I just did that (and fixing a bug with the :org-untouchable property not
being removed in certain circumstances which you might want to commit to
master upfront).  It looks much cleaner, see if you like it, too.  I've
also cleaned up all the commit messages, I hope they conform to the
standard now.

 Another part which might need a look to support this
 would be `orgtbl-to-generic'.

That I will have to think over a bit.  This support depends on parsing
the table into a list (AFAIK) and that currently treats cross headings
as another sort of hlines.  Changing this has a lot of repercussions
elsewhere in the code as far as I can see.  It might be an opportunity
to re-factor some of the code that still works on the text
representation, but that is certainly not something that I'd take
lightly.


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

Samples for the Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#BlofeldSamplesExtra




Re: [O] [Orgmode] Re: [Feature Request] Cross headings in tables

2011-06-02 Thread Carsten Dominik

On 31.5.2011, at 20:01, Achim Gratz wrote:

 Hi Carsten,
 
 Carsten Dominik carsten.domi...@gmail.com writes:
 I think a better strategy would be to find these additional
 header lines right before this section of the recalculate function:
 [...]
 
 I'll have a look (probably not today), but I'd rather tag them with an
 org-header property and arrange it so that this can be used in other
 places as well.

This property is not attached to these lines for long - it is just 
a temporary way of marking fields that should not be overwritten
by column formulas.  The property is added, and also removed
again (I think) during the recalculation process.

 
 Another part which might need a look to support this
 would be `orgtbl-to-generic'.
 
 Noted.
 
 Finally:  this patch goes clearly beyond the TINYCHANGE
 limits.  What is yours, and Lawrence's copyright status with the FSF?
 
 My status with the FSF is succinctly and fully characterized as
 non-existing.  I've sent that mail form to the FSF and I'll see what
 happens next — it seems I'll get snail mail in a few weeks?

Thank you.  Please let us know when the process gets stuck or completes.

- Carsten




Re: [O] [Orgmode] Re: [Feature Request] Cross headings in tables

2011-05-31 Thread Carsten Dominik
Hi Achim,

On 30.5.2011, at 23:02, Achim Gratz wrote:

 Hi Carsten,
 
 Carsten Dominik carsten.domi...@gmail.com writes:
 this looks pretty good.  One thing I found missing is that
 header lines should be exempted from column formulas being
 applied.  This works for the headlines at the top of the
 table, but not in the middle.
 
 thank you for having a look.  You are right, but this looks like
 something that goes a bit deeper than my current understanding, I'm
 afraid.
 
 Header lines don't appear to be marked in any way, but simply skipped
 over before starting the formula calculation.  Consequently, the column
 formula is evaluated for any header line when doing a C-c * directly in
 the header, which might be considered a bug.  I won't touched this
 aspect of the code since it will probably have farther reaching
 consequences if changed.  I quickly hacked in some extra stuff that
 looks for cross headers and skips them while the full table is updated —
 but I'm not sure this is the right thing to do and the way the program
 logic works requires me to check certain pathological cases twice, which
 is a bit ugly.  I've just rebased against current master and pushed
 everything back to the repo.

I think a better strategy would be to find these additional
header lines right before this section of the recalculate function:

;; Now evaluate the column formulas, but skip fields covered by
;; field formulas

and mark those extra header lines with the org-untouchable text property.
Then you can let the column formulas do their game, and fields marked
by this property will automatically exempted..

 
 Also documentation in the manual is missing - one
 or two sentences in the right place should be enough.
 
 Sure, but I'd like to get it working correctly first. :-)

Fair enough.

 I'm using this code at work and things have gone smoothly, but I only
 use the HTML backend and certainly don't exercise the full breadth of
 the table functionality (obviously no column formulas were used by me,
 for instance).

Another part which might need a look to support this
would be `orgtbl-to-generic'.

 While testing I stumbled upon this: if a buffer has no undo information
 associated, org-self-insert-command produces an error while trying to
 edit the formula.  This code path may need to be protected against this
 (admittedly rare) case, I've been triggering it while testing your
 example directly in the gnus article buffer.

This issue is fixed, thanks for the report.

Finally:  this patch goes clearly beyond the TINYCHANGE
limits.  What is yours, and Lawrence's copyright status with the FSF?

- Carsten

 
 Debugger entered--Lisp error: (wrong-type-argument listp t)
 cadr(t)
 (not (cadr buffer-undo-list))
 (and ( org-self-insert-command-undo-counter 0) buffer-undo-list (not (cadr 
 buffer-undo-list)) (setcdr buffer-undo-list (cddr buffer-undo-list)))
 (if (= org-self-insert-command-undo-counter 20) (setq 
 org-self-insert-command-undo-counter 1) (and ( 
 org-self-insert-command-undo-counter 0) buffer-undo-list (not ...) (setcdr 
 buffer-undo-list ...)) (setq org-self-insert-command-undo-counter (1+ 
 org-self-insert-command-undo-counter)))
 (if (not (eq last-command ...)) (setq org-self-insert-command-undo-counter 1) 
 (if (= org-self-insert-command-undo-counter 20) (setq 
 org-self-insert-command-undo-counter 1) (and ... buffer-undo-list ... ...) 
 (setq org-self-insert-command-undo-counter ...)))
 (if org-self-insert-cluster-for-undo (if (not ...) (setq 
 org-self-insert-command-undo-counter 1) (if ... ... ... ...)))
 (cond ((and org-use-speed-commands ...) (cond ... ... ... ...)) ((and ... ... 
 ... ...) (let ... ... ... ... ...)) (t (setq org-table-may-need-update t) 
 (self-insert-command N) (org-fix-tags-on-the-fly) (if 
 org-self-insert-cluster-for-undo ...)))
 org-self-insert-command(1)
 
 
 Regards
 Achim.
 -- 
 +[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]+
 
 Factory and User Sound Singles for Waldorf Blofeld:
 http://Synth.Stromeko.net/Downloads.html#WaldorfSounds
 
 




Re: [O] [Orgmode] Re: [Feature Request] Cross headings in tables

2011-05-31 Thread Lawrence Mitchell
On 31/05/2011 08:21, Carsten Dominik wrote:

[...]

 Finally:  this patch goes clearly beyond the TINYCHANGE
 limits.  What is yours, and Lawrence's copyright status with the FSF?

I have papers with the FSF for past and future changes to Emacs, so I
believe my contributions are covered.

Lawrence



Re: [O] [Orgmode] Re: [Feature Request] Cross headings in tables

2011-05-31 Thread Achim Gratz
Hi Carsten,

Carsten Dominik carsten.domi...@gmail.com writes:
 I think a better strategy would be to find these additional
 header lines right before this section of the recalculate function:
[...]

I'll have a look (probably not today), but I'd rather tag them with an
org-header property and arrange it so that this can be used in other
places as well.

 Another part which might need a look to support this
 would be `orgtbl-to-generic'.

Noted.

 Finally:  this patch goes clearly beyond the TINYCHANGE
 limits.  What is yours, and Lawrence's copyright status with the FSF?

My status with the FSF is succinctly and fully characterized as
non-existing.  I've sent that mail form to the FSF and I'll see what
happens next — it seems I'll get snail mail in a few weeks?


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

SD adaptations for KORG EX-800 and Poly-800MkII V0.9:
http://Synth.Stromeko.net/Downloads.html#KorgSDada




Re: [O] [Orgmode] Re: [Feature Request] Cross headings in tables

2011-05-31 Thread Jambunathan K

 My status with the FSF is succinctly and fully characterized as
 non-existing.  I've sent that mail form to the FSF and I'll see what
 happens next ― it seems I'll get snail mail in a few weeks?

In my case the process took close to 4 months. 

Jambunathan K.

-- 



Re: [O] [Orgmode] Re: [Feature Request] Cross headings in tables

2011-05-30 Thread Achim Gratz
Hi Carsten,

Carsten Dominik carsten.domi...@gmail.com writes:
 this looks pretty good.  One thing I found missing is that
 header lines should be exempted from column formulas being
 applied.  This works for the headlines at the top of the
 table, but not in the middle.

thank you for having a look.  You are right, but this looks like
something that goes a bit deeper than my current understanding, I'm
afraid.

Header lines don't appear to be marked in any way, but simply skipped
over before starting the formula calculation.  Consequently, the column
formula is evaluated for any header line when doing a C-c * directly in
the header, which might be considered a bug.  I won't touched this
aspect of the code since it will probably have farther reaching
consequences if changed.  I quickly hacked in some extra stuff that
looks for cross headers and skips them while the full table is updated —
but I'm not sure this is the right thing to do and the way the program
logic works requires me to check certain pathological cases twice, which
is a bit ugly.  I've just rebased against current master and pushed
everything back to the repo.

 Also documentation in the manual is missing - one
 or two sentences in the right place should be enough.

Sure, but I'd like to get it working correctly first. :-)

I'm using this code at work and things have gone smoothly, but I only
use the HTML backend and certainly don't exercise the full breadth of
the table functionality (obviously no column formulas were used by me,
for instance).

While testing I stumbled upon this: if a buffer has no undo information
associated, org-self-insert-command produces an error while trying to
edit the formula.  This code path may need to be protected against this
(admittedly rare) case, I've been triggering it while testing your
example directly in the gnus article buffer.

Debugger entered--Lisp error: (wrong-type-argument listp t)
  cadr(t)
  (not (cadr buffer-undo-list))
  (and ( org-self-insert-command-undo-counter 0) buffer-undo-list (not (cadr 
buffer-undo-list)) (setcdr buffer-undo-list (cddr buffer-undo-list)))
  (if (= org-self-insert-command-undo-counter 20) (setq 
org-self-insert-command-undo-counter 1) (and ( 
org-self-insert-command-undo-counter 0) buffer-undo-list (not ...) (setcdr 
buffer-undo-list ...)) (setq org-self-insert-command-undo-counter (1+ 
org-self-insert-command-undo-counter)))
  (if (not (eq last-command ...)) (setq org-self-insert-command-undo-counter 1) 
(if (= org-self-insert-command-undo-counter 20) (setq 
org-self-insert-command-undo-counter 1) (and ... buffer-undo-list ... ...) 
(setq org-self-insert-command-undo-counter ...)))
  (if org-self-insert-cluster-for-undo (if (not ...) (setq 
org-self-insert-command-undo-counter 1) (if ... ... ... ...)))
  (cond ((and org-use-speed-commands ...) (cond ... ... ... ...)) ((and ... ... 
... ...) (let ... ... ... ... ...)) (t (setq org-table-may-need-update t) 
(self-insert-command N) (org-fix-tags-on-the-fly) (if 
org-self-insert-cluster-for-undo ...)))
  org-self-insert-command(1)


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

Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds




Re: [O] [Orgmode] Re: [Feature Request] Cross headings in tables

2011-05-29 Thread Carsten Dominik

On 8.2.2011, at 22:52, Achim Gratz wrote:

 
 If anybody wants to test the current state of affairs, I've just set up
 a fork repository to make it easier.  Assuming you already have
 orgmode.git cloned, do a
 
 git remote add -t tableheadings remote-tableheadings 
 git://repo.or.cz/org-mode/org-tableheadings.git
 git fetch remote-tableheadings tableheadings:local-tableheadings
 git checkout local-tableheadings
 
 to get it (change remote-tableheadings and local-tableheadings to suit
 your naming conventions for remotes and local branches, respectively).
 I will be _rebasing_ against master during development, so expect
 history in this branch to be volatile.
 
 As before, test cases and comments welcome.

Hi Achim, hi Lawrence,

this looks pretty good.  One thing I found missing is that
header lines should be exempted from column formulas being
applied.  This works for the headlines at the top of the
table, but not in the middle.  Try C-c C-c in the TBLFM
line of:

| aaa | bbb | ccc | ddd |
|-+-+-+-|
| ddd | eee | fff |  41 |
| ddd | eee | fff |  41 |
| ddd | eee | fff |  41 |
|~+~+~+~|
| ddd | | fff | ddd |
|-+-+-+-|
| ddd | eee | fff |  41 |
| ddd | eee | fff |  41 |
| xxx | yyy | zzz |  41 |
#+TBLFM: $4=41

Also documentation in the manual is missing - one
or two sentences in the right place should be enough.

- Carsten