emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: named columns in tables not working if name contains "_"
@ 2011-08-23 13:20 András Major
  2011-08-23 13:53 ` Nick Dokos
  0 siblings, 1 reply; 17+ messages in thread
From: András Major @ 2011-08-23 13:20 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

Yet another one I just stumbled across: if I create a table and use
"!" in the first column to assign names to the columns, I can only
reference those columns by name in #+TBLFM: if the names don't contain
a "_" character.  This isn't mentioned in the docs and shouldn't be
so, IMHO.  I haven't checked for other common characters that are
prohibited, but the "_" bites me quite a bit.

  András

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

* Re: Bug: named columns in tables not working if name contains "_"
  2011-08-23 13:20 Bug: named columns in tables not working if name contains "_" András Major
@ 2011-08-23 13:53 ` Nick Dokos
  2011-08-23 13:58   ` Bug: named columns in tables not working if name contains András Major
                     ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Nick Dokos @ 2011-08-23 13:53 UTC (permalink / raw)
  To: =?ISO-8859-1?Q?Andr=E1s_Major?=; +Cc: nicholas.dokos, emacs-orgmode

András Major <andras.g.major@gmail.com> wrote:


> Yet another one I just stumbled across: if I create a table and use
> "!" in the first column to assign names to the columns, I can only
> reference those columns by name in #+TBLFM: if the names don't contain
> a "_" character.  This isn't mentioned in the docs and shouldn't be
> so, IMHO.  I haven't checked for other common characters that are
> prohibited, but the "_" bites me quite a bit.
> 

Try adding an underscore to the regexp on line 2179 of org-table.el -
something like this (untested):

          ...
	  (if (string-match "^[a-zA-Z][a-zA-Z0-9_]*$" name)
	      (push (cons name (int-to-string cnt)) org-table-column-names))))


The only characters permitted are alphanumerics. That can probably be
easily relaxed.

Nick

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

* Re: Bug: named columns in tables not working if name contains
  2011-08-23 13:53 ` Nick Dokos
@ 2011-08-23 13:58   ` András Major
  2011-08-23 14:34     ` Bastien
  2011-08-23 14:08   ` Bug: named columns in tables not working if name contains "_" Carsten Dominik
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 17+ messages in thread
From: András Major @ 2011-08-23 13:58 UTC (permalink / raw)
  To: emacs-orgmode

> Try adding an underscore to the regexp on line 2179 of org-table.el -
> something like this (untested):
> 
>           ...
> 	  (if (string-match "^[a-zA-Z][a-zA-Z0-9_]*$" name)
> 	      (push (cons name (int-to-string cnt)) org-table-column-names))))
> 
> The only characters permitted are alphanumerics. That can probably be
> easily relaxed.

Thanks Nick.  It would be nice if the documentation reflected such an
arbitrary choice of characters you can use...

  András

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

* Re: Bug: named columns in tables not working if name contains "_"
  2011-08-23 13:53 ` Nick Dokos
  2011-08-23 13:58   ` Bug: named columns in tables not working if name contains András Major
@ 2011-08-23 14:08   ` Carsten Dominik
  2011-08-23 14:32     ` Nick Dokos
  2011-08-23 16:20     ` Bastien
  2011-08-23 14:35   ` Bastien
  2011-08-23 16:24   ` Achim Gratz
  3 siblings, 2 replies; 17+ messages in thread
From: Carsten Dominik @ 2011-08-23 14:08 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: =?ISO-8859-1?Q?Andr=E1s_Major?=, emacs-orgmode


On Aug 23, 2011, at 3:53 PM, Nick Dokos wrote:

> András Major <andras.g.major@gmail.com> wrote:
> 
> 
>> Yet another one I just stumbled across: if I create a table and use
>> "!" in the first column to assign names to the columns, I can only
>> reference those columns by name in #+TBLFM: if the names don't contain
>> a "_" character.  This isn't mentioned in the docs and shouldn't be
>> so, IMHO.  I haven't checked for other common characters that are
>> prohibited, but the "_" bites me quite a bit.
>> 
> 
> Try adding an underscore to the regexp on line 2179 of org-table.el -
> something like this (untested):
> 
>          ...
> 	  (if (string-match "^[a-zA-Z][a-zA-Z0-9_]*$" name)
> 	      (push (cons name (int-to-string cnt)) org-table-column-names))))
> 
> 
> The only characters permitted are alphanumerics. That can probably be
> easily relaxed.

