From 1e59039f8cf93830f930f7dc99117c41586552e9 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 2 Mar 2011 21:56:02 +0000 Subject: [PATCH] Fix bug when narrowing to subtree with point at an inline task * lisp/org.el (org-narrow-to-subtree): ensure `org-back-to-heading' will move point to a real heading and not an inline task by wraping function into a org-with-limited-levels macro. --- lisp/org.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index e37bbbab6..60e88f6f0 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7579,11 +7579,12 @@ If yes, remember the marker and the distance to BEG." (interactive) (save-excursion (save-match-data - (narrow-to-region - (progn (org-back-to-heading t) (point)) - (progn (org-end-of-subtree t t) - (if (and (org-on-heading-p) (not (eobp))) (backward-char 1)) - (point)))))) + (org-with-limited-levels + (narrow-to-region + (progn (org-back-to-heading t) (point)) + (progn (org-end-of-subtree t t) + (if (and (org-on-heading-p) (not (eobp))) (backward-char 1)) + (point))))))) (defun org-narrow-to-block () "Narrow buffer to the current block." -- 2.11.4.GIT