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

Here is a simple config to reproduce the problem and a patch that fixes it.

emacs -q -l capfail.el

Best,
Alex
From ac50a5300e35d7abd5f50317069b2a795fde4ad8 Mon Sep 17 00:00:00 2001
From: Alex Kosorukoff <a...@3form.com>
Date: Mon, 17 Mar 2014 12:56:09 -0700
Subject: [PATCH] fix org-capture error "The mark is not set now, so there is no region"

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

diff --git a/lisp/org.el b/lisp/org.el
index dc4f2cc..bc5a69e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -14611,7 +14611,7 @@ When JUST-ALIGN is non-nil, only align tags.
 When JUST-ALIGN is 'ignore-column, align tags without trying to set
 the column by ignoring invisible text."
   (interactive "P")
-  (if (and (org-region-active-p) org-loop-over-headlines-in-active-region)
+  (if (and (mark t) (org-region-active-p) org-loop-over-headlines-in-active-region)
       (let ((cl (if (eq org-loop-over-headlines-in-active-region 'start-level)
 		    'region-start-level 'region))
 	    org-loop-over-headlines-in-active-region)
-- 
1.7.0.4

;; capfail.el org-mode capture failure when region is active
;; $ emacs -q -l capfail.el

(setq inhibit-splash-screen t)
(add-to-list 'load-path "~/.emacs.d/org/lisp")
(require 'org)

(setq org-capture-templates
      '(("t" "Todo" entry (file "test.org")
         "* TODO Test %^g\n  %?")))

(define-key global-map (kbd "C-c c") 'org-capture)

(find-file "test.org")
(insert
 "Select some text to make a region, then try C-c c t\ntest\n"
 "Emacs 23.1.1/23.3.1/24.1/24.2 & Org-mode version 8.2.6 result:\n"
 "Capture abort: (error: The mark is not set now, so there is no region)\n")

(provide 'capfail)

Reply via email to