emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug] org-in-src-block-p returns t when not in source block


From: Jens Schmidt
Subject: Re: [Bug] org-in-src-block-p returns t when not in source block
Date: Tue, 28 Nov 2023 21:32:18 +0100
User-agent: Mozilla Thunderbird

On 2023-11-27  21:30, Ihor Radchenko wrote:

> Fixed, on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=6d7c7917a

Which is currently my HEAD, and there are still edge cases that do not
seem to be handled well.

Start off from "make vanilla" and the following buffer

------------------------- test.org -------------------------
#+begin_src shell
foo
#+end_src

bar
------------------------- test.org -------------------------

Navigate to BOL of the "#+end_src" line and

  M-: (org-in-src-block-p t)
  => nil

As expected.  Now add a space on the empty line *after* the
"#+end_src" line, navigate back to BOL of the "#+end_src" line and

  M-: (org-in-src-block-p t)
  => t

When I wrote my own inner-boundary function, I looked with envy at
the elegance of the arithmetic done in `org-in-src-block-p' but thought
that this probably would not always work ... or did I misunderstand
something here?

Thanks                                                          Jens

Here is the lossage corresponding to my test case, just in case:

 C-s      ;; isearch-forward
 #        ;; isearch-printing-char
 +        ;; isearch-printing-char
 e        ;; isearch-printing-char
 n        ;; isearch-printing-char
 d        ;; isearch-printing-char
 C-a      ;; org-beginning-of-line
 M-: (org-in-src-block-p t)
 <return> ;; read--expression-try-read
 C-n      ;; next-line
 SPC      ;; org-self-insert-command
 C-a      ;; org-beginning-of-line
 C-p      ;; previous-line
 M-: (org-in-src-block-p t)
 <return> ;; read--expression-try-read



reply via email to

[Prev in Thread] Current Thread [Next in Thread]