Dear all,

Consider

  - Is this the first sentence?  There is another.
  - This is the third sentence.
  - Some
  - are
  - over several lines!

  (plain-list
   (item)
   (item)
   (item)
   (item)
   (item))

or

This is the first line
- This is a list item.

(paragraph)
(plain-list (item))

Should sentence movement commands in Org stop at the syntax element
boundaries? Currently, except special cases for headline, tables, and
spaces after elements, Org simply calls forward-sentence from Emacs,
which will looks for punctuation like ".", "?", or "!" to find the end
of sentence.

Best,
Ihor

Ihor Radchenko <[email protected]> writes:

> Christian Moe <[email protected]> writes:
>
>>>>> +- Is this the first sentence?  There is another.
>>>>> +- This is the third sentence.
>>>>> +- Some
>>>>> +- are
>>>>> +- over several lines!
>>>> I am wondering whether it is correct to return sentence constructed from
>>>> multiple items.
>>>
>>> I'm happy to constrain it to the current item (which is how I personally
>>> think of it, too), but org-forward-sentence goes beyond item boundaries,
>>> so I felt like I should start by following the same semantics.
>>
>> Same semantics sounds like a good thing, and org-forward-sentence should
>> in turn probably behave like forward-sentence, modulo Org syntax.
>> ...
>> The above example raises a different question, though: With point
>> somewhere on "Remember to bring", org-forward-sentence moves point only
>> to the end of that paragraph element, even though it has no end
>> punctuation (and isn't a complete sentence). However, it does not have
>> not have a problem including the paragraph element /after/ the list,
>> with or without a blank line between them. It would be satisfying if it
>> could handle the preceding one too.
>
> This is tricky. forward-sentence does
>
>    Move forward to next end of sentence.  With argument, repeat.
>
>    When ARG is negative, move backward repeatedly to start of sentence.
>
>    The variable sentence-end is a regular expression that matches ends of
>    sentences.  Also, every paragraph boundary terminates sentences as well.
>
> So, we have two stops for end of sentence: (1) sentence end
> punctuation; OR (2) paragraph boundary.
>
>>> I can imagine a situation when I want it to be limited to the current
>>> item, and when I want it to go beyond. For example, I originally came
>>> across this behavior when I was trying to split up sentences from both
>>> paragraphs and lists for practising a foreign language, and some of the
>>> list items were phrases instead of sentences, so it would make sense to
>>> keep the items separate. On the other hand, sometimes you just break up
>>> a sentence into several bullet points for readability, but you want to
>>> treat it as a single sentence logically.
>>
>> I think this is the right behavior. If the user wants list items to be
>> treated as complete sentences, they can use end punctuation.
>>
>> Perhaps this example is easier to think with, as it's unequivocally all
>> one sentence, though it spans three Org elements:
>>
>>   Remember to bring
>>   - a raincoat
>>   - warm socks
>>   - a packed lunch
>>   with you on the hike.
>
> Here, we have a bit of a clash with Org terminology.
> Is a list item paragraph boundary? Is a plain list paragraph boundary?
>
> For Org syntax, the above example is
> (paragraph)
> (plain list
>   (item (paragraph))
>   (item (paragraph))
>   (item (paragraph)))
> (paragraph)
>
> On the other hand, I can see how it is also a full single (!) sentence
> in normal writing.
>
> What about
>
> In the following code snippet, we do ...
> #+begin_src emacs-lisp
>   (message "Foo")
> #+end_src
> where ~message~ is a function...
>
> Is the above also a single sentence?
>
> -- 
> Ihor Radchenko // yantar92,
> Org mode maintainer,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>

-- 
Ihor Radchenko // yantar92,
Org mode maintainer,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to