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

Reply via email to