Re: [O] Bug: Bug in handling of named fields in the org spreadsheet [9.1.13 (release_9.1.13)]

2018-05-23 Thread Piyush Srivastava

Thank you.  I will get back to creating the patch this weekend and will
include your suggested change.

Best regards,
-- Piyush.



Nicolas Goaziou writes:

> Hello,
>
> Piyush Srivastava <piyush.srivast...@tifr.res.in> writes:
>
>> In the current org mode version (release_9.1.13), when a named cell
>> formula is stored using C-u C-c =, the #+TBLFM line stores the name of
>> the cell *without* a prefix $ sign, as in the following table (notice
>> that in the #+TBLFM row, there is no $ sign before the 'sum' variable):
>>
>> |   |   c |
>> |---+-|
>> |   |   3 |
>> |   |  10 |
>> |---+-|
>> | # |  14 |
>> | ^ | sum |
>> |---+-|
>>
>> #+TBLFM: sum=vsum(@-II$0..@-I$0)
>>
>>
>> With this convention, pressing TAB in the row after making a change in
>> the table does not update the field referred to by $sum, contrary to
>> what is said in the manual.
>>
>>
>> However, if I manually add a prefix $ to the variable sum in the #+TBLFM
>> row (as in the table below), then TAB update work as described in the
>> manual (notice the $sum variable in the #+TBLFM row):
>>
>>
>> |   |   c |
>> |---+-|
>> |   |   3 |
>> |   |  12 |
>> |---+-|
>> | # |  15 |
>> | ^ | sum |
>> |---+-|
>>
>> #+TBLFM: $sum=vsum(@-II$0..@-I$0)
>>
>>
>> A fix is to ensure that if the LHS of a field formula being inserted is
>> a field name rather than a numerical reference, then a '$' should be
>> prefixed to it.  I have the following patch that implements this:
>>
>>
>> diff --git a/lisp/org-table.el b/lisp/org-table.el
>> --- a/lisp/org-table.el
>> +++ b/lisp/org-table.el
>> @@ -2301,7 +2301,13 @@ LOCATION instead."
>> (org-indent-line)
>> (insert (or (match-string 2) "#+TBLFM:")))
>>(insert " "
>> - (mapconcat (lambda (x) (concat (car x) "=" (cdr x)))
>> + (mapconcat (lambda (x)
>> +  (let* ((name (car x))
>> + (first (substring-no-properties name 0 1))
>> + (test (or (string= first "@") (string= 
>> first "$")))
>> + )
>> +(concat (if test name (concat "$" name))
>> +"=" (cdr x
>>  (sort alist #'org-table-formula-less-p)
>>  "::")
>>   "\n"
>
> You're right.
>
> I suggest the following, though:
>
>   (mapconcat (lambda (x)
>  (pcase-let ((`(,lhs . ,rhs) x))
>(format "%s=%s"
>(if (string-match-p "\\`[$@]" lhs) lhs
>  ;; Named fields are stored
>  ;; without the "$" prefix.
>  (concat "$" lhs))
>rhs)))
>(sort alist #'org-table-formula-less-p)
>"::")
>
>> I am happy to assign copyright for the patch, if that is needed and if
>> the patch if found suitable, for it to be included in org-mode code.
>
> This is not needed because this patch is a TINYCHANGE. However, starting
> the copyright assignment process is still valuable if you intend to
> provide more patches.
>
> In any case, would you mind providing a patch incorporating the changes
> above with a proper commit message? Also, it might be interesting to add
> a test for it in "test-org-table.el".
>
> Thank you.
>
> Regards,




[O] Bug: Bug in handling of named fields in the org spreadsheet [9.1.13 (release_9.1.13)]

2018-05-21 Thread Piyush Srivastava

In the current org mode version (release_9.1.13), when a named cell
formula is stored using C-u C-c =, the #+TBLFM line stores the name of
the cell *without* a prefix $ sign, as in the following table (notice
that in the #+TBLFM row, there is no $ sign before the 'sum' variable):

|   |   c |
|---+-|
|   |   3 |
|   |  10 |
|---+-|
| # |  14 |
| ^ | sum |
|---+-|
#+TBLFM: sum=vsum(@-II$0..@-I$0)


With this convention, pressing TAB in the row after making a change in
the table does not update the field referred to by $sum, contrary to
what is said in the manual.


However, if I manually add a prefix $ to the variable sum in the #+TBLFM
row (as in the table below), then TAB update work as described in the
manual (notice the $sum variable in the #+TBLFM row):


|   |   c |
|---+-|
|   |   3 |
|   |  12 |
|---+-|
| # |  15 |
| ^ | sum |
|---+-|
#+TBLFM: $sum=vsum(@-II$0..@-I$0)



A fix is to ensure that if the LHS of a field formula being inserted is
a field name rather than a numerical reference, then a '$' should be
prefixed to it.  I have the following patch that implements this:


diff --git a/lisp/org-table.el b/lisp/org-table.el
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -2301,7 +2301,13 @@ LOCATION instead."
(org-indent-line)
(insert (or (match-string 2) "#+TBLFM:")))
   (insert " "
- (mapconcat (lambda (x) (concat (car x) "=" (cdr x)))
+ (mapconcat (lambda (x)
+  (let* ((name (car x))
+ (first (substring-no-properties name 0 1))
+ (test (or (string= first "@") (string= first 
"$")))
+ )
+(concat (if test name (concat "$" name))
+"=" (cdr x
 (sort alist #'org-table-formula-less-p)
 "::")
  "\n"


What this patch does is the following: if the reference being inserted
does not begin with an '@' or a '$', then it is assumed to be a named
reference, and a '$' is prefixed to it.  This will work *provided* no
named references themselves start with a '$'.

I am happy to assign copyright for the patch, if that is needed and if
the patch if found suitable, for it to be included in org-mode code.


Thanks,
-- Piyush.


Emacs  : GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.26)
 of 2018-02-09
Package: Org mode version 9.1.13 (release_9.1.13)



[O] Bug: Table update fails for named fields [9.1.13 (release_9.1.13)]

2018-05-20 Thread Piyush Srivastava

In the current org mode version (release_9.1.13), when a named cell
formula is stored using C-u C-c =, the #+TBLFM line stores the name of
the cell without a prefix '$' sign, as in the following table (notice
that is the #+TBLFM row, there is no '$' sign before the 'sum'
variable):

|   |   c |
|---+-|
|   |   3 |
|   |  10 |
|---+-|
| # |  14 |
| ^ | sum |
|---+-|
#+TBLFM: sum=vsum(@-II$0..@-I$0)


With this storage, pressing TAB in the row after changing some entries
does not update the filed referred to by 'sum', contrary to the
description in the manual.


However, if I manually prefix a '$; to the variable 'sum' as in the
table below, then TAB update work as described in the manual (notice the
$sum variable in the #+TBLFM row):


|   |   c |
|---+-|
|   |   3 |
|   |  12 |
|---+-|
| # |  15 |
| ^ | sum |
|---+-|
#+TBLFM: $sum=vsum(@-II$0..@-I$0)


A fix is to ensure that if the LHS of a field formula being inserted
is a field name rather than a numerical reference, then a '$' is
prefixed to it.  I have the following patch with implements this:


diff --git a/lisp/org-table.el b/lisp/org-table.el
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -2301,7 +2301,13 @@ LOCATION instead."
(org-indent-line)
(insert (or (match-string 2) "#+TBLFM:")))
   (insert " "
- (mapconcat (lambda (x) (concat (car x) "=" (cdr x)))
+ (mapconcat (lambda (x)
+  (let* ((name (car x))
+ (first (substring-no-properties name 0 1))
+ (test (or (string= first "@") (string= first 
"$")))
+ )
+(concat (if test name (concat "$" name))
+"=" (cdr x
 (sort alist #'org-table-formula-less-p)
 "::")
  "\n"


What this patch does is the following: if the reference being inserted
does not begin with an '@' or a '$', then it is assumed to be a named
reference, and a '$' is prefixed to it.  This will work *provided* no
named references themselves start with a '$'.

I am happy to assign copyright for the patch, if that is needed and if
the patch if found suitable, for it to be included in org-mode code.


Thanks,
-- Piyush.


Emacs  : GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.26)
 of 2018-02-09
Package: Org mode version 9.1.13 (release_9.1.13)



[O] Bug: Table update fails for named fields [9.1.13 (release_9.1.13)]

2018-05-20 Thread Piyush Srivastava

In the current org mode version (release_9.1.13), when a named cell
formula is stored using C-u C-c =, the #+TBLFM line stores the name of
the cell without a prefix '$' sign, as in the following table (notice
that is the #+TBLFM row, there is no '$' sign before the 'sum'
variable):

|   |   c |
|---+-|
|   |   3 |
|   |  10 |
|---+-|
| # |  14 |
| ^ | sum |
|---+-|
#+TBLFM: sum=vsum(@-II$0..@-I$0)


With this storage, pressing TAB in the row after changing some entries
does not update the filed referred to by 'sum', contrary to the
description in the manual.


However, if I manually prefix a '$; to the variable 'sum' as in the
table below, then TAB update work as described in the manual (notice the
$sum variable in the #+TBLFM row):


|   |   c |
|---+-|
|   |   3 |
|   |  12 |
|---+-|
| # |  15 |
| ^ | sum |
|---+-|
#+TBLFM: $sum=vsum(@-II$0..@-I$0)


A fix is to ensure that if the LHS of a field formula being inserted
is a field name rather than a numerical reference, then a '$' is
prefixed to it.  I have the following patch with implements this:


diff --git a/lisp/org-table.el b/lisp/org-table.el
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -2301,7 +2301,13 @@ LOCATION instead."
(org-indent-line)
(insert (or (match-string 2) "#+TBLFM:")))
   (insert " "
- (mapconcat (lambda (x) (concat (car x) "=" (cdr x)))
+ (mapconcat (lambda (x)
+  (let* ((name (car x))
+ (first (substring-no-properties name 0 1))
+ (test (or (string= first "@") (string= first 
"$")))
+ )
+(concat (if test name (concat "$" name))
+"=" (cdr x
 (sort alist #'org-table-formula-less-p)
 "::")
  "\n"


What this patch does is the following: if the reference being inserted
does not begin with an '@' or a '$', then it is assumed to be a named
reference, and a '$' is prefixed to it.  This will work *provided* no
named references themselves start with a '$'.

I am happy to assign copyright for the patch, if that is needed and if
the patch if found suitable, for it to be included in org-mode code.


Thanks,
-- Piyush.


Emacs  : GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.26)
 of 2018-02-09
Package: Org mode version 9.1.13 (release_9.1.13)



[O] Submitting patches for org-info-src.js

2015-09-07 Thread Piyush Srivastava
Hi,

In an earlier message on this list, I pointed out how a change in the
export routines in org 8.3.1 has broken many of the features of org-info,
and identified changes that need to be made to org-info-js-src to fix these
problems (while retaining backward compatibility with the earlier system).

I wanted to know what is the procedure for submitting patches for
org-info-src.js.  The page at
http://orgmode.org/worg/code/org-info-js/#sec-1-1 suggests that it is a
github repository  owned by Sebastian Rose.  However, the versions of
org-info-src.js available from Sebastian Rose's repository and from worg
are different.  So I wanted to know which repository I should fork from to
create the patch.

Thanks,

-- Piyush.


[O] Org-info-js folding is broken in 8.3 releases

2015-09-06 Thread Piyush Srivastava
Hi,


In the current 8.3.1 release of org-mode the f/F keybinding that
org-info-js provides for folding headings in plain mode (of exported html
files) fails to work.  Further, the 's' and 'o' keys for search and occur
respectively also fail to work.  Both of these work with the 8.2.10 release.

I have attached a minimal org-mode file with which I can reproduce this
error.  By bisecting the commit history, I find that the breaking change is
introduced by commit 4ee8f4 which has the following commit message:

Author: Rasmus 
Date:   Sun Apr 19 16:00:06 2015 +0200

Revert "ox: Change label naming scheme"

This reverts commit cf7d64f1e456cad281674fc81a8074f969b7911c.

The log produced by git bisect is also attached.


Thanks,
-- Piyush.
git bisect start
# bad: [a395da96f74b1d4a12ec25cb337c41f3c4c84f40] ORG-NEWS: Signal new Stan 
language support
git bisect bad a395da96f74b1d4a12ec25cb337c41f3c4c84f40
# good: [fdd9b18598239dd0e8b18383ac930110d51ed22e] Fix: Emacs 25 fancy diary 
inclusion in agenda
git bisect good fdd9b18598239dd0e8b18383ac930110d51ed22e
# good: [d2c0bbcf52dee58a6f71690983395f891ba7869d] Merge branch 'maint'
git bisect good d2c0bbcf52dee58a6f71690983395f891ba7869d
# good: [7b450bc7bbd24e79d2aca74210e1b580dc944284] Fix 
`org-delete-property-globally'
git bisect good 7b450bc7bbd24e79d2aca74210e1b580dc944284
# bad: [8ff31bd0cf9179d7952d933d4638b658b3c9b3ba] ox-latex: Introduce 
:environment attribute for example blocks
git bisect bad 8ff31bd0cf9179d7952d933d4638b658b3c9b3ba
# bad: [c347b87ffe479824269ae0825e467c35d0946eed] org-src: Allow to 
post-process edit buffer
git bisect bad c347b87ffe479824269ae0825e467c35d0946eed
# good: [ca08453cc9f142c76536daa0ee824dfa98eb5639] Update defcustom
git bisect good ca08453cc9f142c76536daa0ee824dfa98eb5639
# good: [51d83b91656d235eedccfb01f03abd9ec0545f53] ORG-NEWS: Update copyright 
year
git bisect good 51d83b91656d235eedccfb01f03abd9ec0545f53
# bad: [0ab15904ec4c8329c41c1965d025b742d3bd0bf1] org-element: Fix "file" link 
:path
git bisect bad 0ab15904ec4c8329c41c1965d025b742d3bd0bf1
# good: [acf7f47ecd20a48c05f97dc660b00d1850b57e10] Use 
`completing-read-function' for completion
git bisect good acf7f47ecd20a48c05f97dc660b00d1850b57e10
# good: [88108f652f0d4ddb4250cb89c2453df1fc9ee671] ox-latex: Fix 
f1548e11fe2972819bc48b88c6094b11150e5c8a
git bisect good 88108f652f0d4ddb4250cb89c2453df1fc9ee671
# good: [1841892321b87ce4873de50dfe339d5b5d8d942c] org.texi: Introduce 
`org-latex-prefer-user-labels'
git bisect good 1841892321b87ce4873de50dfe339d5b5d8d942c
# bad: [4ee8f4f2865b84669a8a0daec2725efb29c6bd90] Revert "ox: Change label 
naming scheme"
git bisect bad 4ee8f4f2865b84669a8a0daec2725efb29c6bd90
# good: [ea4e8e3b2c47ebdc0037f09f87625b1bc57c89fc] org.texi: Remove 
`org-latex-custom-id-as-label'
git bisect good ea4e8e3b2c47ebdc0037f09f87625b1bc57c89fc
# first bad commit: [4ee8f4f2865b84669a8a0daec2725efb29c6bd90] Revert "ox: 
Change label naming scheme"


temp.org
Description: Binary data


Re: [O] Org-info-js folding is broken in 8.3 releases

2015-09-06 Thread Piyush Srivastava
I think I have finally isolated a fix.  org-info.js uses the magic number
"4" (i.e. the length of the string "sec-") to substring DOM ids in order to
fin section numbers (this is on line number 97 in the source code of
org-info-src.js).   However the changes to org-export-get-reference mean
that instead of using the string "sec-" before the section heading, ox-html
now used the string "orgheadline".  Thus, the fix is to replace "4" by
"orgheadline".length in the source code of org-info-src.js.

This seems to be the simplest way to fix this error.  However, as it is, it
will break those people's code who are using the online version of the
script.  We will probably need to detect what string the html file is using
in the DOM id for headlines and used the length of that string.  I will try
to write a patch in the next few days if this strategy sounds good.

-- Piyush.



On Sat, Sep 5, 2015 at 5:20 PM, Piyush Srivastava <piyushsr...@gmail.com>
wrote:

> In fact, further investigation shows that the first commit that actually
> breaks org-info-js is the replacement of `org-export-get-headline-id' by
> `org-export-get-reference' in commit id 459033 on April 13.  These problems
> are temporarily fixed by commit cf7d64, and then reintroduced by commit
> 4ee8f4 which reverted the changes made to org-export-get-reference in
> cf7d64.
>
> -- Piyush.
>
>
> On Sat, Sep 5, 2015 at 4:20 PM, Piyush Srivastava <piyushsr...@gmail.com>
> wrote:
>
>> Hi,
>>
>>
>> In the current 8.3.1 release of org-mode the f/F keybinding that
>> org-info-js provides for folding headings in plain mode (of exported html
>> files) fails to work.  Further, the 's' and 'o' keys for search and occur
>> respectively also fail to work.  Both of these work with the 8.2.10 release.
>>
>> I have attached a minimal org-mode file with which I can reproduce this
>> error.  By bisecting the commit history, I find that the breaking change is
>> introduced by commit 4ee8f4 which has the following commit message:
>>
>> Author: Rasmus <ras...@gmx.us>
>> Date:   Sun Apr 19 16:00:06 2015 +0200
>>
>> Revert "ox: Change label naming scheme"
>>
>> This reverts commit cf7d64f1e456cad281674fc81a8074f969b7911c.
>>
>> The log produced by git bisect is also attached.
>>
>>
>> Thanks,
>> -- Piyush.
>>
>>
>>
>>
>>
>


Re: [O] Org-info-js folding is broken in 8.3 releases

2015-09-06 Thread Piyush Srivastava
In fact, further investigation shows that the first commit that actually
breaks org-info-js is the replacement of `org-export-get-headline-id' by
`org-export-get-reference' in commit id 459033 on April 13.  These problems
are temporarily fixed by commit cf7d64, and then reintroduced by commit
4ee8f4 which reverted the changes made to org-export-get-reference in
cf7d64.

-- Piyush.


On Sat, Sep 5, 2015 at 4:20 PM, Piyush Srivastava <piyushsr...@gmail.com>
wrote:

> Hi,
>
>
> In the current 8.3.1 release of org-mode the f/F keybinding that
> org-info-js provides for folding headings in plain mode (of exported html
> files) fails to work.  Further, the 's' and 'o' keys for search and occur
> respectively also fail to work.  Both of these work with the 8.2.10 release.
>
> I have attached a minimal org-mode file with which I can reproduce this
> error.  By bisecting the commit history, I find that the breaking change is
> introduced by commit 4ee8f4 which has the following commit message:
>
> Author: Rasmus <ras...@gmx.us>
> Date:   Sun Apr 19 16:00:06 2015 +0200
>
> Revert "ox: Change label naming scheme"
>
> This reverts commit cf7d64f1e456cad281674fc81a8074f969b7911c.
>
> The log produced by git bisect is also attached.
>
>
> Thanks,
> -- Piyush.
>
>
>
>
>


Re: [O] Org-info-js folding is broken in 8.3 releases

2015-09-06 Thread Piyush Srivastava
Of course, we will also need to change the regexp SID_REGEX (in
org-info-src.js) to "/(^#)((sec-|orgheadline)\d+([._]\d+)*$)/" from the
current value of "/(^#)(sec-\d+([._]\d+)*$)/".  It's capturing groups are
not used, to this should not propagate any more changes.

On Sat, Sep 5, 2015 at 8:20 PM, Piyush Srivastava <piyushsr...@gmail.com>
wrote:

> I think I have finally isolated a fix.  org-info.js uses the magic number
> "4" (i.e. the length of the string "sec-") to substring DOM ids in order to
> fin section numbers (this is on line number 97 in the source code of
> org-info-src.js).   However the changes to org-export-get-reference mean
> that instead of using the string "sec-" before the section heading, ox-html
> now used the string "orgheadline".  Thus, the fix is to replace "4" by
> "orgheadline".length in the source code of org-info-src.js.
>
> This seems to be the simplest way to fix this error.  However, as it is,
> it will break those people's code who are using the online version of the
> script.  We will probably need to detect what string the html file is using
> in the DOM id for headlines and used the length of that string.  I will try
> to write a patch in the next few days if this strategy sounds good.
>
> -- Piyush.
>
>
>
> On Sat, Sep 5, 2015 at 5:20 PM, Piyush Srivastava <piyushsr...@gmail.com>
> wrote:
>
>> In fact, further investigation shows that the first commit that actually
>> breaks org-info-js is the replacement of `org-export-get-headline-id' by
>> `org-export-get-reference' in commit id 459033 on April 13.  These problems
>> are temporarily fixed by commit cf7d64, and then reintroduced by commit
>> 4ee8f4 which reverted the changes made to org-export-get-reference in
>> cf7d64.
>>
>> -- Piyush.
>>
>>
>> On Sat, Sep 5, 2015 at 4:20 PM, Piyush Srivastava <piyushsr...@gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>>
>>> In the current 8.3.1 release of org-mode the f/F keybinding that
>>> org-info-js provides for folding headings in plain mode (of exported html
>>> files) fails to work.  Further, the 's' and 'o' keys for search and occur
>>> respectively also fail to work.  Both of these work with the 8.2.10 release.
>>>
>>> I have attached a minimal org-mode file with which I can reproduce this
>>> error.  By bisecting the commit history, I find that the breaking change is
>>> introduced by commit 4ee8f4 which has the following commit message:
>>>
>>> Author: Rasmus <ras...@gmx.us>
>>> Date:   Sun Apr 19 16:00:06 2015 +0200
>>>
>>> Revert "ox: Change label naming scheme"
>>>
>>> This reverts commit cf7d64f1e456cad281674fc81a8074f969b7911c.
>>>
>>> The log produced by git bisect is also attached.
>>>
>>>
>>> Thanks,
>>> -- Piyush.
>>>
>>>
>>>
>>>
>>>
>>
>