On Fri, May 23, 2014 at 5:03 AM, Bastien <bzg@gnu.org> wrote:
Hi Alex,

Alex Kosorukoff <alex@3form.com> writes:

> 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)

If I may ask, why using %(org-set-tags) instead of %^g or %^G?

I am using org-set-tags to avoid autocompletion, both %^g and %^G take too much time because my org files have many tagged items. Capture should be fast to be effective.

> 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.

I think the right fix is to exclude `mark-active' from the local
variable that are imported through `org-capture-steal-local-variables'.
I installed such a fix in maint, please update Org and let me know if
this works for you.

Excluding mark-active will work, the result will be the same as after my patch, except performance will not be the same. Excluding variable requires filtering the list of variables which takes O(n) whereas my patch takes O(1). Mark-active is nil before org-capture-steal-local-variables because this is a new buffer. It seems in this case setting it back to nil is faster than trying to preserve its original value nil.


Thanks,

--
 Bastien