emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: [BUG] hline references on left side of table formula
@ 2013-10-01  5:32 lompik
  2013-11-06  8:23 ` Bastien
  0 siblings, 1 reply; 11+ messages in thread
From: lompik @ 2013-10-01  5:32 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

I was interested to use hline references on the left side. However I found out that it
is not completely unsupported.
When the left side consist of:
* single cells references, it does not work
* ranged cells, it works for me (org 8.0.3)

The patch below tranforms the single cell references to ranged cells .

However it still does not work for references like @+ or @- I$1.. , which can be solve 
using references like @I+1#1.

Thanks,


*** a/org-table.el Sat Jun 29 16:20:30 2013
--- b/org-table.el Tue Oct 1 00:23:35 2013
***************
*** 3227,3232 ****
--- 3227,3236 ----
(put-text-property 0 (length (caar res))
:orig-eqn e (caar res))))
(t
+ ;; if contains hline-reference and refers to fixed cell..make it range
+ (if (string-match "^@[+-]?I*[^.]*$" lhs )
+ (setq lhs (format "%s..%s" lhs lhs )))
+ 
(setq range (org-table-get-range lhs org-table-current-begin-pos
1 nil 'corners))
(setq r1 (nth 0 range) c1 (nth 1 range)


However, fields like @-I or @+II 

> 
> Hi Rick,
> 
> hline-relative references on the left side of a table are currently not 
> supported. The fact that this is expanded is a bug. A patch catching this 
> case would be very welcome.
> 
> Regards
> 
> - Carsten
> 
> On May 1, 2013, at 7:27 PM, Rick Frankel  wrote:
> 
> > Hi-
> > 
> > I don't know if this is a bug or feature :), but if an hline reference
> > (@I, etc) is used on the left side of a calculation, it applies to ALL
> > columns in the row even if the column is specfied.
> > 
> > Here are some examples to show the results. I would expect all three
> > versions to generate the same results as the first example.
> > 
> > #+BEGIN_ORG
> > * Absolute reference (expected results)
> > | a | b |
> > |---+---|
> > | x | 1 |
> > | y | 2 |
> > |---+---|
> > | | 3 |
> > #+TBLFM: @4$2=vsum(@address@hidden)
> > 
> > * hline reference
> > | a | b |
> > |-------+---|
> > | x | 1 |
> > | y | 2 |
> > |-------+---|
> > | x + y | 3 |
> > #+TBLFM: @II$2=vsum(@address@hidden)
> > 
> > * hline reference with full cell specification in sum
> > | a | b |
> > |---+---|
> > | x | 1 |
> > | y | 2 |
> > |---+---|
> > | 3 | 3 |
> > #+TBLFM: @II$2=vsum(@address@hidden)
> > #+END_ORG
> > 
> > FWIW, I believe the problem is that `org-table-recalculate' is
> > matching lhs cell references explicitly against pure numeric
> > references ("@[0-9]+$[0-9]+") and therefore expands the lhs via
> > `org-expand-lhs-ranges' instead of expanding it with
> > `org-table-get-descriptor-line'
> > 
> > rick
> > 
> > 
___________________________________________________________
Qu'y a-t-il ce soir à la télé ? D'un coup d'œil, visualisez le programme sur Voila.fr http://tv.voila.fr/programmes/chaines-tnt/ce-soir.html

^ permalink raw reply	[flat|nested] 11+ messages in thread
* [BUG] hline references on left side of table formula
@ 2013-05-01 17:27 Rick Frankel
  2013-09-02  8:10 ` Carsten Dominik
  0 siblings, 1 reply; 11+ messages in thread
From: Rick Frankel @ 2013-05-01 17:27 UTC (permalink / raw)
  To: Org-Mode

Hi-

I don't know if this is a bug or feature :), but if an hline reference
(@I, etc) is used on the left side of a calculation, it applies to ALL
columns in the row even if the column is specfied.

Here are some examples to show the results. I would expect all three
versions to generate the same results as the first example.

#+BEGIN_ORG
   * Absolute reference (expected results)
     | a | b |
     |---+---|
     | x | 1 |
     | y | 2 |
     |---+---|
     |   | 3 |
   #+TBLFM: @4$2=vsum(@I..@II)

   * hline reference
     | a     | b |
     |-------+---|
     | x     | 1 |
     | y     | 2 |
     |-------+---|
     | x + y | 3 |
   #+TBLFM: @II$2=vsum(@I..@II)

   * hline reference with full cell specification in sum
     | a | b |
     |---+---|
     | x | 1 |
     | y | 2 |
     |---+---|
     | 3 | 3 |
   #+TBLFM: @II$2=vsum(@I$2..@II$2)
   #+END_ORG

FWIW, I believe the problem is that `org-table-recalculate' is
matching lhs cell references explicitly against pure numeric
references ("@[0-9]+$[0-9]+") and therefore expands the lhs via
`org-expand-lhs-ranges' instead of expanding it with
`org-table-get-descriptor-line'

rick

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

end of thread, other threads:[~2013-11-07 19:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-01  5:32 [BUG] hline references on left side of table formula lompik
2013-11-06  8:23 ` Bastien
2013-11-06 18:50   ` Rick Frankel
2013-11-06 19:57     ` Achim Gratz
2013-11-06 20:14       ` Achim Gratz
2013-11-07 15:01         ` Rick Frankel
2013-11-07 19:16           ` Achim Gratz
2013-11-07  5:59     ` Michael Brand
2013-11-07 14:40       ` Rick Frankel
  -- strict thread matches above, loose matches on Subject: below --
2013-05-01 17:27 Rick Frankel
2013-09-02  8:10 ` Carsten Dominik

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