From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: Executing functions remotely from agenda Date: Wed, 05 Jan 2011 07:13:33 -0500 Message-ID: <87bp3vwnte.fsf@fastmail.fm> References: <878vz07zeq.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=41209 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PaSFI-0006Tg-Dy for emacs-orgmode@gnu.org; Wed, 05 Jan 2011 07:13:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PaSFE-0007wS-KT for emacs-orgmode@gnu.org; Wed, 05 Jan 2011 07:13:40 -0500 Received: from out1.smtp.messagingengine.com ([66.111.4.25]:57294) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PaSFE-0007wA-Hv for emacs-orgmode@gnu.org; Wed, 05 Jan 2011 07:13:36 -0500 In-Reply-To: (Steve Hafner's message of "Tue, 4 Jan 2011 23:56:45 -0700") 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: Steve Hafner Cc: emacs-orgmode@gnu.org Steve Hafner writes: > On Tue, Jan 4, 2011 at 9:22 PM, Matt Lundin wrote: >> Steve Hafner writes: >> >>> I've written a few elisp functions to edit entries, and I would like >>> to be able to execute them remotely from the agenda; but it seems no >>> hooks or other facilities exist to do so. Am I missing something? >>> >> >> (info "(org) Using the mapping API") >> >> http://orgmode.org/manual/Using-the-mapping-API.html >> >> Best, >> Matt >> > > OK, I'm able to run elisp commands remotely from an agenda buffer > using org-map-entries; but what I'd really like to do is specifically > target the current item, and I don't see what expression for MATCH > would only match the current item. By "current item" I mean the entry > corresponding to the line that point is on within the agenda buffer. Ah. I see. I misread "remotely from agenda" as "not in the agenda". You can jump to the current entry in a number of ways. There is the function org-agenda-goto. Within the agenda, you can also get the markers for the current entry with: (org-get-at-bol 'org-marker) (org-get-at-bol 'org-hd-marker) You can use these markers (usually with save-excursion or save-window-excursion) to jump to the function and alter it. The code of org-agenda-todo provides a nice example of this. It would be nice if this functionality were abstracted a bit in org-agenda.el. Right now, each of the org-agenda editing commands (org-agenda-todo, org-agenda-set-tags, org-agenda-priority, org-agenda-add-note, etc.) reimplements the same behavior. Best, Matt