Hi Nick, I don't think it can be easily relaxed.  Many other characters are
operators in Calc and would lead to confusion.

But amending the docs is certainly a good idea.

Thanks

- Carsten

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

* Re: Bug: named columns in tables not working if name contains "_"
  2011-08-23 14:08   ` Bug: named columns in tables not working if name contains "_" Carsten Dominik
@ 2011-08-23 14:32     ` Nick Dokos
  2011-08-23 14:49       ` Carsten Dominik
  2011-08-23 16:20     ` Bastien
  1 sibling, 1 reply; 17+ messages in thread
From: Nick Dokos @ 2011-08-23 14:32 UTC (permalink / raw)
  To: Carsten Dominik
  Cc: =?us-ascii?Q?=3D=3FISO-8859-1=3FQ=3FAndr=3DE1s=5FMajor=3F=3D?=,
	nicholas.dokos, emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> wrote:

> 
> On Aug 23, 2011, at 3:53 PM, Nick Dokos wrote:
> 
> > András Major <andras.g.major@gmail.com> wrote:
> > 
> > 
> >> Yet another one I just stumbled across: if I create a table and use
> >> "!" in the first column to assign names to the columns, I can only
> >> reference those columns by name in #+TBLFM: if the names don't contain
> >> a "_" character.  This isn't mentioned in the docs and shouldn't be
> >> so, IMHO.  I haven't checked for other common characters that are
> >> prohibited, but the "_" bites me quite a bit.
> >> 
> > 
> > Try adding an underscore to the regexp on line 2179 of org-table.el -
> > something like this (untested):
> > 
> >          ...
> > 	  (if (string-match "^[a-zA-Z][a-zA-Z0-9_]*$" name)
> > 	      (push (cons name (int-to-string cnt)) org-table-column-names))))
> > 
> > 
> > The only characters permitted are alphanumerics. That can probably be
> > easily relaxed.
> 
> Hi Nick, I don't think it can be easily relaxed.  Many other characters are
> operators in Calc and would lead to confusion.
> 

So add more syntax: formulas can use {this+is-a*/strange\@name}.

OK, ok - just kidding.

Thanks,
Nick

PS. This is a paraphrase of the indirection principle: Any problem can
    be solved by adding yet another layer of syntax...

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

* Re: Bug: named columns in tables not working if name contains
  2011-08-23 13:58   ` Bug: named columns in tables not working if name contains András Major
@ 2011-08-23 14:34     ` Bastien
  0 siblings, 0 replies; 17+ messages in thread
From: Bastien @ 2011-08-23 14:34 UTC (permalink / raw)
  To: András Major; +Cc: emacs-orgmode

Hi András,

András Major <andras.g.major@gmail.com> writes:

> Thanks Nick.  It would be nice if the documentation reflected such an
> arbitrary choice of characters you can use...

I added a footnote.

-- 
 Bastien

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

* Re: Bug: named columns in tables not working if name contains "_"
  2011-08-23 13:53 ` Nick Dokos
  2011-08-23 13:58   ` Bug: named columns in tables not working if name contains András Major
  2011-08-23 14:08   ` Bug: named columns in tables not working if name contains "_" Carsten Dominik
@ 2011-08-23 14:35   ` Bastien
  2011-08-23 16:24   ` Achim Gratz
  3 siblings, 0 replies; 17+ messages in thread
From: Bastien @ 2011-08-23 14:35 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: András Major, emacs-orgmode

Hi Nick,

Nick Dokos <nicholas.dokos@hp.com> writes:

> Try adding an underscore to the regexp on line 2179 of org-table.el -
> something like this (untested):
>
>           ...
> 	  (if (string-match "^[a-zA-Z][a-zA-Z0-9_]*$" name)
> 	      (push (cons name (int-to-string cnt)) org-table-column-names))))
>
> The only characters permitted are alphanumerics. That can probably be
> easily relaxed.

Thanks for the suggested fix.

I've pushed a change to allow the underscore char in both field and
column names.

Best,

-- 
 Bastien

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

* Re: Bug: named columns in tables not working if name contains "_"
  2011-08-23 14:32     ` Nick Dokos
