emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jens Schmidt <jschmidt4gnu@vodafonemail.de>
To: Ihor Radchenko <yantar92@posteo.net>,
	No Wayman <iarchivedmywholelife@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [Bug] org-in-src-block-p returns t when not in source block
Date: Tue, 28 Nov 2023 21:32:18 +0100	[thread overview]
Message-ID: <c286709d-5981-41ba-ac3f-f628f2b0ce34@vodafonemail.de> (raw)
In-Reply-To: <874jh7uef4.fsf@localhost>

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


  parent reply	other threads:[~2023-11-28 20:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27 20:14 [Bug] org-in-src-block-p returns t when not in source block No Wayman
2023-11-27 20:30 ` Ihor Radchenko
2023-11-27 20:39   ` No Wayman
2023-11-28 20:32   ` Jens Schmidt [this message]
2023-11-29 10:07     ` Ihor Radchenko
  -- strict thread matches above, loose matches on Subject: below --
2023-11-27 15:49 No Wayman
2023-11-27 15:55 ` Ihor Radchenko
     [not found]   ` <87cyvv9nag.fsf@gmail.com>
2023-11-27 19:59     ` 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=c286709d-5981-41ba-ac3f-f628f2b0ce34@vodafonemail.de \
    --to=jschmidt4gnu@vodafonemail.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=iarchivedmywholelife@gmail.com \
    --cc=yantar92@posteo.net \
    /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).