emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: pinard@iro.umontreal.ca (François Pinard)
To: emacs-orgmode@gnu.org
Subject: Problem at capture time
Date: Sat, 07 Jan 2012 11:52:20 -0500	[thread overview]
Message-ID: <87aa5z316j.fsf@iro.umontreal.ca> (raw)

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çois Pinard: Capture failure {7.7}]]
- [[gnus:gmane.emacs.orgmode#871us1f6fo.fsf@iro.umontreal.ca][Email from François 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-marker-p")
  signal(error ("Capture template `d': integer-or-marker-p"))
  error("Capture template `%s': %s" "d" integer-or-marker-p)
  byte-code("\301p!\203.\0\302\303\304 \"\203.\0\305p!\210\306\307\310!!\210\300\311\307\312!\bA@#\207" [error buffer-base-buffer string-match "\\`CAPTURE-" buffer-name kill-buffer set-window-configuration org-capture-get :return-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çois

             reply	other threads:[~2012-01-07 16:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-07 16:52 François Pinard [this message]
2012-01-07 17:25 ` Problem at capture time François Pinard
2012-01-09  9:59 ` Bastien
2012-01-09 12:50   ` François Pinard
2012-01-24  6:23     ` David Maus
2012-01-24 16:13       ` Bastien
2012-01-24 17:39         ` François Pinard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87aa5z316j.fsf@iro.umontreal.ca \
    --to=pinard@iro.umontreal.ca \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).