From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: [bug] Asterisks in source and example blocks interpreted as headings Date: Tue, 16 Aug 2011 21:51:51 +0200 Message-ID: <87k4adi17s.fsf@gnu.org> References: <87zkj9w6tm.fsf@riotblast.dunsmor.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:58681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtPfP-0001Ea-3d for emacs-orgmode@gnu.org; Tue, 16 Aug 2011 15:51:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QtPfN-00009W-PG for emacs-orgmode@gnu.org; Tue, 16 Aug 2011 15:51:15 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:59551) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QtPfN-00009M-Jr for emacs-orgmode@gnu.org; Tue, 16 Aug 2011 15:51:13 -0400 Received: by wyi11 with SMTP id 11so215151wyi.0 for ; Tue, 16 Aug 2011 12:51:12 -0700 (PDT) In-Reply-To: <87zkj9w6tm.fsf@riotblast.dunsmor.com> (Jason Dunsmore's message of "Tue, 16 Aug 2011 13:27:01 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jason Dunsmore Cc: Org-mode mailing list --=-=-= Content-Type: text/plain Hi Jason, Jason Dunsmore 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! --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org.el-Fix-bug-about-headlines-in-blocks.patch >From 4ff6f7a78c07654e70ac8473c911b873340f0b67 Mon Sep 17 00:00:00 2001 From: Bastien Guerry 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 --=-=-= Content-Type: text/plain -- Bastien --=-=-=--