From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id sGNxIAi0KmAsEAAA0tVLHw (envelope-from ) for ; Mon, 15 Feb 2021 17:48:56 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id yOwzHAi0KmBpfAAAB5/wlQ (envelope-from ) for ; Mon, 15 Feb 2021 17:48:56 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B177B15D68 for ; Mon, 15 Feb 2021 18:48:55 +0100 (CET) Received: from localhost ([::1]:32944 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lBhzR-0008O2-WA for larch@yhetil.org; Mon, 15 Feb 2021 12:48:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBhx9-0008Lf-9R for emacs-orgmode@gnu.org; Mon, 15 Feb 2021 12:46:38 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:54397) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lBhx3-0003DF-2m for emacs-orgmode@gnu.org; Mon, 15 Feb 2021 12:46:30 -0500 X-IronPort-AV: E=Sophos;i="5.81,181,1610406000"; d="asc'?scan'208";a="373132096" Received: from cbg35-2-78-242-14-140.fbx.proxad.net (HELO set) ([78.242.14.140]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Feb 2021 18:45:58 +0100 From: Alan Schmitt To: John Kitchin Subject: Re: programatically generate an agenda In-Reply-To: References: <878s7rq1wf.fsf@m4x.org> Date: Mon, 15 Feb 2021 18:45:49 +0100 Message-ID: <87a6s5usvm.fsf@m4x.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: neutral client-ip=192.134.164.104; envelope-from=alan.schmitt@polytechnique.org; helo=mail3-relais-sop.national.inria.fr X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NEUTRAL=0.779 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -4.46 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: B177B15D68 X-Spam-Score: -4.46 X-Migadu-Scanner: scn0.migadu.com X-TUID: XA9k/7UP7wK/ --=-=-= Content-Type: text/plain On 2021-02-14 12:12, John Kitchin writes: > If it is possible to set up what you want in an entry in > org-agenda-custom-commands, then you can call it in a program like > > #+BEGIN_SRC emacs-lisp > (org-agenda nil "w" nil) > #+END_SRC This is what I ended up doing. - set up an agenda view with only the current day and the events: #+begin_src emacs-lisp ("d" "Daily schedule" ((agenda "" ((org-agenda-span 'day) (org-agenda-use-time-grid nil) (org-agenda-skip-function '(org-agenda-skip-entry-if 'scheduled)) )))) #+end_src - use it with org-agenda write, massaging the results a little #+begin_src emacs-lisp (defun as/get-daily-agenda () "Return the agenda for the day as a string." (interactive) (let ((file (make-temp-file "daily-agenda" nil ".txt"))) (org-agenda nil "d" nil) (org-agenda-write file nil nil "*Org Agenda(d)*") (kill-buffer) (with-temp-buffer (insert-file-contents file) (goto-char (point-min)) (kill-line 2) (while (re-search-forward "^ " nil t) (replace-match "- " nil nil)) (buffer-string)))) #+end_src Thanks again for your suggestion. Best, Alan --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFTBAEBCAA9FiEE6lXof/BsSVW56ZmGBA0KO07S5ccFAmAqs04fHGFsYW4uc2No bWl0dEBwb2x5dGVjaG5pcXVlLm9yZwAKCRAEDQo7TtLlx9JdCACh9DZtR8w88oW0 OVJANSnHUT7zwA/6Uq0aM2Aq0EuHiso4JK0e8bx5BojgkFOYRVSEvJ5er5aEc9EI ogm/l9s8EP1qNeGkQgLiY/swqndfaVuSlkcrccBca8WoFCU1uNVozQYN6itfGxjO WUZueZB9l2dydmI042lvNDaNc0TqxB9rXe6coFdNdrx8kiUCQWnjhfULLCPNwbXD h0Xcv9TFJWvhOMxAgOFNk+BV0esPbcLkmZ4oL8v7U246+FPFYgTbWjIos79PdlNQ Utjivj6VpACWNZfYq5u2XL0BwTAgtFaTV77+yLH5ZooNvch0J++ZizQ7uBe+nbsZ 8gjuSyH+ =9Vra -----END PGP SIGNATURE----- --=-=-=--