From 94f104ad5c9f25e13e9f21b24eb497513646821b Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 13 Mar 2014 10:44:41 +0100 Subject: [PATCH] org-capture.el: Fix wrong narrowing with :prepend set to `t' * org-capture.el (org-capture-finalize): Ensure to widen the buffer when the target buffer is not initially narrowed. Thanks to Adam Spiers and Thomas Proschinger for reporting this bug. --- lisp/org-capture.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 8eaa313b2..0433306a9 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -741,7 +741,8 @@ captured item after finalizing." (pos (org-capture-get :initial-target-position)) (ipt (org-capture-get :insertion-point)) (size (org-capture-get :captured-entry-size))) - (when reg + (if (not reg) + (widen) (cond ((< ipt (car reg)) ;; insertion point is before the narrowed region (narrow-to-region (+ size (car reg)) (+ size (cdr reg))))