emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* verbatim and apostrophes
@ 2014-02-12 13:24 Alan Schmitt
  2014-02-12 21:11 ` Samuel Wales
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Schmitt @ 2014-02-12 13:24 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I want to generate some verbatim/code inline text that contains an
apostrophe (I want to talk about the ocaml type 'a ref). Unfortunately I
don't know how to do this. I tried:

- ~'a ref~
- ='a ref=
- ~\' a ref~
- =\'a ref=

The first two display everything (including the '~' or '=') but not as
code, the last two work but display the backquote.

I feel like I'm missing something obvious. Could someone enlighten me?

Thanks,

Alan

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

* Re: verbatim and apostrophes
  2014-02-12 13:24 verbatim and apostrophes Alan Schmitt
@ 2014-02-12 21:11 ` Samuel Wales
  2014-02-13  7:05   ` Alan Schmitt
  0 siblings, 1 reply; 9+ messages in thread
From: Samuel Wales @ 2014-02-12 21:11 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: emacs-orgmode

org-emphasis-regexp-components

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

The disease DOES progress.  MANY people have died from it.  ANYBODY can get it.

Denmark: free Karina Hansen NOW.

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

* Re: verbatim and apostrophes
  2014-02-12 21:11 ` Samuel Wales
@ 2014-02-13  7:05   ` Alan Schmitt
  2014-02-13 12:27     ` Nick Dokos
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Schmitt @ 2014-02-13  7:05 UTC (permalink / raw)
  To: Samuel Wales; +Cc: emacs-orgmode

Hello Samuel,

Samuel Wales <samologist@gmail.com> writes:

> org-emphasis-regexp-components

Thank you for the suggestion. I'm trying to make sense of it:

--8<---------------cut here---------------start------------->8---
org-emphasis-regexp-components is a variable defined in `org.el'.
Its value is (" 	('\"{" "- 	.,:!?;'\")}\\" " 	
,\"'" "." 1)

Documentation:
Components used to build the regular expression for emphasis.
This is a list with five entries.  Terminology:  In an emphasis string
like " *strong word* ", we call the initial space PREMATCH, the final
space POSTMATCH, the stars MARKERS, "s" and "d" are BORDER characters
and "trong wor" is the body.  The different components in this variable
specify what is allowed/forbidden in each part:

pre          Chars allowed as prematch.  Beginning of line will be allowed too.
post         Chars allowed as postmatch.  End of line will be allowed too.
border       The chars *forbidden* as border characters.
body-regexp  A regexp like "." to match a body character.  Don't use
             non-shy groups here, and don't allow newline here.
newline      The maximum number of newlines allowed in an emphasis exp.

You need to reload Org or to restart Emacs after customizing this.
--8<---------------cut here---------------end--------------->8---

I see that "body-regexp" is "." so the problem is not from there. I also
see that "'" is forbidden as a border character, which should be fine in
my case as I'm using "~". So is the problem that "'" is both in prematch
and postmatch? But in my case I use it as a body character.

So I'm afraid I don't understand why the "'" in ~'a ref~ is not accepted
as a body character, and what I should do to make sure it is.

Thanks,

Alan

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

* Re: verbatim and apostrophes
  2014-02-13  7:05   ` Alan Schmitt
