emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [BUG] BBDB anniversary links don't open in agenda
Date: Thu, 11 Sep 2014 10:08:51 -0500	[thread overview]
Message-ID: <87d2b2p530.fsf@fastmail.fm> (raw)

BBDB anniversary links don't open in the agenda.

At the moment, the function org-agenda-open-link seems to be set up only
to open links if they are actually in the original buffer. But bbdb
anniversary links are generated from the following sexp:

%%(org-bbdb-anniversaries)

When org-agenda-open-link jumps to the buffer to look for a link like
[[bbdb:John Doe]], it will not find it. This seems symptomatic of a
bigger problem in org-agenda-open-link, which is that (AFAICT) it will
*never* get to the second item in the conditional.

Here are the details:

1. This bit of code searches both the original buffer and the agenda
line for links (notice the prefix):

,----[ org-agenda.el, lines 8516-8519
| 	 (buffer (and marker (marker-buffer marker)))
| 	 (prefix (buffer-substring (point-at-bol) (point-at-eol)))
|  	 (lkall (and buffer (org-offer-links-in-entry
| 			     buffer marker arg prefix)))
`----

2. This will trigger the first conditional, since there will always be
both a buffer and a link. But this means that the function never arrives
at the second conditional, which opens links found in the agenda buffer
itself.

3. Instead, a bbdb link will be lost in the first conditional, which
assumes that that the link can actually be found in the buffer.

,----[ 8530-8537
| 		  (if (or (not trg) (string-match org-any-link-re trg))
| 		      (save-excursion
| 			(save-restriction
| 			  (widen)
| 			  (goto-char marker)
| 			  (when (search-forward l nil lkend)
| 			    (goto-char (match-beginning 0))
| 			    (org-open-at-point))))
`----

The bug was introduced with commit
bd779fad624af01dbcb35b381dee10452dc945b1 on Jan 13, 2013:

It would be easy enough to insert a check for bbdb links in the first
conditional clause. However, it seems to me that the logic of
org-agenda-open-link has become rather convoluted.

Is there a scenario in which one would ever reach the second conditional
clause, which opens links found only in the agenda buffer?

Any advice on the best way to proceed would be greatly appreciated.

Best,
Matt

                 reply	other threads:[~2014-09-11 15:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87d2b2p530.fsf@fastmail.fm \
    --to=mdl@imapmail.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).