emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [PATCH 1/2] org-store-link: Return link when invoked from within agenda buffer
Date: Mon, 23 Aug 2010 04:07:31 +0530	[thread overview]
Message-ID: <81sk26s06x.fsf@gmail.com> (raw)
In-Reply-To: <81fwybeoem.fsf@gmail.com> (Jambunathan K.'s message of "Thu, 19 Aug 2010 00:31:05 +0530")

[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]


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.


[-- Attachment #2: Type: text/plain, Size: 1857 bytes --]

From bcceabe70968416fb4540e32c68bfbda76820f9b Mon Sep 17 00:00:00 2001
From: Jambunathan K <kjambunathan@gmail.com>
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


[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

  parent reply	other threads:[~2010-08-22 23:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-27  2:44 feature request: a basic conversation manager Samuel Wales
2008-11-29 18:22 ` Ross Patterson
2008-12-10  5:00   ` Samuel Wales
2008-12-09 10:36 ` Carsten Dominik
2008-12-10  3:59   ` Samuel Wales
2010-08-18 19:01 ` Jambunathan K
2010-08-18 19:12   ` Eric S Fraga
2010-08-28 19:16     ` Jambunathan K
2010-08-22 22:37   ` [PATCH 1/2] org-store-link: Return link when invoked from within agenda buffer Jambunathan K
2010-08-22 22:37   ` Jambunathan K [this message]
2010-08-23 10:18     ` [Accepted] [Orgmode, " Carsten Dominik
2010-08-22 22:37   ` [PATCH " Jambunathan K
2010-08-22 23:11   ` [PATCH 2/2] org-store-link: Fix storing of links to headlines in indirect buffers Jambunathan K
2010-08-23 10:14     ` [Accepted] [Orgmode, " Carsten Dominik
2010-08-28 19:43   ` feature request: a basic conversation manager Samuel Wales
2010-08-28 19:50     ` Samuel Wales
2010-08-28 21:42       ` Jambunathan K
2010-08-28 22:08         ` Samuel Wales

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=81sk26s06x.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --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).