emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* 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  0:01 Allen Li
  2018-10-02  8:06 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Allen Li @ 2018-10-02  0:01 UTC (permalink / raw)
  To: Org Mode List

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

Emacs  : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.22.24), modified by Debian
Package: Org mode version 9.1.14 (9.1.14-932-gf82a30-elpaplus @
/usr/local/google/home/ayatane/.emacs.d/elpa/org-plus-contrib-20180923/)

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

* Re: 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  0:01 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/)] Allen Li
@ 2018-10-02  8:06 ` Nicolas Goaziou
  2018-10-02  8:41   ` Allen Li
  2018-10-02 14:14   ` Bernt Hansen
  0 siblings, 2 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2018-10-02  8:06 UTC (permalink / raw)
  To: Allen Li; +Cc: Org Mode List

Hello,

Allen Li <darkfeline@felesatra.moe> 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

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

* Re: 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  8:06 ` Nicolas Goaziou
@ 2018-10-02  8:41   ` Allen Li
  2018-10-02 14:14   ` Bernt Hansen
  1 sibling, 0 replies; 6+ messages in thread
From: Allen Li @ 2018-10-02  8:41 UTC (permalink / raw)
  To: Org Mode List

On Tue, Oct 2, 2018 at 8:06 AM Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
>
> Hello,
>
> Allen Li <darkfeline@felesatra.moe> 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

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

* Re: 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  8:06 ` Nicolas Goaziou
  2018-10-02  8:41   ` Allen Li
@ 2018-10-02 14:14   ` Bernt Hansen
  2018-10-02 19:16     ` Allen Li
  1 sibling, 1 reply; 6+ messages in thread
From: Bernt Hansen @ 2018-10-02 14:14 UTC (permalink / raw)
  To: Allen Li; +Cc: Org Mode List

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Allen Li <darkfeline@felesatra.moe> 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

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

* Re: 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 14:14   ` Bernt Hansen
@ 2018-10-02 19:16     ` Allen Li
  2018-10-02 19:35       ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Allen Li @ 2018-10-02 19:16 UTC (permalink / raw)
  To: bernt; +Cc: Org Mode List

On Tue, Oct 2, 2018 at 2:14 PM Bernt Hansen <bernt@norang.ca> wrote:
>
> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
> > Hello,
> >
> > Allen Li <darkfeline@felesatra.moe> 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

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

* Re: 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 19:16     ` Allen Li
@ 2018-10-02 19:35       ` Nicolas Goaziou
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2018-10-02 19:35 UTC (permalink / raw)
  To: Allen Li; +Cc: bernt, Org Mode List

Hello,

Allen Li <darkfeline@felesatra.moe> 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

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

end of thread, other threads:[~2018-10-02 19:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-02  0:01 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/)] Allen Li
2018-10-02  8:06 ` Nicolas Goaziou
2018-10-02  8:41   ` Allen Li
2018-10-02 14:14   ` Bernt Hansen
2018-10-02 19:16     ` Allen Li
2018-10-02 19:35       ` 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).