Re: block folding - should this work?

2021-12-29 Thread Tim Cross


Robert Nikander  writes:

> I started reading about “blocks" in the manual. I wanted a chunk of text that 
> I could hide, so I tried this:
>
> * Test
> Some text
> #+BEGIN 
> Hide this
> #+END
>
> Hitting TAB on the BEGIN line does nothing. But if I add a blank line before 
> it,
> then hitting TAB hides and shows the block. Is that a bug? Or am I doing it
> wrong? Seems like it should work without the blank line.
>
> * Test
> Some text
>
> #+BEGIN 
> Hide this
> #+END
>
> M-x org-version => 9.5.1.

The problem here is that your blocks are not correctly specified. If you
run M-x org-lint on your example, it will tell you the blocks may not be
correctly specified. You need to tell org what sort of block it is. Org
supports a number of different block types, such as source code blocks
(#+begin_src/#+end_src), example blocks (#+begin_example/#+end_example),
centred blocks (#+begin_center/#+end_center) etc. You can use C-c C-, to
run the command org-insert-structured-template to select the block type.
If you first highlight the region, it will be wrapped in the block you
select.




Re: block folding - should this work?

2021-12-24 Thread tomas
On Fri, Dec 24, 2021 at 04:21:58PM -0500, Robert Nikander wrote:
> I started reading about “blocks" in the manual. I wanted a chunk of text that 
> I could hide, so I tried this:
> 
> * Test
> Some text
> #+BEGIN 
> Hide this
> #+END
> 
> Hitting TAB on the BEGIN line does nothing. But if I add a blank line before 
> it, then hitting TAB hides and shows the block. Is that a bug? Or am I doing 
> it wrong? Seems like it should work without the blank line.
> 
> * Test
> Some text
> 
> #+BEGIN 
> Hide this
> #+END
> 
> M-x org-version => 9.5.1.

Ah. You have to decide on a concrete /kind/ of block.
So try:

  #+begin_example
  This is a small example
  with two lines
  #+end_example

(BTW. I seem to remember that Org prefers to spell those things in lower
case these days, as in my example).

There are some block kinds which Org "knows about" and treats specially,
like _example, _quote, _center, _src and so on.

Cheers
-- 
t


signature.asc
Description: PGP signature


block folding - should this work?

2021-12-24 Thread Robert Nikander
I started reading about “blocks" in the manual. I wanted a chunk of text that I 
could hide, so I tried this:

* Test
Some text
#+BEGIN 
Hide this
#+END

Hitting TAB on the BEGIN line does nothing. But if I add a blank line before 
it, then hitting TAB hides and shows the block. Is that a bug? Or am I doing it 
wrong? Seems like it should work without the blank line.

* Test
Some text

#+BEGIN 
Hide this
#+END

M-x org-version => 9.5.1.