emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: pva-outdoor@yandex.ru
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] incorrect org-mode dynamic blocks docs [9.5.4 (release_9.5.4-3-g6dc785 @ /usr/local/share/emacs/29.0.50/lisp/org/)]
Date: Sat, 01 Jul 2023 10:23:43 +0000	[thread overview]
Message-ID: <87cz1corps.fsf@localhost> (raw)
In-Reply-To: <87a5wij05o.fsf@yandex.ru>

pva-outdoor@yandex.ru writes:

> 1. It seems that dynamic blocks can't have inner headlines (the
> org-dblock-write:xxx should not produce them). Otherwise the block will
> be parsed incorrectly (not mentioned in docs for org-mode).

That's Org markup. Headings have the top priority - any "*...* "
starting at the beginning of line is a heading that ends at the next
"*...* " or end of buffer.

> Example: Create the following 1.org and export it to unicode text (press
> C-c C-e t U). You will see "#+BEGIN: block2" as text.
>
>   * Block2
>   
>   #+BEGIN: block2
>   ** Section 1
>   asdasdsad
>   #+END:

There is no block in the above example.
What you have is

<Block2 heading start>
* Block2

<paragraph start>
#+BEGIN: block2
<paragraph end>
<Section 1 heading start>
** Section 1
<paragraph start>
asdasdsad
#+END:
<paragraph end>
<Section 1 heading end>
<Block2 heading end>

We intentionally do not prohibit such scenario for dynamic block
functions to keep flexibility.
   
> 2. Org-mode info file says:
>
>      Dynamic blocks, like any other block, can be narrowed with
>   ‘org-narrow-to-block’.
>
> That would not work because of implementation of org-narrow-to-block:
>
> (defun org-narrow-to-block ()
>   "Narrow buffer to the current block."
>   (interactive)
>   (let* ((case-fold-search t)
> 	 (blockp (org-between-regexps-p "^[ \t]*#\\+begin_.*"  <----
> 					"^[ \t]*#\\+end_.*")))
>     (if blockp
> 	(narrow-to-region (car blockp) (cdr blockp))
>       (user-error "Not in a block"))))

Agree.
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=85aa3c185

> There is also a minor bug in org-mode (sould I report it
> in it's own mail?):
>
> If you press C-c C-, [RET] [RET] You'll get:
>
> #+begin_
> #+end_nil
>
> while one could expect either begin_nil or end_. 

An error will be thrown now.
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=64a0a624d

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


  reply	other threads:[~2023-07-01 10:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29  5:41 [BUG] incorrect org-mode dynamic blocks docs [9.5.4 (release_9.5.4-3-g6dc785 @ /usr/local/share/emacs/29.0.50/lisp/org/)] pva-outdoor
2023-07-01 10:23 ` Ihor Radchenko [this message]
     [not found]   ` <87wmzjxvoi.fsf@yandex.ru>
2023-07-01 20:18     ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cz1corps.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=pva-outdoor@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).