From mboxrd@z Thu Jan 1 00:00:00 1970 From: pinard@iro.umontreal.ca (=?utf-8?Q?Fran=C3=A7ois?= Pinard) Subject: Problem at capture time Date: Sat, 07 Jan 2012 11:52:20 -0500 Message-ID: <87aa5z316j.fsf@iro.umontreal.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:52349) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjZVH-0008JZ-Pg for emacs-orgmode@gnu.org; Sat, 07 Jan 2012 11:52:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RjZVG-0007da-RO for emacs-orgmode@gnu.org; Sat, 07 Jan 2012 11:52:23 -0500 Received: from 206-248-137-202.dsl.teksavvy.com ([206.248.137.202]:57535 helo=mercure.epsilon-ti.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RjZVG-0007dU-MX for emacs-orgmode@gnu.org; Sat, 07 Jan 2012 11:52:22 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi, Org people. On 2011-12-11 23:24, I reported a problem met while using the Org capture facility, and a patch working around the problem. David Maus then requested for details, which I sent on 2011-12-19 00:59. David's mailer rejected my reply as being likely SPAM, but it made it to the emacs-orgmode@gnu.org mailing list, so I presume David got it. Here are references I have for both messages: - [[gnus:gmane.emacs.orgmode#8739cqo1s3.fsf@iro.umontreal.ca][Email from Fran=C3=A7ois Pinard: Capture failure {7.7}]] - [[gnus:gmane.emacs.orgmode#871us1f6fo.fsf@iro.umontreal.ca][Email from Fr= an=C3=A7ois Pinard: Re: Capture failure {7.7}]] This morning, I removed my patch locally. Using a fresh Git pull of Org mode, the problem is still there, showing as: Debugger entered--Lisp error: (error "Capture template `d': integer-or-mark= er-p") signal(error ("Capture template `d': integer-or-marker-p")) error("Capture template `%s': %s" "d" integer-or-marker-p) byte-code("\301p!\203.=00\302\303\304 \"\203.=00\305p!\210\306\307\310!!\= 210\300\311\307\312!A@#\207" [error buffer-base-buffer string-match "\\`CA= PTURE-" buffer-name kill-buffer set-window-configuration org-capture-get :r= eturn-to-wconf "Capture template `%s': %s" :key] 4) org-capture(nil) call-interactively(org-capture nil nil) The problem, which I described two months ago, is that some variables in org-capture.el (org-capture-place-item) do not get properly initialized depending on the flow within the function. The following patch solves the problem for me: diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 46202f8..508611d 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -913,7 +913,8 @@ it. When it is a variable, retrieve the value. Return= whatever we get." beg end) (cond ((org-capture-get :exact-position) - (goto-char (org-capture-get :exact-position))) + (goto-char (org-capture-get :exact-position)) + (setq beg (point) end (point))) ((not target-entry-p) ;; Insert as top-level entry, either at beginning or at end of file (setq beg (point-min) end (point-max))) Could it be integrated in the main stream? I'm not sure that "(point)" is the best value to give for "beg" and "end" (I do not understand the code enough), but surely, this is better than capture just crashing. Fran=C3=A7ois