@ 2011-08-23 14:49       ` Carsten Dominik
  0 siblings, 0 replies; 17+ messages in thread
From: Carsten Dominik @ 2011-08-23 14:49 UTC (permalink / raw)
  To: nicholas.dokos
  Cc: =?us-ascii?Q?=3D=3FISO-8859-1=3FQ=3FAndr=3DE1s=5FMajor=3F=3D?=,
	emacs-orgmode


On Aug 23, 2011, at 4:32 PM, Nick Dokos wrote:

> Carsten Dominik <carsten.dominik@gmail.com> wrote:
> 
>> 
>> On Aug 23, 2011, at 3:53 PM, Nick Dokos wrote:
>> 
>>> András Major <andras.g.major@gmail.com> wrote:
>>> 
>>> 
>>>> Yet another one I just stumbled across: if I create a table and use
>>>> "!" in the first column to assign names to the columns, I can only
>>>> reference those columns by name in #+TBLFM: if the names don't contain
>>>> a "_" character.  This isn't mentioned in the docs and shouldn't be
>>>> so, IMHO.  I haven't checked for other common characters that are
>>>> prohibited, but the "_" bites me quite a bit.
>>>> 
>>> 
>>> Try adding an underscore to the regexp on line 2179 of org-table.el -
>>> something like this (untested):
>>> 
>>>         ...
>>> 	  (if (string-match "^[a-zA-Z][a-zA-Z0-9_]*$" name)
>>> 	      (push (cons name (int-to-string cnt)) org-table-column-names))))
>>> 
>>> 
>>> The only characters permitted are alphanumerics. That can probably be
>>> easily relaxed.
>> 
>> Hi Nick, I don't think it can be easily relaxed.  Many other characters are
>> operators in Calc and would lead to confusion.
>> 
> 
> So add more syntax: formulas can use {this+is-a*/strange\@name}.
> 
> OK, ok - just kidding.
> 
> Thanks,
> Nick
> 
> PS. This is a paraphrase of the indirection principle: Any problem can
>    be solved by adding yet another layer of syntax...

:) Yes, true!
- Carsten

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

* Re: Bug: named columns in tables not working if name contains "_"
  2011-08-23 14:08   ` Bug: named columns in tables not working if name contains "_" Carsten Dominik
  2011-08-23 14:32     ` Nick Dokos
@ 2011-08-23 16:20     ` Bastien
  2011-08-23 16:47       ` Carsten Dominik
  2011-08-23 18:29       ` Carsten Dominik
  1 sibling, 2 replies; 17+ messages in thread
From: Bastien @ 2011-08-23 16:20 UTC (permalink / raw)
  To: Carsten Dominik
  Cc: =?ISO-8859-1?Q?Andr=E1s_Major?=, nicholas.dokos, emacs-orgmode

Hi Carsten,

Carsten Dominik <carsten.dominik@gmail.com> writes:

>> The only characters permitted are alphanumerics. That can probably be
>> easily relaxed.
>
> Hi Nick, I don't think it can be easily relaxed.  Many other characters are
> operators in Calc and would lead to confusion.

So perhaps my recent commit is wrong.   I did a few tests and found no
problem, but I'm certainly not using calc operators that much.  Please 
feel free to revert commit 76ab4dd422216ff2c574be4586ba161b8c40704e if
necessary...

> But amending the docs is certainly a good idea.

... and commit f893659b272ef80c1da8c0420d55b6237a4c3f00 about the doc.

Thanks!

-- 
 Bastien

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

* Re: Bug: named columns in tables not working if name contains "_"
  2011-08-23 13:53 ` Nick Dokos
                     ` (2 preceding siblings ...)
  2011-08-23 14:35   ` Bastien
@ 2011-08-23 16:24   ` Achim Gratz
  2011-08-24 20:32     ` Michael Brand
  3 siblings, 1 reply; 17+ messages in thread
From: Achim Gratz @ 2011-08-23 16:24 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <nicholas.dokos@hp.com> writes:
> The only characters permitted are alphanumerics. That can probably be
> easily relaxed.

Only if you don't want to have _underlined_ still working and perhaps
never use calc on that table.  The problem with simple syntax is that
the quoting rules become bizarre and the other way around.


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

Wavetables for the Terratec KOMPLEXER:
http://Synth.Stromeko.net/Downloads.html#KomplexerWaves

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

* Re: Bug: named columns in tables not working if name contains "_"
  2011-08-23 16:20     ` Bastien
@ 2011-08-23 16:47       ` Carsten Dominik
  2011-08-23 18:29       ` Carsten Dominik
  1 sibling, 0 replies; 17+ messages in thread
From: Carsten Dominik @ 2011-08-23 16:47 UTC (permalink / raw)
  To: Bastien; +Cc: =?ISO-8859-1?Q?Andr=E1s_Major?=, nicholas.dokos, emacs-orgmode


