emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Steve Hafner <steve.b.hafner@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Executing functions remotely from agenda
Date: Wed, 5 Jan 2011 11:12:20 -0700	[thread overview]
Message-ID: <AANLkTi=dtMyBrHw7c-oLJ2v0cx1bikhUvFk4C_LgFU8b@mail.gmail.com> (raw)
In-Reply-To: <87bp3vwnte.fsf@fastmail.fm>

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.

      reply	other threads:[~2011-01-05 18:12 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
2011-01-05 18:12       ` Steve Hafner [this message]

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='AANLkTi=dtMyBrHw7c-oLJ2v0cx1bikhUvFk4C_LgFU8b@mail.gmail.com' \
    --to=steve.b.hafner@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).