emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org-capture in message-mode buffer


From: Tassilo Horn
Subject: Re: [O] org-capture in message-mode buffer
Date: Tue, 24 May 2011 13:35:14 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Carsten Dominik <address@hidden> writes:

>> Basically, there should be a possibility to let the link creator
>> functions return "yes, I was the right handler, but because of reason X,
>> I couldn't create a link".  Is there something like that?
>
> What happens if you return t in this case, without calling
> org-store-link-props ?

Then no link will be created.  Basically, that's what we'd like to have.

But somehow my `called-interactively-p' check now always returns nil.
I'm pretty sure it didn't when I tested my last patch.  But according to
its docs, the current behavior is correct.  It should only check if the
*containing* function was called interactively, not if its caller was
called interactively.

So I'd say the current behavior, i.e., erroring if there's no Gcc
header, is correct and neither one of the two proposed patches shall be
applied.  Instead of making the low-level functions aware of their call
context (an interactive org-store-link call called org-gnus-store-link
vs. an interactive org-capture called org-store-link that in turn called
org-gnus-store-link), the caller should be adapted to handle the error
appropriately.

Here's a patch for the `org-capture' use case.  I've tested it.  In a
message buffer without Gcc header, calling `org-store-link' will produce
an error indicating the problem to the user.  When called by
`org-capture', the error is still produce but simply ignored so you
still can capture.  In that case, the %a format spec is empty.

Bye,
Tassilo

--8<---------------cut here---------------start------------->8---
>From dbee3ff4f0a6584c4437af8ebff285babc87db30 Mon Sep 17 00:00:00 2001
From: Tassilo Horn <address@hidden>
Date: Tue, 24 May 2011 13:29:53 +0200
Subject: [PATCH 3/3] Ignore errors from link creation.

2011-05-24  Tassilo Horn  <address@hidden>

        * org-capture.el (org-capture): Ignore errors from link
        creation.
---
 lisp/org-capture.el |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 0af4529..ccfca75 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -415,7 +415,7 @@ bypassed."
           (annotation (if (and (boundp 'org-capture-link-is-already-stored)
                                org-capture-link-is-already-stored)
                           (plist-get org-store-link-plist :annotation)
-                        (org-store-link nil)))
+                        (ignore-errors (org-store-link nil))))
           (initial (and (org-region-active-p)
                         (buffer-substring (point) (mark))))
           (entry (org-capture-select-template keys)))
-- 
1.7.5.rc3

--8<---------------cut here---------------end--------------->8---



reply via email to

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