emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: "Sebold, Charles" <Charles.Sebold@lcms.org>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Making the output of %% functions linkable in agenda views
Date: Tue, 03 May 2011 15:56:54 -0400	[thread overview]
Message-ID: <87aaf3tv5l.fsf@fastmail.fm> (raw)
In-Reply-To: <yucsjsvra96.fsf@gmail.com> (charles sebold's message of "Tue, 03 May 2011 11:59:01 -0500")

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

charles.sebold@lcms.org writes:

> On 7 Apr 2011, Charles Sebold wrote:
>
>> Here's a test.  Take the line below and put it in an agenda file, then
>> view the agenda.
>>
>> %%(format "%s" (concat "[[elisp:(info)]" "[Link to info]]"))
>>
>> The results as I see them give me a link that I can mouse-click on,
>> but I can't move point to it and hit C-c C-o.
>>
>> What do I need to do to make this a normal org link in every way?  Or
>> is this a bug?
>>

Here's what seems to be going on. 

Clicking with the mouse works because it calls org-open-at-mouse, which
(by calling org-open-at-point) simply looks at the text surrounding the
click point to find a link.

The function org-agenda-open-link, on the other hand, grabs part of the
headline as a string (the prefix), then jumps to the location in the
original buffer and calls org-offer-links-in-entry to look for links in
both the entry and the prefix of agenda text. Obviously, it won't find
your link in the original entry since it looks like this:

%%(format "%s" (concat "[[elisp:(info)]" "[Link to info]]"))

I think it shouldn't be a problem to pass the whole agenda line to
org-offer-links-in-entry. This will not result in duplicate links, since
org-offer-links-in-entry "uniquifies" the links.

I've attached a patch.

The bigger question, however, is why the expression above is even
showing up in the agenda, since it contains no scheduling information.
:)

Best,
Matt


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Pass-entire-text-of-agenda-line-to-org-offer-links-i.patch --]
[-- Type: text/x-patch, Size: 1130 bytes --]

From 58c7621c0c84b9c1930098a098e4559aa516eec0 Mon Sep 17 00:00:00 2001
From: Matt Lundin <mdl@imapmail.org>
Date: Tue, 3 May 2011 15:54:35 -0400
Subject: [PATCH] Pass entire text of agenda line to org-offer-links-in-entry.

* lisp/org-agenda.el (org-agenda-open-link): Pass entire text of
  agenda line to org-offer-links-in-entry.

This fixes bug noticed by Charles Sebold, in which links that are
dynamically formatted for the agenda view are ignored.
http://permalink.gmane.org/gmane.emacs.orgmode/40673
---
 lisp/org-agenda.el |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 65f7cea..609edd4 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6879,9 +6879,7 @@ at the text of the entry itself."
 		     (org-get-at-bol 'org-marker)))
 	 (buffer (and marker (marker-buffer marker)))
 	 (prefix (buffer-substring
-		  (point-at-bol)
-		  (or (text-property-any (point-at-bol) (point-at-eol) 'org-heading t)
-		      (point-at-bol)))))
+		  (point-at-bol) (point-at-eol))))
     (cond
      (buffer
       (with-current-buffer buffer
-- 
1.7.5


  parent reply	other threads:[~2011-05-03 19:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-07 20:52 Making the output of %% functions linkable in agenda views Sebold, Charles
2011-05-03 16:59 ` charles.sebold
2011-05-03 17:28   ` Nick Dokos
2011-05-03 19:56   ` Matt Lundin [this message]
2011-05-03 20:04     ` Sebold, Charles
2011-05-03 20:09       ` Matt Lundin
2011-05-03 20:17         ` Sebold, Charles
2011-05-03 20:28         ` Nick Dokos
2011-05-03 20:47           ` Matt Lundin
2011-05-04  7:43     ` [Accepted] " Carsten Dominik
2011-05-06  7:49       ` Bert Burgemeister
2011-05-06 11:47         ` Matt Lundin
2011-05-07 15:20           ` Bert Burgemeister
2011-05-08 20:23             ` Carsten Dominik
2011-05-10  7:57               ` Bert Burgemeister

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=87aaf3tv5l.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --cc=Charles.Sebold@lcms.org \
    --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).