* User Defined Functions in Agenda Views
@ 2013-09-21 18:18 Mike McLean
2013-09-22 9:03 ` Suvayu Ali
0 siblings, 1 reply; 2+ messages in thread
From: Mike McLean @ 2013-09-21 18:18 UTC (permalink / raw)
To: org mode
[-- Attachment #1: Type: text/plain, Size: 1863 bytes --]
Hello
I looked at the doc string for ~org-agenda-custom-commands~ and noticed that the you can use a user-defined function as a valid command type. I did not find anything in the documentation that describes how that user-defined function should work, what it should do, or how to write one. I looked at the code for other agenda types, such as ~tags-todo~ and ~occur-tree~ and have guessed at how to form one of these.
I can write documentation and samples if anyone want it (either to add to Org documentation or as a page on Worg), but want to ensure that I understand completely and correctly, first.
With that said, can those with far more knowledegble about Org code comment on my thoughts below.
The user defined function for an agenda view:
The Org agenda dispatch function will call a user-defined function with one parameter representing the ``match'' component from the agenda definition. In other words, ~(udf-test "Hello")~ in ~org-agenda-custom-commands~ will result in a function call of ~udf-test~ with an argument of "Hello".
The ~org-agenda-custom-commands~ varible does not requred a parameter and therefore the dispatcher does not require one. Define an user-defined wiht an optional argument: ~(defun udf-test (&optional org-match) "documentation…" <<code>>)~
The user defined function should prepared a buffer to write the agenda information to using ~org-agenda-prepare~
The user defined function should handle setting a unique buffer name for the cases where ~org-agenda-sticky~ has a value of ~t~
Honor the setting of ~org-agenda-overriding-header~ and insert that text into the agenda buffer
Insert into the buffer the desired contents, accounting for also setting text properties (translation: “Magic happens here”)
Call ~org-agenda-finalize~ and ~(setq buffer-read-only t)~
Does this cover the basics?
Mike
[-- Attachment #2: Type: text/html, Size: 2311 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: User Defined Functions in Agenda Views
2013-09-21 18:18 User Defined Functions in Agenda Views Mike McLean
@ 2013-09-22 9:03 ` Suvayu Ali
0 siblings, 0 replies; 2+ messages in thread
From: Suvayu Ali @ 2013-09-22 9:03 UTC (permalink / raw)
To: emacs-orgmode
Hi Mike,
On Sat, Sep 21, 2013 at 02:18:47PM -0400, Mike McLean wrote:
> Hello
>
> I looked at the doc string for ~org-agenda-custom-commands~ and noticed that the you can use a user-defined function as a valid command type. I did not find anything in the documentation that describes how that user-defined function should work, what it should do, or how to write one. I looked at the code for other agenda types, such as ~tags-todo~ and ~occur-tree~ and have guessed at how to form one of these.
>
> I can write documentation and samples if anyone want it (either to add to Org documentation or as a page on Worg), but want to ensure that I understand completely and correctly, first.
>
My understanding of the Agenda is not great so I'll point you to a Worg
page:
<http://orgmode.org/worg/org-tutorials/org-custom-agenda-commands.html>
If you think you can add to it, please go ahead. That said, I think it
would be worthwhile to add some information on the expected function
signature in the docstring instead of just – "A user-defined function".
Hope this helps,
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-22 9:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-21 18:18 User Defined Functions in Agenda Views Mike McLean
2013-09-22 9:03 ` Suvayu Ali
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).