From mboxrd@z Thu Jan 1 00:00:00 1970 From: Max Mikhanosha Subject: Hack: org-agenda-cache.el Date: Sun, 15 Jan 2012 14:47:11 -0500 Message-ID: <87r4z0bveo.wl%max@openchat.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Sun_Jan_15_14:47:11_2012-1" Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:42665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmWc2-0006q1-J5 for emacs-orgmode@gnu.org; Sun, 15 Jan 2012 15:23:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RmWbq-00017l-NA for emacs-orgmode@gnu.org; Sun, 15 Jan 2012 15:23:34 -0500 Received: from p84-72.acedsl.com ([66.114.84.72]:38334 helo=momoland.openchat.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RmWbq-00017a-2D for emacs-orgmode@gnu.org; Sun, 15 Jan 2012 15:23:22 -0500 Received: from momoland.openchat.com (localhost [IPv6:::1]) by momoland.openchat.com (Postfix) with ESMTP id 9EDBFED2E4 for ; Sun, 15 Jan 2012 14:47:11 -0500 (EST) 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: emacs-orgmode@gnu.org --Multipart_Sun_Jan_15_14:47:11_2012-1 Content-Type: text/plain; charset=US-ASCII As my agenda files slowly grew over the years, the speed of generating agenda had slowly deteriorated, finally hitting the point of me jdoing something about it. (it got to around 5-7 seconds, which kind of interrupts work-flow) Attached file org-agenda-cache.el is a "quick fix" solution that I developed for myself, its more of a request for discussion and not intended as contribution yet. Basic idea is: 1. Multiple-agenda buffers can exist at the same time, having separate tag filters and other such settings. This is accomplished by bunch of org-agenda-* variables being made buffer-local. 2. Custom agenda commands should bind `org-agenda-buffer-name' variable, so that for example C-c a generates "*Agenda*" buffer and C-c t generates "*Todo List*" buffer. 3. org-agenda checks if buffer with `org-agenda-buffer-name' exists and if it does, it will show that buffer, rather then re-generating it. To generate a fresh agenda, becomes C-c a r instead of C-c a 4. org-agenda-quit buries the agenda buffer instead of killing it. 5. All of the above shenanigans can be switched on and off by doing M-x toggle-org-agenda-caching command, its off by default so you have to turn it on after loading the file. I had been using this setup for last few days, and it had really been a blast, returning me to the times when I just started with org-mode, and information had appeared in milliseconds rather then seconds. --Multipart_Sun_Jan_15_14:47:11_2012-1 Content-Type: application/octet-stream; type=emacs-lisp Content-Disposition: attachment; filename="org-agenda-cache.el" Content-Transfer-Encoding: base64 Ozs7IG9yZy1hZ2VuZGEtY2FjaGUuZWwgLS0tIENhY2hlIGFnZW5kYSBidWZmZXJzIGluc3RlYWQg b2YgcmVnZW5lcmF0aW5nIHRoZW0gZWFjaCB0aW1lCgo7OyBDYWNoZWQgYWdlbmRhIGJ1ZmZlcnMK OzsKOzsgVG9nZ2xlIHdpdGggTS14IHRvZ2dsZS1vcmctYWdlbmRhLWNhY2hpbmcKOzsKOzsgSWYg eW91IGluY2x1ZGUgYG9yZy1hZ2VuZGEtYnVmZmVyLW5hbWUnIGludG8gdGhlIGxpc3Qgb2YgYm91 bmQKOzsgdmFyaWFibGVzIGZvciBhIHNwZWNpZmljIGFnZW5kYSB2aWV3LCB0aGVuIHRoZXNlIGFn ZW5kYSB2aWV3cwo7OyB3aWxsIGJlIGNhY2hlZCBpbmRlcGVuZGVudGx5IGVhY2ggaW4gdGhlaXIg b3duIGJ1ZmZlcgo7Owo7OyBFeGFtcGxlIHNldHVwOgo7Owo7OyAoc2V0cSBvcmctYWdlbmRhLWN1 c3RvbS1jb21tYW5kcwo7OyAgICAgICAnKCgiYSIgIkFnZW5kYSBhbmQgTkVYVCAocHJpb3JpdHkp Igo7OyAgICAgICAgICAoKGFnZW5kYSAiIgo7OyAgICAgICAgICAgICAgICAgICAoKG9yZy1hZ2Vu ZGEtc3BhbiAnZGF5KSkpCjs7ICAgICAgICAgICAodGFncy10b2RvICIvIU5FWFQiCjs7ICAgICAg ICAgICAgICAgICAgICAgICgob3JnLWFnZW5kYS1vdmVycmlkaW5nLWhlYWRlciAiTmV4dCBUYXNr cyIpCjs7ICAgICAgICAgICAgICAgICAgICAgICAob3JnLWFnZW5kYS10YWdzLXRvZG8taG9ub3It aWdub3JlLW9wdGlvbnMgdCkKOzsgICAgICAgICAgICAgICAgICAgICAgIChvcmctYWdlbmRhLXRv ZG8taWdub3JlLXNjaGVkdWxlZCB0KQo7OyAgICAgICAgICAgICAgICAgICAgICAgKG9yZy1hZ2Vu ZGEtdG9kby1pZ25vcmUtZGVhZGxpbmVzIHQpCjs7ICAgICAgICAgICAgICAgICAgICAgICAob3Jn LXRhZ3MtbWF0Y2gtbGlzdC1zdWJsZXZlbHMgdCkKOzsgICAgICAgICAgICAgICAgICAgICAgIChv cmctYWdlbmRhLXNvcnRpbmctc3RyYXRlZ3kKOzsgICAgICAgICAgICAgICAgICAgICAgICAnKHBy aW9yaXR5LWRvd24gY2F0ZWdvcnkta2VlcCkpKSkpCjs7ICAgICAgICAgICgob3JnLWFnZW5kYS1i dWZmZXItbmFtZSAiKkFnZW5kYSoiKSkpCjs7ICAgICAgICAgKCJ0IiAiVE9ETyBlbnRyaWVzIgo7 OyAgICAgICAgICB0b2RvICIiCjs7ICAgICAgICAgICgob3JnLWFnZW5kYS1idWZmZXItbmFtZSAi KlRvZG8gTGlzdCoiKSkpKSkKOzsKOzsgTm90ZSB0aGF0IEMtYyBhIGFuZCBDLWMgdCB3aWxsIHVz ZSB0d28gZGlmZmVyZW50IGFnZW5kYSBidWZmZXJzCjs7IHRoYXQgYXJlIGluZGVjZW50IG9mIGVh Y2ggb3RoZXIsIGFuZCBlYWNoIGNhbiBoYXZlIGRpZmZlcmVudCByZXN0cmljdGlvbnMKOzsgb3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FnZW5kYS1idWZmZXItbmFtZQogICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgb3JnLWFnZW5kYS1idWZmZXItbmFtZSkpKQogICAg ICAgIChzZXRxIGFkLXJldHVybi12YWx1ZSBhZC1kby1pdCkpCiAgICAoc2V0cSBhZC1yZXR1cm4t dmFsdWUgYWQtZG8taXQpKSkKCihkZWZhZHZpY2Ugb3JnLXByZXBhcmUtYWdlbmRhIChhcm91bmQg Y2FjaGVkLWFnZW5kYS1idWZmZXIgYWN0aXZhdGUpCiAgKGlmIG9yZy1hZ2VuZGEtdXNlLWNhY2hp bmcKICAgICAgKGlmIChvciAobm90IG9yZy1hZ2VuZGEtaW5zaWRlLW9yZy1hZ2VuZGEpCiAgICAg ICAgICAgICAgb3JnLWFnZW5kYS1tdWx0aQogICAgICAgICAgICAgIChub3QgKGdldC1idWZmZXIg b3JnLWFnZW5kYS1idWZmZXItbmFtZSkpCiAgICAgICAgICAgICAgKHdpdGgtY3VycmVudC1idWZm ZXIgKGdldC1idWZmZXIgb3JnLWFnZW5kYS1idWZmZXItbmFtZSkKICAgICAgICAgICAgICAgIChu b3QgKGVxdWFsCiAgICAgICAgICAgICAgICAgICAgICBjdXJyZW50LXByZWZpeC1hcmcKICAgICAg ICAgICAgICAgICAgICAgIG9yZy1jYWNoZWQtYWdlbmRhLWxhc3QtcHJlZml4LWFyZykpKSkKICAg ICAgICAgIChwcm9nbgogICAgICAgICAgICAoc2V0cSBhZC1yZXR1cm4tdmFsdWUgYWQtZG8taXQp CiAgICAgICAgICAgICh3aXRoLWN1cnJlbnQtYnVmZmVyIChnZXQtYnVmZmVyIG9yZy1hZ2VuZGEt YnVmZmVyLW5hbWUpCiAgICAgICAgICAgICAgKHNldHEgb3JnLWNhY2hlZC1hZ2VuZGEtbGFzdC1w cmVmaXgtYXJnIGN1cnJlbnQtcHJlZml4LWFyZykKICAgICAgICAgICAgICAoc2V0cSBvcmctdGhp cy1hZ2VuZGEtYnVmZmVyLW5hbWUgb3JnLWFnZW5kYS1idWZmZXItbmFtZSkpKQogICAgICAgIDs7 IEJlbG93IGJsb2NrIGN1dC1uLXBhc3RlIGNvcGllZCBmcm9tIHJlYWwgYG9yZy1wcmVwYXJlLWFn ZW5kYScgZnVuY3Rpb24KICAgICAgICAobGV0KiAoKGFidWYgKGdldC1idWZmZXItY3JlYXRlIG9y Zy1hZ2VuZGEtYnVmZmVyLW5hbWUpKQogICAgICAgICAgICAgICAoYXdpbiAoZ2V0LWJ1ZmZlci13 aW5kb3cgYWJ1ZikpKQogICAgICAgICAgKGNvbmQKICAgICAgICAgICAoKGVxdWFsIChjdXJyZW50 LWJ1ZmZlcikgYWJ1ZikgbmlsKQogICAgICAgICAgIChhd2luIChzZWxlY3Qtd2luZG93IGF3aW4p KQogICAgICAgICAgICgobm90IChzZXRxIG9yZy1wcmUtYWdlbmRhLXdpbmRvdy1jb25mIChjdXJy ZW50LXdpbmRvdy1jb25maWd1cmF0aW9uKSkpKQogICAgICAgICAgICgoZXF1YWwgb3JnLWFnZW5k YS13aW5kb3ctc2V0dXAgJ2N1cnJlbnQtd2luZG93KQogICAgICAgICAgICAob3JnLXBvcC10by1i dWZmZXItc2FtZS13aW5kb3cgYWJ1ZikpCiAgICAgICAgICAgKChlcXVhbCBvcmctYWdlbmRhLXdp bmRvdy1zZXR1cCAnb3RoZXItd2luZG93KQogICAgICAgICAgICAob3JnLXN3aXRjaC10by1idWZm ZXItb3RoZXItd2luZG93IGFidWYpKQogICAgICAgICAgICgoZXF1YWwgb3JnLWFnZW5kYS13aW5k b3ctc2V0dXAgJ290aGVyLWZyYW1lKQogICAgICAgICAgICAoc3dpdGNoLXRvLWJ1ZmZlci1vdGhl ci1mcmFtZSBhYnVmKSkKICAgICAgICAgICAoKGVxdWFsIG9yZy1hZ2VuZGEtd2luZG93LXNldHVw ICdyZW9yZ2FuaXplLWZyYW1lKQogICAgICAgICAgICAoZGVsZXRlLW90aGVyLXdpbmRvd3MpCiAg ICAgICA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ICAgICAgIChkZWxldGUtZnJhbWUpKQogICAgICAoYW5k IChub3QgKGVxIG9yZy1hZ2VuZGEtd2luZG93LXNldHVwICdjdXJyZW50LXdpbmRvdykpCiAgICAg ICAgICAgKG5vdCAob25lLXdpbmRvdy1wKSkKICAgICAgICAgICAoZGVsZXRlLXdpbmRvdykpKQog ICAgKHdpdGgtY3VycmVudC1idWZmZXIgYnVmCiAgICAgICAgKGJ1cnktYnVmZmVyKSkpKQoKKHBy b3ZpZGUgJ29yZy1hZ2VuZGEtY2FjaGUpCg== --Multipart_Sun_Jan_15_14:47:11_2012-1 Content-Type: text/plain; charset=US-ASCII --Multipart_Sun_Jan_15_14:47:11_2012-1--