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