@ 2014-02-13 12:27     ` Nick Dokos
  2014-02-13 12:40       ` Nick Dokos
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Dokos @ 2014-02-13 12:27 UTC (permalink / raw)
  To: emacs-orgmode

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Hello Samuel,
>
> Samuel Wales <samologist@gmail.com> writes:
>
>> org-emphasis-regexp-components
>
> Thank you for the suggestion. I'm trying to make sense of it:
>
> org-emphasis-regexp-components is a variable defined in `org.el'.
> Its value is (" 	('\"{" "- 	.,:!?;'\")}\\" " 	
> ,\"'" "." 1)
>
> Documentation:
> Components used to build the regular expression for emphasis.
> This is a list with five entries.  Terminology:  In an emphasis string
> like " *strong word* ", we call the initial space PREMATCH, the final
> space POSTMATCH, the stars MARKERS, "s" and "d" are BORDER characters
> and "trong wor" is the body.  The different components in this variable
> specify what is allowed/forbidden in each part:
>
> pre          Chars allowed as prematch.  Beginning of line will be allowed too.
> post         Chars allowed as postmatch.  End of line will be allowed too.
> border       The chars *forbidden* as border characters.
> body-regexp  A regexp like "." to match a body character.  Don't use
>              non-shy groups here, and don't allow newline here.
> newline      The maximum number of newlines allowed in an emphasis exp.
>
> You need to reload Org or to restart Emacs after customizing this.
>
> I see that "body-regexp" is "." so the problem is not from there. I also
> see that "'" is forbidden as a border character, which should be fine in
> my case as I'm using "~". So is the problem that "'" is both in prematch
> and postmatch? But in my case I use it as a body character.
>
> So I'm afraid I don't understand why the "'" in ~'a ref~ is not accepted
> as a body character, and what I should do to make sure it is.
>

See if

  http://article.gmane.org/gmane.emacs.orgmode/73036/match=org+emphasis+regexp+components

can help make some sense out of the line noise (although it was
triggered by a different question). I believe the problem here is
the BORDER regexp (the one that goes

" 	
,\"'"

above), not the BODY one: it forbids newlines, commas, double
and single quotes. Try deleting the single quote from it.

-- 
Nick

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

* Re: verbatim and apostrophes
  2014-02-13 12:27     ` Nick Dokos
@ 2014-02-13 12:40       ` Nick Dokos
  2014-02-14  8:21         ` Alan Schmitt
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Dokos @ 2014-02-13 12:40 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> Alan Schmitt <alan.schmitt@polytechnique.org> writes:
>
>> Hello Samuel,
>>
>> Samuel Wales <samologist@gmail.com> writes:
>>
>>> org-emphasis-regexp-components
>>
>> Thank you for the suggestion. I'm trying to make sense of it:
>>
>> org-emphasis-regexp-components is a variable defined in `org.el'.
>> Its value is (" 	('\"{" "- 	.,:!?;'\")}\\" " 	
>> ,\"'" "." 1)
>>
>> Documentation:
>> Components used to build the regular expression for emphasis.
>> This is a list with five entries.  Terminology:  In an emphasis string
>> like " *strong word* ", we call the initial space PREMATCH, the final
>> space POSTMATCH, the stars MARKERS, "s" and "d" are BORDER characters
>> and "trong wor" is the body.  The different components in this variable
>> specify what is allowed/forbidden in each part:
>>
>> pre          Chars allowed as prematch.  Beginning of line will be allowed too.
>> post         Chars allowed as postmatch.  End of line will be allowed too.
>> border       The chars *forbidden* as border characters.
>> body-regexp  A regexp like "." to match a body character.  Don't use
>>              non-shy groups here, and don't allow newline here.
>> newline      The maximum number of newlines allowed in an emphasis exp.
>>
>> You need to reload Org or to restart Emacs after customizing this.
>>
>> I see that "body-regexp" is "." so the problem is not from there. I also
>> see that "'" is forbidden as a border character, which should be fine in
>> my case as I'm using "~". So is the problem that "'" is both in prematch
>> and postmatch? But in my case I use it as a body character.
>>
>> So I'm afraid I don't understand why the "'" in ~'a ref~ is not accepted
>> as a body character, and what I should do to make sure it is.
>>
>
> See if
>
>   http://article.gmane.org/gmane.emacs.orgmode/73036/match=org+emphasis+regexp+components
>
> can help make some sense out of the line noise (although it was
> triggered by a different question). I believe the problem here is
> the BORDER regexp (the one that goes
>
> " 	
> ,\"'"
>
> above), not the BODY one: it forbids newlines, commas, double
> and single quotes. Try deleting the single quote from it.


Sorry - I need coffee. I read what you wrote and promptly forgot
all of it. So ignore most of what I wrote.

However, the part about the BORDER regexp is correct I believe: in ~'a ref~,
the ~ are the MARKERS; ' and f are the BORDER and "a re" is the BODY.

-- 
Nick

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

* Re: verbatim and apostrophes
  2014-02-13 12:40       ` Nick Dokos
