* org-tempo insertion incoherence (lack of indentation) or misunderstanding
@ 2020-09-07 5:15 Bruno BEAUFILS
2020-10-01 17:31 ` Rasmus
0 siblings, 1 reply; 2+ messages in thread
From: Bruno BEAUFILS @ 2020-09-07 5:15 UTC (permalink / raw)
To: emacs-orgmode; +Cc: Bruno BEAUFILS
[-- Attachment #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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: org-tempo insertion incoherence (lack of indentation) or misunderstanding
2020-09-07 5:15 org-tempo insertion incoherence (lack of indentation) or misunderstanding Bruno BEAUFILS
@ 2020-10-01 17:31 ` Rasmus
0 siblings, 0 replies; 2+ messages in thread
From: Rasmus @ 2020-10-01 17:31 UTC (permalink / raw)
To: emacs-orgmode
Hi Bruno,
Bruno BEAUFILS <bruno@boulgour.com> writes:
> 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?
Whether the inserted block is indented depends on ‘org-get-indentation’
and thus the cursor’s position, at least in some cases.
In particular, if | is the cursor, run org-get-indentation for these two
examples to understand when you get indentation and when not:
1.
- a
|
2:
- a
|
In 1. you are making a new block outside the list, in 2. it is part of the
first item of the list. Both are valid.
> 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?
You can have any amount of whitespace before expanding something a tempo
snippet. You can’t have anything but whitespace before expanding a tempo
snippet as a block must be the only thing on the line.
(there does appear to be a bug in expanding when there’s something after
the snippet:
- a
<e| b
I’m not sure what is the right thing to do with “b” in this case.)
> 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.
AFAICT everything is working as expected.
Kind regards,
Rasmus
--
Even a three-legged dog has three good legs to lose
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-01 18:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-07 5:15 org-tempo insertion incoherence (lack of indentation) or misunderstanding Bruno BEAUFILS
2020-10-01 17:31 ` Rasmus
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).