emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-up-element does not the same for all structural blocks
@ 2023-01-01 23:19 Alain.Cochard
  2023-01-02  9:24 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Alain.Cochard @ 2023-01-01 23:19 UTC (permalink / raw)
  To: emacs-orgmode


With an org file like

   * h
   #+begin_export ascii
   foo
   #+end_export

putting the cursor on 'foo' and doing

   M-x org-up-element

brings the cursor on '* h'.  Same with the following blocks:

‘#+begin_comment’ ... ‘#+end_comment’
‘#+begin_example’ ... ‘#+end_example’
‘#+begin_export’ ... ‘#+end_export’
‘#+begin_export html’ ... ‘#+end_export’
‘#+begin_export latex’ ... ‘#+end_export’
‘#+begin_src’ ... ‘#+end_src’ (I tried org and lisp)
‘#+begin_verse’ ... ‘#+end_verse’

But for those two blocks:

‘#+begin_center’ ... ‘#+end_center’
‘#+begin_quote’ ... ‘#+end_quote’

the cursor is moved to the beginning of the block instead, which I
find strange.

Incidentally, is there a definition understandable for the basic user
of what an "org element" is?  I could not find one after a (quick)
Internet search, not even in

https://orgmode.org/worg/dev/org-element-api.html
https://orgmode.org/worg/org-syntax.html

(even if I sure it's between the lines...)


-- 
EOST (École et Observatoire des Sciences de la Terre) 
ITE (Institut Terre & Environnement) | alain.cochard@unistra.fr
5 rue René Descartes   [bureau 110]  | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France     | [ slot available for rent ]



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

* Re: org-up-element does not the same for all structural blocks
  2023-01-01 23:19 org-up-element does not the same for all structural blocks Alain.Cochard
@ 2023-01-02  9:24 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2023-01-02  9:24 UTC (permalink / raw)
  To: alain.cochard; +Cc: emacs-orgmode

Alain.Cochard@unistra.fr writes:

> With an org file like
>
>    * h
>    #+begin_export ascii
>    foo
>    #+end_export
>
> putting the cursor on 'foo' and doing
>
>    M-x org-up-element
>
> brings the cursor on '* h'.  Same with the following blocks:
>
> ‘#+begin_comment’ ... ‘#+end_comment’
> ‘#+begin_example’ ... ‘#+end_example’
> ‘#+begin_export’ ... ‘#+end_export’
> ‘#+begin_export html’ ... ‘#+end_export’
> ‘#+begin_export latex’ ... ‘#+end_export’
> ‘#+begin_src’ ... ‘#+end_src’ (I tried org and lisp)
> ‘#+begin_verse’ ... ‘#+end_verse’
>
> But for those two blocks:
>
> ‘#+begin_center’ ... ‘#+end_center’
> ‘#+begin_quote’ ... ‘#+end_quote’
>
> the cursor is moved to the beginning of the block instead, which I
> find strange.

This is to be expected. Center blocks, Quote blocks, and special blocks
are "greater elements", which can directly contain other Org elements
inside. Thus,

#+begin_center
Text
#+end_center

is interpreted as

(center-block (paragraph))

So, `org-up-element' with point at paragraph will move to parent
center-block.

In contrast, comment/example/export/src/verse are "lesser blocks", which
cannot contain other Org elements inside - their contents is taken
verbatim:

#+begin_comment
Text
#+end_comment

is interpreted as

(comment-block)

with point at "Text", current element is comment-block, and its parent
is headline in your example.

> Incidentally, is there a definition understandable for the basic user
> of what an "org element" is?  I could not find one after a (quick)
> Internet search, not even in

https://orgmode.org/worg/org-syntax.html#orgb8e0d51

Also, see https://orgmode.org/worg/org-syntax.html#Greater_Elements

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
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>


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

end of thread, other threads:[~2023-01-02  9:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-01 23:19 org-up-element does not the same for all structural blocks Alain.Cochard
2023-01-02  9:24 ` Ihor Radchenko

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).