From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve Hafner Subject: Re: Executing functions remotely from agenda Date: Wed, 5 Jan 2011 11:12:20 -0700 Message-ID: References: <878vz07zeq.fsf@fastmail.fm> <87bp3vwnte.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from [140.186.70.92] (port=41907 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PaXqQ-00043z-FG for emacs-orgmode@gnu.org; Wed, 05 Jan 2011 13:12:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PaXqP-0006zd-9K for emacs-orgmode@gnu.org; Wed, 05 Jan 2011 13:12:22 -0500 Received: from mail-qw0-f41.google.com ([209.85.216.41]:60907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PaXqP-0006zV-6o for emacs-orgmode@gnu.org; Wed, 05 Jan 2011 13:12:21 -0500 Received: by qwa26 with SMTP id 26so15516766qwa.0 for ; Wed, 05 Jan 2011 10:12:20 -0800 (PST) In-Reply-To: <87bp3vwnte.fsf@fastmail.fm> 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: emacs-orgmode@gnu.org On Wed, Jan 5, 2011 at 5:13 AM, Matt Lundin wrote: > 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. Thanks for the directions! The org-agenda-todo code with modifications does the job I wanted. > > 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. > Indeed.