@ 2014-02-14  8:21         ` Alan Schmitt
  2014-03-04  9:53           ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Schmitt @ 2014-02-14  8:21 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

Hi Nick,

Nick Dokos <ndokos@gmail.com> writes:

> However, the part about the BORDER regexp is correct I believe: in ~'a ref~,
> the ~ are the MARKERS; ' and f are the BORDER and "a re" is the BODY.

Thank you, this is it. I had not understood that BORDERs were inside the
MARKERs (although the help text is quite clear in that regard).

Is there a nice way to customize `org-emphasis-regexp-components'? It
does not seem to be exposed to `customize-variable', and copying and
tweaking its default value in my configuration file feels ugly.

Alan

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

* Re: verbatim and apostrophes
  2014-02-14  8:21         ` Alan Schmitt
@ 2014-03-04  9:53           ` Bastien
  2014-03-04 11:07             ` Alan Schmitt
  0 siblings, 1 reply; 9+ messages in thread
From: Bastien @ 2014-03-04  9:53 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: Nick Dokos, emacs-orgmode

Hi Alan,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> Is there a nice way to customize `org-emphasis-regexp-components'? It
> does not seem to be exposed to `customize-variable', and copying and
> tweaking its default value in my configuration file feels ugly.

Well, preventing users from shooting them in the foot is part of why
`org-emphasis-regexp-components' is not a custom variable (it used to
be, but that led to lots of confusion.)

I hope we can get rid of this variable one day or another.

In the meantime, copying and tweaking is the way to go...

HTH,

-- 
 Bastien

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

* Re: verbatim and apostrophes
  2014-03-04  9:53           ` Bastien
@ 2014-03-04 11:07             ` Alan Schmitt
  2014-03-19 11:23               ` Bastien
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Schmitt @ 2014-03-04 11:07 UTC (permalink / raw)
  To: Bastien; +Cc: Nick Dokos, emacs-orgmode

Hi Bastien,

Bastien <bzg@gnu.org> writes:

> Hi Alan,
>
> Well, preventing users from shooting them in the foot is part of why
> `org-emphasis-regexp-components' is not a custom variable (it used to
> be, but that led to lots of confusion.)
>
> I hope we can get rid of this variable one day or another.

I don't see how to do it cleanly without some form of escaping (to allow
anything to be quoted), which goes against the "verbatim" idea.

A suggestion could be to allow any text inside the markers, except for
the marker itself which would need to be escaped. Escaping could take
the form of doubling the marker:

~"foo bar"~ --> "foo bar"
~"foo ~~ bar"~ --> "foo ~ bar"

As I've not thought this through, I'm pretty sure someone will find a
huge flaw in this suggestion.

Best,

Alan

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

* Re: verbatim and apostrophes
  2014-03-04 11:07             ` Alan Schmitt
@ 2014-03-19 11:23               ` Bastien
  0 siblings, 0 replies; 9+ messages in thread
From: Bastien @ 2014-03-19 11:23 UTC (permalink / raw)
  To: Alan Schmitt; +Cc: Nick Dokos, emacs-orgmode

Hi Alan,

Alan Schmitt <alan.schmitt@polytechnique.org> writes:

> A suggestion could be to allow any text inside the markers, except for
> the marker itself which would need to be escaped. Escaping could take
> the form of doubling the marker:
>
> ~"foo bar"~ --> "foo bar"
> ~"foo ~~ bar"~ --> "foo ~ bar"
>
> As I've not thought this through, I'm pretty sure someone will find a
> huge flaw in this suggestion.

Well, the huge flaw will never be obvious with such solutions...
because the flaw is precisely this: it hides huge flaws.

(Do not bother parsing the above, I'm not sure myself.)

FWIW here is my gut reaction: I'm not a fan (euphemism) of escaping
here, I feel like it adds little value while bumping complexity too
much.

But exploring it might be worth it, if someone wants to try!

-- 
 Bastien

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

end of thread, other threads:[~2014-03-19 11:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-12 13:24 verbatim and apostrophes Alan Schmitt
2014-02-12 21:11 ` Samuel Wales
2014-02-13  7:05   ` Alan Schmitt
2014-02-13 12:27     ` Nick Dokos
2014-02-13 12:40       ` Nick Dokos
2014-02-14  8:21         ` Alan Schmitt
2014-03-04  9:53           ` Bastien
2014-03-04 11:07             ` Alan Schmitt
2014-03-19 11:23               ` Bastien

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