emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Translate refs to rc also in remote references
@ 2012-07-10 12:55 Jose E. Marchesi
  2012-07-10 20:01 ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Jose E. Marchesi @ 2012-07-10 12:55 UTC (permalink / raw)
  To: emacs-orgmode


Hi all.

Just a tiny patch making org-table-convert-refs-to-rc to transform the
coordinates found in remote references into "normalised" @n$y.  This is
part of some work I am doing with remotes and which I will be sending to
the list soon: namely to update the remotes when the structure of
some referred table changes.

diff --git a/lisp/org-table.el b/lisp/org-table.el
index 16f2520..f3cce91 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3229,7 +3229,7 @@ Parameters get priority."
 Works for single references, but also for entire formulas and even the
 full TBLFM line."
   (let ((start 0))
-    (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^)]*)\\)" s start)
+    (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^,]*[ \t]*\\|)\\)" s start)
       (cond
        ((match-end 3)
 	;; format match, just advance

-- 
Jose E. Marchesi         http://www.jemarch.net
GNU Project              http://www.gnu.org

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

* Re: [PATCH] Translate refs to rc also in remote references
  2012-07-10 12:55 [PATCH] Translate refs to rc also in remote references Jose E. Marchesi
@ 2012-07-10 20:01 ` Bastien
  2012-07-11  8:17   ` Jose E. Marchesi
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2012-07-10 20:01 UTC (permalink / raw)
  To: Jose E. Marchesi; +Cc: emacs-orgmode

Hi Jose,

jemarch@gnu.org (Jose E. Marchesi) writes:

> Just a tiny patch making org-table-convert-refs-to-rc to transform the
> coordinates found in remote references into "normalised" @n$y.  This is
> part of some work I am doing with remotes and which I will be sending to
> the list soon: namely to update the remotes when the structure of
> some referred table changes.

Looks good.  Can you provide the patch with a ChangeLog and with 
git format-patch ?

Thanks!

-- 
 Bastien

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

* Re: [PATCH] Translate refs to rc also in remote references
  2012-07-10 20:01 ` Bastien
@ 2012-07-11  8:17   ` Jose E. Marchesi
  2012-08-08 12:23     ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Jose E. Marchesi @ 2012-07-11  8:17 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

    
    > Just a tiny patch making org-table-convert-refs-to-rc to transform the
    > coordinates found in remote references into "normalised" @n$y.  This is
    > part of some work I am doing with remotes and which I will be sending to
    > the list soon: namely to update the remotes when the structure of
    > some referred table changes.
    
    Looks good.  Can you provide the patch with a ChangeLog and with 
    git format-patch ?
    
Sure.  Here is it.

From 37cc07cb5acd84c15216f0107936fe9367c53dca Mon Sep 17 00:00:00 2001
From: "Jose E. Marchesi" <jemarch@gnu.org>
Date: Wed, 11 Jul 2012 10:10:02 +0200
Subject: [PATCH] Transform the coordinates found in remote references into
 "normalised" @n$y.
To: emacs-orgmode@gnu.org

* org-table.el (org-table-convert-refs-to-rc): Convert references in
remote(..) directives.
---
 lisp/org-table.el |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-table.el b/lisp/org-table.el
index 16f2520..f3cce91 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3229,7 +3229,7 @@ Parameters get priority."
 Works for single references, but also for entire formulas and even the
 full TBLFM line."
   (let ((start 0))
-    (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^)]*)\\)" s start)
+    (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^,]*[ \t]*\\|)\\)" s start)
       (cond
        ((match-end 3)
 	;; format match, just advance
-- 
1.7.10


-- 
Jose E. Marchesi         http://www.jemarch.net
GNU Project              http://www.gnu.org

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

* Re: [PATCH] Translate refs to rc also in remote references
  2012-07-11  8:17   ` Jose E. Marchesi
@ 2012-08-08 12:23     ` Bastien
  2012-08-09 18:00       ` Jose E. Marchesi
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2012-08-08 12:23 UTC (permalink / raw)
  To: Jose E. Marchesi; +Cc: emacs-orgmode

Hi Jose,

jemarch@gnu.org (Jose E. Marchesi) writes:

> Sure.  Here is it.

Coming back to this.

> From 37cc07cb5acd84c15216f0107936fe9367c53dca Mon Sep 17 00:00:00 2001
> From: "Jose E. Marchesi" <jemarch@gnu.org>
> Date: Wed, 11 Jul 2012 10:10:02 +0200
> Subject: [PATCH] Transform the coordinates found in remote references into
>  "normalised" @n$y.
> To: emacs-orgmode@gnu.org
>
> * org-table.el (org-table-convert-refs-to-rc): Convert references in
> remote(..) directives.
> ---
>  lisp/org-table.el |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lisp/org-table.el b/lisp/org-table.el
> index 16f2520..f3cce91 100644
> --- a/lisp/org-table.el
> +++ b/lisp/org-table.el
> @@ -3229,7 +3229,7 @@ Parameters get priority."
>  Works for single references, but also for entire formulas and even the
>  full TBLFM line."
>    (let ((start 0))
> -    (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^)]*)\\)" s start)
> +    (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^,]*[ \t]*\\|)\\)" s start)

I fail to see the meaning of ([^,]*[ \t]*\\|) replacing ([^)]*)

The \\| is wrong, right?

I think I need an example with such a remote reference, the way
org-table-convert-refs-to-rc would have converted it, and the way
it does with your patch.

Thanks in advance!

-- 
 Bastien

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

* Re: [PATCH] Translate refs to rc also in remote references
  2012-08-08 12:23     ` Bastien
@ 2012-08-09 18:00       ` Jose E. Marchesi
  2012-08-10  9:02         ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: Jose E. Marchesi @ 2012-08-09 18:00 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode


Hi Bastien.
    

    > -    (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^)]*)\\)" s start)
    > +    (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^,]*[ \t]*\\|)\\)" s start)
    
    I fail to see the meaning of ([^,]*[ \t]*\\|) replacing ([^)]*)
    
    The \\| is wrong, right?

Yep, you can remove the \\|.
    
    I think I need an example with such a remote reference, the way
    org-table-convert-refs-to-rc would have converted it, and the way
    it does with your patch.

Real example from a formula in a table of mine:

  B3=(B2*remote(Factors,F10))/remote(Factors,G10)

The old org-table-convert-refs-to-rc would have converted it to:

"@3$2=(@2$2*remote(Factors,F10))/remote(Factors,G10)"
  
The new version to:

"@3$2=(@2$2*remote(Factors,@10$6))/remote(Factors,@10$7)"

i.e. the old version was not converting the A0 coordinates to rc
coordinates.

-- 
Jose E. Marchesi         http://www.jemarch.net
GNU Project              http://www.gnu.org

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

* Re: [PATCH] Translate refs to rc also in remote references
  2012-08-09 18:00       ` Jose E. Marchesi
@ 2012-08-10  9:02         ` Bastien
  2012-08-10  9:23           ` Jose E. Marchesi
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2012-08-10  9:02 UTC (permalink / raw)
  To: Jose E. Marchesi; +Cc: emacs-orgmode

Hi Jose,

jemarch@gnu.org (Jose E. Marchesi) writes:

> i.e. the old version was not converting the A0 coordinates to rc
> coordinates.

thanks a lot for the detailed explanations.

I've just pushed a minimal fix for this:

diff --git a/lisp/org-table.el b/lisp/org-table.el
index d8aba8b..b6bc54a 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -3236,7 +3236,7 @@ Parameters get priority."
 Works for single references, but also for entire formulas and even the
 full TBLFM line."
   (let ((start 0))
-    (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^)]*)\\)" s start)
+    (while (string-match "\\<\\([a-zA-Z]+\\)\\([0-9]+\\>\\|&\\)\\|\\(;[^\r\n:]+\\|\\<remote([^,)]*)\\)" s start)
       (cond
        ((match-end 3)
 	;; format match, just advance

-- 
 Bastien

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

* Re: [PATCH] Translate refs to rc also in remote references
  2012-08-10  9:02         ` Bastien
@ 2012-08-10  9:23           ` Jose E. Marchesi
  0 siblings, 0 replies; 7+ messages in thread
From: Jose E. Marchesi @ 2012-08-10  9:23 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

    
    > i.e. the old version was not converting the A0 coordinates to rc
    > coordinates.
    
    thanks a lot for the detailed explanations.
    I've just pushed a minimal fix for this:

Great, thanks :)
    
-- 
Jose E. Marchesi         http://www.jemarch.net
GNU Project              http://www.gnu.org

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

end of thread, other threads:[~2012-08-10 11:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-10 12:55 [PATCH] Translate refs to rc also in remote references Jose E. Marchesi
2012-07-10 20:01 ` Bastien
2012-07-11  8:17   ` Jose E. Marchesi
2012-08-08 12:23     ` Bastien
2012-08-09 18:00       ` Jose E. Marchesi
2012-08-10  9:02         ` Bastien
2012-08-10  9:23           ` Jose E. Marchesi

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