Browse Source

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.
Nicolas Goaziou 14 years ago
parent
commit
1e59039f8c
1 changed files with 6 additions and 5 deletions
  1. 6 5
      lisp/org.el

+ 6 - 5
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."