emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [org-cite] citekey restrictions?
@ 2021-05-16 10:12 Bruce D'Arcus
  2021-05-16 11:29 ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Bruce D'Arcus @ 2021-05-16 10:12 UTC (permalink / raw)
  To: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 264 bytes --]

I was just interacting with one of the org-roam-bibtex developers about
org-cite.

He noted that citekeys can only start with an underscore or alpha character.

Is that a necessary restriction?

He, it turns out, mostly has keys of the form '2020-DOE-ABC".

Bruce

[-- Attachment #2: Type: text/html, Size: 480 bytes --]

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

* Re: [org-cite] citekey restrictions?
  2021-05-16 10:12 [org-cite] citekey restrictions? Bruce D'Arcus
@ 2021-05-16 11:29 ` Nicolas Goaziou
  2021-05-16 11:41   ` Bruce D'Arcus
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2021-05-16 11:29 UTC (permalink / raw)
  To: Bruce D'Arcus; +Cc: org-mode-email

"Bruce D'Arcus" <bdarcus@gmail.com> writes:

> I was just interacting with one of the org-roam-bibtex developers about
> org-cite.
>
> He noted that citekeys can only start with an underscore or alpha character.
>
> Is that a necessary restriction?
>
> He, it turns out, mostly has keys of the form '2020-DOE-ABC".

It is not a necessary restriction.

What do you suggest as the first character? Underscore, and
alphanumeric? So keys would need to:

  - start with _ or alnum
  - end with _ or alnum
  - optionally contain any alnum or symbol among #$%&+./:<>?_~-

Regards,


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

* Re: [org-cite] citekey restrictions?
  2021-05-16 11:29 ` Nicolas Goaziou
@ 2021-05-16 11:41   ` Bruce D'Arcus
  2021-05-16 12:55     ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Bruce D'Arcus @ 2021-05-16 11:41 UTC (permalink / raw)
  To: Bruce D'Arcus, org-mode-email

On Sun, May 16, 2021 at 7:29 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
> "Bruce D'Arcus" <bdarcus@gmail.com> writes:
>
> > I was just interacting with one of the org-roam-bibtex developers about
> > org-cite.
> >
> > He noted that citekeys can only start with an underscore or alpha character.
> >
> > Is that a necessary restriction?
> >
> > He, it turns out, mostly has keys of the form '2020-DOE-ABC".
>
> It is not a necessary restriction.
>
> What do you suggest as the first character? Underscore, and
> alphanumeric?

I think so; yes.

> So keys would need to:
>
>   - start with _ or alnum
>   - end with _ or alnum
>   - optionally contain any alnum or symbol among #$%&+./:<>?_~-

I'm not super sure of the details around, for example, bibtex, but
this post seems to be helpful to check against for the details?

https://tex.stackexchange.com/questions/388500/what-is-valid-as-a-biblatex-entry-key/388652#388652

Bruce


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

* Re: [org-cite] citekey restrictions?
  2021-05-16 11:41   ` Bruce D'Arcus
@ 2021-05-16 12:55     ` Nicolas Goaziou
  2021-05-16 13:10       ` Bruce D'Arcus
  2021-05-16 18:49       ` Joost Kremers
  0 siblings, 2 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2021-05-16 12:55 UTC (permalink / raw)
  To: Bruce D'Arcus; +Cc: org-mode-email

"Bruce D'Arcus" <bdarcus@gmail.com> writes:

> I'm not super sure of the details around, for example, bibtex, but
> this post seems to be helpful to check against for the details?
>
> https://tex.stackexchange.com/questions/388500/what-is-valid-as-a-biblatex-entry-key/388652#388652

Oh my! You're reviving a 6 years old thread[¹]!

Basically, current syntax is inherited from a previous citation
specification allowing shortcuts: @key instead of [cite:@key].

Since these shortcuts do not exist anymore, we don't need to be so
careful about characters allowed in a key. The only one being dangerous
is the semicolon, since it is used to separate keys in a citation
reference. Closing square bracket could also be problematic if it is not
paired properly. So, to be on a safe side, anything beside space,
semicolon and square brackets are fine.

However, allowing anything means some keys will not be compatible with
some bibliography formats. For example, I doubt BibTeX would appreciate
a percent character in a key. OTOH, we can put the burden of the user's
shoulders.

So... let's get liberal and say a key must match:

  (rx "@" (one-or-more (any word "-.:?!`'/*@+|()<>&_^$#%&~")))

Nothing bad could happen, right?


[¹]  https://lists.gnu.org/archive/html/emacs-orgmode/2015-03/msg00131.html

-- 
Nicolas Goaziou


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

* Re: [org-cite] citekey restrictions?
  2021-05-16 12:55     ` Nicolas Goaziou
@ 2021-05-16 13:10       ` Bruce D'Arcus
  2021-05-16 18:49       ` Joost Kremers
  1 sibling, 0 replies; 7+ messages in thread
From: Bruce D'Arcus @ 2021-05-16 13:10 UTC (permalink / raw)
  To: org-mode-email

On Sun, May 16, 2021 at 8:55 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

> Oh my! You're reviving a 6 years old thread[¹]!

6 years in the TeX world is the blink of an eye!

> ... we can put the burden of the user's shoulders.
>
> So... let's get liberal and say a key must match:
>
>   (rx "@" (one-or-more (any word "-.:?!`'/*@+|()<>&_^$#%&~")))
>
> Nothing bad could happen, right?

Probably not.

As you say, you can put the burden on the user, and can always tighten
it later if something comes up.

Bruce


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

* Re: [org-cite] citekey restrictions?
  2021-05-16 12:55     ` Nicolas Goaziou
  2021-05-16 13:10       ` Bruce D'Arcus
@ 2021-05-16 18:49       ` Joost Kremers
  2021-05-16 21:21         ` Nicolas Goaziou
  1 sibling, 1 reply; 7+ messages in thread
From: Joost Kremers @ 2021-05-16 18:49 UTC (permalink / raw)
  To: emacs-orgmode

 
On Sun, May 16 2021, Nicolas Goaziou wrote:
> However, allowing anything means some keys will not be compatible with
> some bibliography formats. For example, I doubt BibTeX would appreciate
> a percent character in a key.

Careful, trying to find out the details of BibTeX's file format is a quest that
I think no-one has ever returned from. :D I have a comment in =parsebib.el=
saying that BibTeX allows $ ^ and & in entry keys, despite the fact that those
characters are special in TeX...

The regexp =parsebib.el= uses for entry keys is this:

    "[^\"@\\#%',={} \t\n\f]+"

Mind you, I have no idea if BibTeX really rejects all these characters (well,
I'm pretty sure about the white space... :D ), but even if they are acceptable,
they probably don't occur much in the wild. At least I'm not aware of any user
complaints since the time I added support for $^&, which was four years ago,

> So... let's get liberal and say a key must match:
>
>   (rx "@" (one-or-more (any word "-.:?!`'/*@+|()<>&_^$#%&~")))
>
> Nothing bad could happen, right?

On a scale of 1 to 10, 1 being getting an error message and having to go online
to find out what it means, and 10 being the total and utter destruction of our
solar system, I doubt it'll exceed 1.

-- 
Joost Kremers
Life has its moments


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

* Re: [org-cite] citekey restrictions?
  2021-05-16 18:49       ` Joost Kremers
@ 2021-05-16 21:21         ` Nicolas Goaziou
  0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2021-05-16 21:21 UTC (permalink / raw)
  To: Joost Kremers; +Cc: emacs-orgmode

Hello,

Joost Kremers <joostkremers@fastmail.fm> writes:

> On Sun, May 16 2021, Nicolas Goaziou wrote:
>
>> So... let's get liberal and say a key must match:
>>
>>   (rx "@" (one-or-more (any word "-.:?!`'/*@+|()<>&_^$#%&~")))
>>
>> Nothing bad could happen, right?
>
> On a scale of 1 to 10, 1 being getting an error message and having to go online
> to find out what it means, and 10 being the total and utter destruction of our
> solar system, I doubt it'll exceed 1.

What a relief! Thanks.

I changed the syntax for key to the regexp above. I even added curly
brackets. Now, the following is a valid key:

   @{🕮}

I then cleaned-up a bit the branch, and rebased on top of master.

Regards,
-- 
Nicolas Goaziou


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

end of thread, other threads:[~2021-05-16 21:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-16 10:12 [org-cite] citekey restrictions? Bruce D'Arcus
2021-05-16 11:29 ` Nicolas Goaziou
2021-05-16 11:41   ` Bruce D'Arcus
2021-05-16 12:55     ` Nicolas Goaziou
2021-05-16 13:10       ` Bruce D'Arcus
2021-05-16 18:49       ` Joost Kremers
2021-05-16 21:21         ` Nicolas Goaziou

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