all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* org-tempo question
@ 2020-09-24 13:30 Bruno BEAUFILS
  2020-09-24 16:54 ` Nick Dokos
  2020-09-24 17:17 ` Jeremie Juste
  0 siblings, 2 replies; 4+ messages in thread
From: Bruno BEAUFILS @ 2020-09-24 13:30 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bruno BEAUFILS


[-- Attachment #1.1: Type: text/plain, Size: 87 bytes --]

Does anyone have any idea where I can look to understand that?

-- 
Bruno BEAUFILS

[-- Attachment #1.2: Type: message/rfc822, Size: 6330 bytes --]

[-- Attachment #1.2.1.1: Type: text/plain, Size: 1778 bytes --]

Let us imagine this simple org file :

#+NAME: first
#+begin_src org
- an item
  - subitem

#+end_src

If the cursor is at the last line and I want to insert an org block,
let's say an example, using org-tempo feature, I can type =<e=
followed by tabulation.

In that case I get something like 

#+NAME: second
#+begin_src org
- an item
  - subitem
#+begin_example

#+end_example
#+end_src

However if I get indentation role (for instance in exports) well I do
not expect that but instead something like:

#+NAME: third
#+begin_src org
- an item
  - subitem
    #+begin_example

    #+end_example
#+end_src

Are my expectations (and thus my use of indentation by org-mode
understandings) wrong or is it a bug?


In the same spirit if before trying that I type tabulation then =<e=
then tabulation again, nothing is inserted, aka org-tempo seems to work
only when cursor is at the beginning of line.

Am I right? Is it a feature or a bug?

I expected that the example block would have been inserted /correctly/
indented as in my third example above.


The only solution I found for getting things right is to type spaces
instead of tabulation to let my cursor go to the right column.

Let us consider this snippet.

#+NAME: fourth
#+begin_src org
- an item
  - subitem
    H
#+end_src

If the cursor is in the =H= position, then if I type =<e= then
tabulation everything seems right and I get the same result as in
<<third>>.

Any help would appreciated.

I use GNU Emacs 26.3 from Debian GNU bullseye (testing) and what I
think is the last org-mode version from ELPA.

#+begin_src 
Org mode version 9.3.7 (9.3.7-55-gba2405-elpa @ /home/bruno/.emacs.d/elpa/org-20200907/)
#+end_src

-- 
Bruno BEAUFILS

[-- Attachment #1.2.1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: org-tempo question
  2020-09-24 13:30 org-tempo question Bruno BEAUFILS
@ 2020-09-24 16:54 ` Nick Dokos
  2020-09-24 18:18   ` Jeremie Juste
  2020-09-24 17:17 ` Jeremie Juste
  1 sibling, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2020-09-24 16:54 UTC (permalink / raw)
  To: emacs-orgmode

I can't say anything about indentation (I encounter problems that I
have not reported because of lack of time to investigate combined with
laziness - but I suspect they are, partly at least, of my own making).

But when I do `<e TAB' inside a block, I get a properly quoted (though
badly indented) example block, with commas before the #+begin and the
#+end_example lines - OTOH, `<e TAB' outside a block gives me a
no-indent example block even if I have spaces before the `<e' - if I
have printable charactes before the `<e', it does not get expanded:


--8<---------------cut here---------------start------------->8---
#+NAME: third
#+begin_src org

    - an item
      - subitem

      ,#+begin_example

  ,#+end_example

#+end_src

#+begin_example

#+end_example


--8<---------------cut here---------------end--------------->8---

The commas are important: are you not getting them?

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler



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

* Re: org-tempo question
  2020-09-24 13:30 org-tempo question Bruno BEAUFILS
  2020-09-24 16:54 ` Nick Dokos
@ 2020-09-24 17:17 ` Jeremie Juste
  1 sibling, 0 replies; 4+ messages in thread
From: Jeremie Juste @ 2020-09-24 17:17 UTC (permalink / raw)
  To: Bruno BEAUFILS; +Cc: emacs-orgmode

Hello Bruno,

Thanks for your mail. I have been missing this feature that was taken
out of core. I will have to keep up with the modulation of org-mode but
it is for the better.


Regarding your concern 
> In the same spirit if before trying that I type tabulation then =<e=
> then tabulation again, nothing is inserted, aka org-tempo seems to work
> only when cursor is at the beginning of line.
I cannot reproduce it. That is

#+BEGIN_SRC
* headline 1
   - item
   <s
#+end_src
Pressing tab after the s works fine. I recall there was a time that
the cursor had to be at the begining of the line for the template to
work but it is not the case anymore. As far as I'm concerned I prefer
the new behavior.

The [1] doc does not mention that the cursor needs to be at the begining
of the line. So I guess it is an expected behavior.

HTH,
Jeremie

[1] https://orgmode.org/manual/Structure-Templates.html


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

* Re: org-tempo question
  2020-09-24 16:54 ` Nick Dokos
@ 2020-09-24 18:18   ` Jeremie Juste
  0 siblings, 0 replies; 4+ messages in thread
From: Jeremie Juste @ 2020-09-24 18:18 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode


Hello Nick,

Thanks for the feedback. I'm not sure I understand your setting
entirely. I have reproduced the behaviour of tempo
inside an org src block below. I don't have any comma before the
source block expansion unless I type it.

Any character except space or tab on the line of the expansion
destroys it. For example item 2 below. I have noted that the example block
on item 3 doesn not expand at all  (item 3). My normal usage is
generally the item 1 case and I get the expected behavior.


#+BEGIN_SRC org

* heading 1 (cursor position)
  <s
  
  - item 1
    <e  
       
  - item 2
    , <s

  - item 3
    , <e

* heading 1 (expansion)
  #+BEGIN_SRC R

  #+end_src

  - item 1
    #+begin_example

    #+end_example
  
  - item 2
    , #+BEGIN_SRC 

  #+end_src 
  - item 3
    , <e
#+end_src

HTH,

Jeremie
- GNU Emacs 28.0.50
- Org mode version 9.4

  
Nick Dokos <ndokos@gmail.com> writes:

> I can't say anything about indentation (I encounter problems that I
> have not reported because of lack of time to investigate combined with
> laziness - but I suspect they are, partly at least, of my own making).
>
> But when I do `<e TAB' inside a block, I get a properly quoted (though
> badly indented) example block, with commas before the #+begin and the
> #+end_example lines - OTOH, `<e TAB' outside a block gives me a
> no-indent example block even if I have spaces before the `<e' - if I
> have printable charactes before the `<e', it does not get expanded:
>
> #+NAME: third
> #+begin_src org
>
>     - an item
>       - subitem
>
>       ,#+begin_example
>
>   ,#+end_example
>
> #+end_src
>
> #+begin_example
>
> #+end_example
>
>
> The commas are important: are you not getting them?


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

end of thread, other threads:[~2020-09-24 18:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-24 13:30 org-tempo question Bruno BEAUFILS
2020-09-24 16:54 ` Nick Dokos
2020-09-24 18:18   ` Jeremie Juste
2020-09-24 17:17 ` Jeremie Juste

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.