emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: Steve Hafner <steve.b.hafner@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Executing functions remotely from agenda
Date: Wed, 05 Jan 2011 07:13:33 -0500	[thread overview]
Message-ID: <87bp3vwnte.fsf@fastmail.fm> (raw)
In-Reply-To: <AANLkTinEiQm0tp+Y1aWUTciueqPQskQ=vXudYWjZMX0Z@mail.gmail.com> (Steve Hafner's message of "Tue, 4 Jan 2011 23:56:45 -0700")

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

  reply	other threads:[~2011-01-05 12:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2011-01-05 18:12       ` Steve Hafner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bp3vwnte.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=steve.b.hafner@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).