emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: Executing functions remotely from agenda


From: Matt Lundin
Subject: [Orgmode] Re: Executing functions remotely from agenda
Date: Wed, 05 Jan 2011 07:13:33 -0500
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux)

Steve Hafner <address@hidden> writes:

> On Tue, Jan 4, 2011 at 9:22 PM, Matt Lundin <address@hidden> wrote:
>> Steve Hafner <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]