Re: [O] Bug: org-insert-structure-template leaves point at inconvenient place [9.1.14 (9.1.14-932-gf82a30-elpaplus @ .emacs.d/elpa/org-plus-contrib-20180923/)]

2018-10-02 Thread Nicolas Goaziou
Hello,

Allen Li  writes:

> That's very interesting.  Perhaps this is too invasive, but maybe C-c
> C-, should do C-c ' automatically?

No, it shouldn't. You can also create non-verbatim blocks, e.g. "center"
with C-c C-,. There C-c ' doesn't do anything useful.

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: org-insert-structure-template leaves point at inconvenient place [9.1.14 (9.1.14-932-gf82a30-elpaplus @ .emacs.d/elpa/org-plus-contrib-20180923/)]

2018-10-02 Thread Allen Li
On Tue, Oct 2, 2018 at 2:14 PM Bernt Hansen  wrote:
>
> Nicolas Goaziou  writes:
>
> > Hello,
> >
> > Allen Li  writes:
> >
> >> org-insert-structure-template (C-c C-,) leaves point at an inconvenient
> >> place (X marks the spot):
> >>
> >> #+begin_example
> >> X#+end_example
> >>
> >> My expectation is that right after inserting the template, I can start
> >> typing or yank right into it:
> >>
> >> #+begin_example
> >> X
> >> #+end_example
> >
> > Use `C-o'.
> >
> > I think the current behaviour is better because you can yank text within
> > the newly created block without dealing with a blank line later on.
>
> I also prefer the current behaviour.
>
> I regularly use C-c C-, e C-c ' C-y C-c '
>
> to create and populate my example blocks.  This handles the newline
> correctly and does not break the syntax.  This also has the benefit of
> properly escaping text that interferes with org's syntax.

That's very interesting.  Perhaps this is too invasive, but maybe C-c
C-, should do C-c ' automatically?

Since the user almost certainly wants to populate the block
immediately, this saves the user a step,
and also handles characters to escape and a missing final newline correctly.

>
> When you have text in the kill buffer that looks like org headlines it
> pastes outside the example block -- which is proper behaviour when
> moving headlines around.
>
> try this:
>
> C-c C-, e C-y
> with the following your yank buffer
>
> 
> *** one
> some text
> *** two
> more text
> 
>
> You can't paste that inside
>
> #begin_example
> #end_example
>
> or
>
> #begin_example
>
> #end_example
>
> Regards,
> Bernt



Re: [O] Bug: org-insert-structure-template leaves point at inconvenient place [9.1.14 (9.1.14-932-gf82a30-elpaplus @ .emacs.d/elpa/org-plus-contrib-20180923/)]

2018-10-02 Thread Bernt Hansen
Nicolas Goaziou  writes:

> Hello,
>
> Allen Li  writes:
>
>> org-insert-structure-template (C-c C-,) leaves point at an inconvenient
>> place (X marks the spot):
>>
>> #+begin_example
>> X#+end_example
>>
>> My expectation is that right after inserting the template, I can start
>> typing or yank right into it:
>>
>> #+begin_example
>> X
>> #+end_example
>
> Use `C-o'.
>
> I think the current behaviour is better because you can yank text within
> the newly created block without dealing with a blank line later on.

I also prefer the current behaviour.

I regularly use C-c C-, e C-c ' C-y C-c '

to create and populate my example blocks.  This handles the newline
correctly and does not break the syntax.  This also has the benefit of
properly escaping text that interferes with org's syntax.

When you have text in the kill buffer that looks like org headlines it
pastes outside the example block -- which is proper behaviour when
moving headlines around.

try this:

C-c C-, e C-y
with the following your yank buffer


*** one
some text
*** two
more text


You can't paste that inside

#begin_example
#end_example

or

#begin_example

#end_example

Regards,
Bernt



Re: [O] Bug: org-insert-structure-template leaves point at inconvenient place [9.1.14 (9.1.14-932-gf82a30-elpaplus @ .emacs.d/elpa/org-plus-contrib-20180923/)]

2018-10-02 Thread Allen Li
On Tue, Oct 2, 2018 at 8:06 AM Nicolas Goaziou  wrote:
>
> Hello,
>
> Allen Li  writes:
>
> > org-insert-structure-template (C-c C-,) leaves point at an inconvenient
> > place (X marks the spot):
> >
> > #+begin_example
> > X#+end_example
> >
> > My expectation is that right after inserting the template, I can start
> > typing or yank right into it:
> >
> > #+begin_example
> > X
> > #+end_example
>
> Use `C-o'.
>
> I think the current behaviour is better because you can yank text within
> the newly created block without dealing with a blank line later on.

But it works less well when you yank text that doesn't have a trailing newline.

Either you need to press C-o in one case, or DEL/backspace in the
other (to get rid of the extra blank line).

I guess I don't have a huge preference, but the current behavior is
annoying because it's the opposite of the old template behavior (e.g.
< s TAB).

One advantage that I can think of is that an extra newline is an
annoyance but otherwise harmless, whereas missing a newline messes up
the syntax.

#+begin_example
yanked text

#+end_example

#+begin_example
yanked text#+end_example

>
> Regards,
>
> --
> Nicolas Goaziou



Re: [O] Bug: org-insert-structure-template leaves point at inconvenient place [9.1.14 (9.1.14-932-gf82a30-elpaplus @ .emacs.d/elpa/org-plus-contrib-20180923/)]

2018-10-02 Thread Nicolas Goaziou
Hello,

Allen Li  writes:

> org-insert-structure-template (C-c C-,) leaves point at an inconvenient
> place (X marks the spot):
>
> #+begin_example
> X#+end_example
>
> My expectation is that right after inserting the template, I can start
> typing or yank right into it:
>
> #+begin_example
> X
> #+end_example

Use `C-o'.

I think the current behaviour is better because you can yank text within
the newly created block without dealing with a blank line later on.

Regards,

-- 
Nicolas Goaziou