On 23.8.2011, at 18:20, Bastien wrote:

> Hi Carsten,
> 
> Carsten Dominik <carsten.dominik@gmail.com> writes:
> 
>>> The only characters permitted are alphanumerics. That can probably be
>>> easily relaxed.
>> 
>> Hi Nick, I don't think it can be easily relaxed.  Many other characters are
>> operators in Calc and would lead to confusion.
> 
> So perhaps my recent commit is wrong.   I did a few tests and found no
> problem, but I'm certainly not using calc operators that much.  Please 
> feel free to revert commit 76ab4dd422216ff2c574be4586ba161b8c40704e if
> necessary...

I'll take a look.

- Carsten


> 
>> But amending the docs is certainly a good idea.
> 
> ... and commit f893659b272ef80c1da8c0420d55b6237a4c3f00 about the doc.
> 
> Thanks!
> 
> -- 
> Bastien

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

* Re: Bug: named columns in tables not working if name contains "_"
  2011-08-23 16:20     ` Bastien
  2011-08-23 16:47       ` Carsten Dominik
@ 2011-08-23 18:29       ` Carsten Dominik
  2011-08-23 18:54         ` Bastien
  2011-08-24 20:15         ` Michael Brand
  1 sibling, 2 replies; 17+ messages in thread
From: Carsten Dominik @ 2011-08-23 18:29 UTC (permalink / raw)
  To: Bastien; +Cc: =?ISO-8859-1?Q?Andr=E1s_Major?=, nicholas.dokos, emacs-orgmode


On 23.8.2011, at 18:20, Bastien wrote:

> Hi Carsten,
> 
> Carsten Dominik <carsten.dominik@gmail.com> writes:
> 
>>> The only characters permitted are alphanumerics. That can probably be
>>> easily relaxed.
>> 
>> Hi Nick, I don't think it can be easily relaxed.  Many other characters are
>> operators in Calc and would lead to confusion.
> 
> So perhaps my recent commit is wrong.   I did a few tests and found no
> problem, but I'm certainly not using calc operators that much.  Please 
> feel free to revert commit 76ab4dd422216ff2c574be4586ba161b8c40704e if
> necessary...

I have checked, underscore is aceptable, calc allows it in variables names.
However, I would not recommend adding any more characters to this regexp.

- Carsten


> 
>> But amending the docs is certainly a good idea.
> 
> ... and commit f893659b272ef80c1da8c0420d55b6237a4c3f00 about the doc.
> 
> Thanks!
> 
> -- 
> Bastien

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

* Re: Bug: named columns in tables not working if name contains "_"
  2011-08-23 18:29       ` Carsten Dominik
@ 2011-08-23 18:54         ` Bastien
  2011-08-24 20:15         ` Michael Brand
  1 sibling, 0 replies; 17+ messages in thread
From: Bastien @ 2011-08-23 18:54 UTC (permalink / raw)
  To: Carsten Dominik
  Cc: =?ISO-8859-1?Q?Andr=E1s_Major?=, nicholas.dokos, emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> I have checked, underscore is aceptable, calc allows it in variables
> names.  However, I would not recommend adding any more characters to
> this regexp.

Thanks for the quick feedback!

-- 
 Bastien

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

* Re: Bug: named columns in tables not working if name contains "_"
  2011-08-23 18:29       ` Carsten Dominik
  2011-08-23 18:54         ` Bastien
@ 2011-08-24 20:15         ` Michael Brand
  2011-08-24 20:39           ` Nick Dokos
  1 sibling, 1 reply; 17+ messages in thread
From: Michael Brand @ 2011-08-24 20:15 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: András Major, Bastien, nicholas.dokos, emacs-orgmode

On Tue, Aug 23, 2011 at 20:29, Carsten Dominik
<carsten.dominik@gmail.com> wrote:
> I have checked, underscore is aceptable, calc allows it in variables names.
> However, I would not recommend adding any more characters to this regexp.

Just to mention: Although "_" is the subscript operator that takes the
nth vector element in Calc, I don't mind the change since the formula
below that uses "$vector_1" did also not work before the change
probably because some other regexp to parse the field name already
included "_". And the alternative formula with "subscr($vector, 1)"
seems to be syntactically more robust/flexible/clear/etc. anyway.

|   | [x y]  | x | x | #ERROR | x |
| ^ | vector |   |   |        |   |
#+TBLFM: @<$3 = $2_1 :: @<$4 = subscr($2, 1) :: @<$5 = $vector_1 ::
@<$6 = subscr($vector, 1)

