emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bastien <bzg@altern.org>
To: Jason Dunsmore <emacs-orgmode@dunsmor.com>
Cc: Org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: [bug] Asterisks in source and example blocks interpreted as headings
Date: Tue, 16 Aug 2011 21:51:51 +0200	[thread overview]
Message-ID: <87k4adi17s.fsf@gnu.org> (raw)
In-Reply-To: <87zkj9w6tm.fsf@riotblast.dunsmor.com> (Jason Dunsmore's message of "Tue, 16 Aug 2011 13:27:01 -0500")

[-- Attachment #1: Type: text/plain, Size: 241 bytes --]

Hi Jason,

Jason Dunsmore <emacs-orgmode@dunsmor.com> writes:

> I noticed that lines with leading asterisks inside of source and example
> blocks are interpreted as headings:

The attached patch should fix this -- please confirm.

Thanks!


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org.el-Fix-bug-about-headlines-in-blocks.patch --]
[-- Type: text/x-patch, Size: 1895 bytes --]

From 4ff6f7a78c07654e70ac8473c911b873340f0b67 Mon Sep 17 00:00:00 2001
From: Bastien Guerry <bzg@altern.org>
Date: Tue, 16 Aug 2011 21:51:02 +0200
Subject: [PATCH] org.el: Fix bug about headlines in blocks.

* org.el (org-cycle): Use `org-at-heading-p'.
(org-heading-forbidden-blocks): Variable alias to
`org-list-forbidden-blocks'.
(org-on-heading-p, org-at-heading-p): only perform the check
when we are in allowed blocks, otherwise just return nil.

Thanks to Jason Dunsmor for pointing at this.
---
 lisp/org.el |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 2c38b33..2eabcb8 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5994,8 +5994,7 @@ in special contexts.
 
        ;; At an item/headline: delegate to `org-cycle-internal-local'.
        ((and (or (and org-cycle-include-plain-lists (org-at-item-p))
-		 (save-excursion (beginning-of-line 1)
-				 (looking-at org-outline-regexp)))
+		 (org-at-heading-p))
 	     (or (bolp) (not (eq org-cycle-emulate-tab 'exc-hl-bol))))
 	(org-cycle-internal-local))
 
@@ -20067,10 +20066,17 @@ This version does not only check the character property, but also
     (end-of-line)
     (null (re-search-backward org-outline-regexp-bol nil t))))
 
+(defvaralias 'org-heading-forbidden-blocks 'org-list-forbidden-blocks
+  "List of blocks where a heading should not be treated as such.
+See `org-list-forbidden-blocks'.")
+
 (defun org-on-heading-p (&optional ignored)
-  (outline-on-heading-p t))
+  (unless (org-in-block-p org-heading-forbidden-blocks)
+    (outline-on-heading-p t)))
+
 (defun org-at-heading-p (&optional ignored)
-  (outline-on-heading-p t))
+  (unless (org-in-block-p org-heading-forbidden-blocks)
+    (outline-on-heading-p t)))
 
 (defun org-point-at-end-of-empty-headline ()
   "If point is at the end of an empty headline, return t, else nil.
-- 
1.7.5.2


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

  reply	other threads:[~2011-08-16 19:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-16 18:27 [bug] Asterisks in source and example blocks interpreted as headings Jason Dunsmore
2011-08-16 19:51 ` Bastien [this message]
2011-08-16 20:22   ` Jason Dunsmore
2011-08-25 13:27     ` Bastien
2011-08-25 13:31       ` Carsten Dominik
2011-08-31 19:52       ` Jason Dunsmore
2011-08-17 11:05 ` Daniel Bausch
2011-08-19 12:19   ` Eric Schulte
2011-08-19 19:53     ` Sebastien Vauban

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=87k4adi17s.fsf@gnu.org \
    --to=bzg@altern.org \
    --cc=emacs-orgmode@dunsmor.com \
    --cc=emacs-orgmode@gnu.org \
    /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).