From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jambunathan K Subject: [PATCH 1/2] org-store-link: Return link when invoked from within agenda buffer Date: Mon, 23 Aug 2010 04:07:31 +0530 Message-ID: <81sk26s06x.fsf@gmail.com> References: <20524da70811261844o3f47782ay3437fdfdc55bda95@mail.gmail.com> <81fwybeoem.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=49493 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OnJrP-0004MA-RI for emacs-orgmode@gnu.org; Sun, 22 Aug 2010 19:21:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OnJrO-0008Bu-IO for emacs-orgmode@gnu.org; Sun, 22 Aug 2010 19:21:55 -0400 Received: from mail-pw0-f41.google.com ([209.85.160.41]:52555) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OnJrO-0008Bp-Ce for emacs-orgmode@gnu.org; Sun, 22 Aug 2010 19:21:54 -0400 Received: by pwi3 with SMTP id 3so3688392pwi.0 for ; Sun, 22 Aug 2010 16:21:53 -0700 (PDT) In-Reply-To: <81fwybeoem.fsf@gmail.com> (Jambunathan K.'s message of "Thu, 19 Aug 2010 00:31:05 +0530") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Carsten, Sorry about multiple drops. This post *should* contain the patch. Summary: When I trigger a org-capture, with the cursor positioned on a line in the agenda buffer, I want the link to the agenda entry to be available as an annotation (%a) to the capture process. Currently this is broken. The enclosed patch fixes this. Setup: # file todo.org * TODO Talk to someone SCHEDULED: <2010-08-23 Mon> # org-capture-templates ("z" "Conversation" entry (file+headline "~/conversation.org" "Conversations") "** Note taken on %U\n %a\n %?" :prepend t :empty-lines 1) Steps for reporduction: 1. Restrict agenda to todo.org 2. Do org-agenda 3. Place the cursor on the above todo line 4. Trigger an org-capture for the above capture entry Examine the entries in conversation.org before/after the patch is applied. Note the absence/presence of the link to the parent todo entry. * Conversations ** Note taken on [2010-08-23 Mon 03:58] [[file:~/todo.org::*Talk%20to%20someone][Talk to someone]] ** Note taken on [2010-08-23 Mon 03:42] Jambunathan K. --=-=-= Content-Disposition: inline >From bcceabe70968416fb4540e32c68bfbda76820f9b Mon Sep 17 00:00:00 2001 From: Jambunathan K Date: Sun, 22 Aug 2010 23:36:52 +0530 Subject: [PATCH 1/2] org-store-link: Return link when invoked from within agenda buffer. * org.el (org-store-link): Return link when invoked non-interactively from an agenda buffer. TINYCHANGE --- lisp/org.el | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 366c8dd..5db7aab 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -8218,7 +8218,7 @@ For file links, arg negates `org-context-in-file-links'." (org-load-modules-maybe) (setq org-store-link-plist nil) ; reset (let ((outline-regexp (org-get-limited-outline-regexp)) - link cpltxt desc description search txt custom-id) + link cpltxt desc description search txt custom-id agenda-link) (cond ((run-hook-with-args-until-success 'org-store-link-functions) @@ -8250,9 +8250,10 @@ For file links, arg negates `org-context-in-file-links'." (get-text-property (point) 'org-marker)))) (when m (org-with-point-at m - (if (interactive-p) - (call-interactively 'org-store-link) - (org-store-link nil)))))) + (setq agenda-link + (if (interactive-p) + (call-interactively 'org-store-link) + (org-store-link nil))))))) ((eq major-mode 'calendar-mode) (let ((cd (calendar-cursor-to-date))) @@ -8389,7 +8390,7 @@ For file links, arg negates `org-context-in-file-links'." "::#" custom-id)) (setq org-stored-links (cons (list link desc) org-stored-links)))) - (and link (org-make-link-string link desc))))) + (or agenda-link (and link (org-make-link-string link desc)))))) (defun org-store-link-props (&rest plist) "Store link properties, extract names and addresses." -- 1.7.0.4 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--