[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] Fix: Capture abort: (error: The mark is not set now, so

From: Alex Kosorukoff
Subject: Re: [O] [PATCH] Fix: Capture abort: (error: The mark is not set now, so there is no region)
Date: Thu, 8 May 2014 20:55:50 -0700

After I replaced my patch and merged Bastien's fix, I started seeing the error though less frequently than before. It didn't occur in the template I posted, but I started seeing it again in another template.

("w" "org-protocol tag" entry (file "~/org/bookmarks.org")
               "* %:description %(org-set-tags)\n  %i\n\n  %:link\n%?"
               :prepend t :empty-lines-after 1 :clock-in t :clock-resume t)

I switched back to my initial patch that was checking if the mark was set before trying to access the region. This worked: the errors disappeared. However, I couldn't understand why mark would be unset in the first place. It turns out that this is a result of the function org-capture-steal-local-variables that is copying mark-active variable from another buffer. This results in an inconsistent state where mark is not set and yet the variable mark-active is set. Emacs functions region-active-p and use-region-p expect the state to be consistent and fail with this error that they won't produce under normal circumstances. Here is the minimal patch that fixes the root cause of this problem:

From 3d84403964dec1ac55810883e4e8a812c3ff94fc Mon Sep 17 00:00:00 2001
From: Alex Kosorukoff <address@hidden>
Date: Thu, 8 May 2014 20:27:59 -0700
Subject: [PATCH] org-capture: better fix for error "The mark is not set now, ..."

 lisp/org-capture.el |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index d57b9e0..3c62b1d 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1590,6 +1590,7 @@ The template may still contain \"%?\" for cursor positioning."
       (goto-char (point-min))
       (org-capture-steal-local-variables buffer)
       (setq buffer-file-name nil)
+      (setq mark-active nil)
       ;; %[] Insert contents of a file.
       (goto-char (point-min))

On Tue, Apr 29, 2014 at 4:05 AM, Bastien <address@hidden> wrote:
Hi Alex,

Alex Kosorukoff <address@hidden> writes:

> I noticed a regression in the capture functionality after upgrading
> org. Capture fails with error in subj

fixed, thanks,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]