emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Executing functions remotely from agenda
@ 2011-01-05  2:26 Steve Hafner
  2011-01-05  4:22 ` Matt Lundin
  0 siblings, 1 reply; 5+ messages in thread
From: Steve Hafner @ 2011-01-05  2:26 UTC (permalink / raw)
  To: emacs-orgmode

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?

-steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Executing functions remotely from agenda
  2011-01-05  2:26 Executing functions remotely from agenda Steve Hafner
@ 2011-01-05  4:22 ` Matt Lundin
  2011-01-05  6:56   ` Steve Hafner
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Lundin @ 2011-01-05  4:22 UTC (permalink / raw)
  To: Steve Hafner; +Cc: emacs-orgmode

Steve Hafner <steve.b.hafner@gmail.com> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Executing functions remotely from agenda
  2011-01-05  4:22 ` Matt Lundin
@ 2011-01-05  6:56   ` Steve Hafner
  2011-01-05 12:13     ` Matt Lundin
  0 siblings, 1 reply; 5+ messages in thread
From: Steve Hafner @ 2011-01-05  6:56 UTC (permalink / raw)
  To: emacs-orgmode

On Tue, Jan 4, 2011 at 9:22 PM, Matt Lundin <mdl@imapmail.org> wrote:
> Steve Hafner <steve.b.hafner@gmail.com> 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.

-steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Executing functions remotely from agenda
  2011-01-05  6:56   ` Steve Hafner
@ 2011-01-05 12:13     ` Matt Lundin
  2011-01-05 18:12       ` Steve Hafner
  0 siblings, 1 reply; 5+ messages in thread
From: Matt Lundin @ 2011-01-05 12:13 UTC (permalink / raw)
  To: Steve Hafner; +Cc: emacs-orgmode

Steve Hafner <steve.b.hafner@gmail.com> writes:

> On Tue, Jan 4, 2011 at 9:22 PM, Matt Lundin <mdl@imapmail.org> wrote:
>> Steve Hafner <steve.b.hafner@gmail.com> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Executing functions remotely from agenda
  2011-01-05 12:13     ` Matt Lundin
@ 2011-01-05 18:12       ` Steve Hafner
  0 siblings, 0 replies; 5+ messages in thread
From: Steve Hafner @ 2011-01-05 18:12 UTC (permalink / raw)
  To: emacs-orgmode

On Wed, Jan 5, 2011 at 5:13 AM, Matt Lundin <mdl@imapmail.org> wrote:
> Steve Hafner <steve.b.hafner@gmail.com> writes:
>
>> On Tue, Jan 4, 2011 at 9:22 PM, Matt Lundin <mdl@imapmail.org> wrote:
>>> Steve Hafner <steve.b.hafner@gmail.com> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-01-05 18:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-05  2:26 Executing functions remotely from agenda Steve Hafner
2011-01-05  4:22 ` Matt Lundin
2011-01-05  6:56   ` Steve Hafner
2011-01-05 12:13     ` Matt Lundin
2011-01-05 18:12       ` Steve Hafner

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).