From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike McLean Subject: User Defined Functions in Agenda Views Date: Sat, 21 Sep 2013 14:18:47 -0400 Message-ID: <6F30E9CD-36ED-4281-BD6F-0D3B623393B9@pobox.com> Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_8E8014AD-0C40-4DAD-8783-BEA2CD252ED6" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VNRli-00015O-UK for emacs-orgmode@gnu.org; Sat, 21 Sep 2013 14:19:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VNRlb-0007ju-IA for emacs-orgmode@gnu.org; Sat, 21 Sep 2013 14:18:58 -0400 Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:34385 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VNRlb-0007jR-C1 for emacs-orgmode@gnu.org; Sat, 21 Sep 2013 14:18:51 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id D6548D75E for ; Sat, 21 Sep 2013 14:18:48 -0400 (EDT) Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id CDDA1D75D for ; Sat, 21 Sep 2013 14:18:48 -0400 (EDT) Received: from mac-mike-2013.mclean (unknown [67.190.221.110]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 4473BD75C for ; Sat, 21 Sep 2013 14:18:48 -0400 (EDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org mode --Apple-Mail=_8E8014AD-0C40-4DAD-8783-BEA2CD252ED6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 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=85" <>)~ 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: =93Magic happens here=94) Call ~org-agenda-finalize~ and ~(setq buffer-read-only t)~ Does this cover the basics? Mike --Apple-Mail=_8E8014AD-0C40-4DAD-8783-BEA2CD252ED6 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252
  • 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=85" <<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: =93Magic happens = here=94)
  • Call ~org-agenda-finalize~ and ~(setq buffer-read-only = t)~

  • Does this cover the = basics?

    Mike

    = --Apple-Mail=_8E8014AD-0C40-4DAD-8783-BEA2CD252ED6--