Michael

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

* Re: Bug: named columns in tables not working if name contains "_"
  2011-08-23 16:24   ` Achim Gratz
@ 2011-08-24 20:32     ` Michael Brand
  2011-08-24 20:46       ` Nick Dokos
  0 siblings, 1 reply; 17+ messages in thread
From: Michael Brand @ 2011-08-24 20:32 UTC (permalink / raw)
  To: Achim Gratz; +Cc: emacs-orgmode

On Tue, Aug 23, 2011 at 18:24, Achim Gratz <Stromeko@nexgo.de> wrote:
> Nick Dokos <nicholas.dokos@hp.com> writes:
>> The only characters permitted are alphanumerics. That can probably be
>> easily relaxed.
>
> Only if you don't want to have _underlined_ still working [...]

I use _underlined_ in tables and I'm glad it still works.

Michael

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

* Re: Bug: named columns in tables not working if name contains "_"
  2011-08-24 20:15         ` Michael Brand
@ 2011-08-24 20:39           ` Nick Dokos
  0 siblings, 0 replies; 17+ messages in thread
From: Nick Dokos @ 2011-08-24 20:39 UTC (permalink / raw)
  To: Michael Brand
  Cc: András Major, Bastien, nicholas.dokos, emacs-orgmode,
	Carsten Dominik

Michael Brand <michael.ch.brand@gmail.com> wrote:

> On Tue, Aug 23, 2011 at 20:29, Carsten Dominik
> <carsten.dominik@gmail.com> wrote:
> > I have checked, underscore is aceptable, calc allows it in variables names.
> > However, I would not recommend adding any more characters to this regexp.
> 
> Just to mention: Although "_" is the subscript operator that takes the
> nth vector element in Calc, I don't mind the change since the formula
> below that uses "$vector_1" did also not work before the change
> probably because some other regexp to parse the field name already
> included "_". And the alternative formula with "subscr($vector, 1)"
> seems to be syntactically more robust/flexible/clear/etc. anyway.
> 
> |   | [x y]  | x | x | #ERROR | x |
> | ^ | vector |   |   |        |   |
> #+TBLFM: @<$3 = $2_1 :: @<$4 = subscr($2, 1) :: @<$5 = $vector_1 ::
> @<$6 = subscr($vector, 1)
> 

That's worth recording somewhere in Worg, methinks.

Nick

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

* Re: Bug: named columns in tables not working if name contains "_"
  2011-08-24 20:32     ` Michael Brand
@ 2011-08-24 20:46       ` Nick Dokos
  0 siblings, 0 replies; 17+ messages in thread
From: Nick Dokos @ 2011-08-24 20:46 UTC (permalink / raw)
  To: Michael Brand; +Cc: Achim Gratz, emacs-orgmode, nicholas.dokos

Michael Brand <michael.ch.brand@gmail.com> wrote:

> On Tue, Aug 23, 2011 at 18:24, Achim Gratz <Stromeko@nexgo.de> wrote:
> > Nick Dokos <nicholas.dokos@hp.com> writes:
> >> The only characters permitted are alphanumerics. That can probably be
> >> easily relaxed.
> >
> > Only if you don't want to have _underlined_ still working [...]
> 
> I use _underlined_ in tables and I'm glad it still works.
> 

Yeah, but Achim has a point: do underlined column names work? I'd guess
not if the name contains an underscore.  Does it matter if they don't?
Not to me, but others might disagree.

Nick

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

end of thread, other threads:[~2011-08-24 20:46 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-23 13:20 Bug: named columns in tables not working if name contains "_" András Major
2011-08-23 13:53 ` Nick Dokos
2011-08-23 13:58   ` Bug: named columns in tables not working if name contains András Major
2011-08-23 14:34     ` Bastien
2011-08-23 14:08   ` Bug: named columns in tables not working if name contains "_" Carsten Dominik
2011-08-23 14:32     ` Nick Dokos
2011-08-23 14:49       ` Carsten Dominik
2011-08-23 16:20     ` Bastien
2011-08-23 16:47       ` Carsten Dominik
2011-08-23 18:29       ` Carsten Dominik
2011-08-23 18:54         ` Bastien
2011-08-24 20:15         ` Michael Brand
2011-08-24 20:39           ` Nick Dokos
2011-08-23 14:35   ` Bastien
2011-08-23 16:24   ` Achim Gratz
2011-08-24 20:32     ` Michael Brand
2011-08-24 20:46       ` Nick Dokos

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