From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: [BUG] BBDB anniversary links don't open in agenda Date: Thu, 11 Sep 2014 10:08:51 -0500 Message-ID: <87d2b2p530.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS5zZ-00061F-4w for emacs-orgmode@gnu.org; Thu, 11 Sep 2014 11:09:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XS5zS-0001GX-Pg for emacs-orgmode@gnu.org; Thu, 11 Sep 2014 11:09:01 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:38625) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS5zS-0001G7-EW for emacs-orgmode@gnu.org; Thu, 11 Sep 2014 11:08:54 -0400 Received: from archdesk (unknown [209.147.96.226]) by mail.messagingengine.com (Postfix) with ESMTPA id 21F3DC0091E for ; Thu, 11 Sep 2014 11:08:52 -0400 (EDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode 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