Thanks for that, Wolfgang. I can only hope that, as the culprit is known, it can be apprehended!

Idris: here is the document that I had sent (and many thanks to you and to Pablo for the more general advice):

 \unexpanded\def\doVariant#1#2#3%
      {\startlinenote[#1]{#2] #3}#2\stoplinenote[#1]}

   \newcounter\countvariants
   \unexpanded\def\variant
      {\doglobal\increment\countvariants
       \normalexpanded{\doVariant{Varia:\countvariants}}}

\setupalign[r2l]

\showframe \starttext 

\section{Correct}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque molestie dictum quam non congue. Integer ut dolor vel mi vestibulum molestie vel et nulla. Morbi id justo vitae quam rhoncus tincidunt ut adipiscing nisi.

\section{Incorrect}
\startlinenumbering
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque molestie dictum quam non congue. Integer ut dolor vel mi vestibulum molestie vel et nulla. Morbi id justo vitae quam rhoncus tincidunt ut adipiscing nisi.
\stoplinenumbering

\stoptext

All the best,
Talal

On 1 Aug 2015, at 19:47, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:

1. August 2015 17:37
Sorry to pester, but this problem is barring me from moving my book project into ConTeXt this weekend.

The use of linenumbers seems to throw off the R2L mechanism. Example of the problem attached. 


The culprit is the function "boxed.stage_two" in page.lua which output each text line in the line numbering
environment in left to right mode. When you have justified lines everything is fine but when you have a ragged
line (e.g. the last line in a paragraph) ConTeXt aligns the context with the left margin.

\starttext \showframe

\startalignment[righttoleft,flushleft]

    \input ward

    \blank

    \startlinenumbering
    \input ward
    \stoplinenumbering

\stopalignment

\stoptext

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________