From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id UPB8M1xMrV60LwAA0tVLHw (envelope-from ) for ; Sat, 02 May 2020 10:33:00 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 0NfpBGZMrV40LgAAB5/wlQ (envelope-from ) for ; Sat, 02 May 2020 10:33:10 +0000 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::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 1C1F0940059 for ; Sat, 2 May 2020 10:32:59 +0000 (UTC) Received: from localhost ([::1]:53460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUpS7-0006eP-0I for larch@yhetil.org; Sat, 02 May 2020 06:32:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51534) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUpRm-0006e7-WA for emacs-orgmode@gnu.org; Sat, 02 May 2020 06:32:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUpRm-0007oZ-J1 for emacs-orgmode@gnu.org; Sat, 02 May 2020 06:32:38 -0400 Received: from ciao.gmane.io ([159.69.161.202]:50316) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUpRm-0007mA-6D for emacs-orgmode@gnu.org; Sat, 02 May 2020 06:32:38 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1jUpRj-000NgT-Ko for emacs-orgmode@gnu.org; Sat, 02 May 2020 12:32:35 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Marco Wahl Subject: [idea] Dynamic agenda filtering Date: Sat, 02 May 2020 12:32:30 +0200 Message-ID: <87k11u8w5d.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:msJ5n7QEygzKOCBZceXsTZKTfrM= Received-SPF: pass client-ip=159.69.161.202; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/02 06:32:36 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Received-From: 159.69.161.202 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 X-Spam-Score: -0.41 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 2001:470:142::17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Scan-Result: default: False [-0.41 / 13.00]; GENERIC_REPUTATION(0.00)[-0.49488308366541]; DWL_DNSWL_FAIL(0.00)[2001:470:142::17:server fail]; R_SPF_ALLOW(-0.20)[+ip6:2001:470:142::/48:c]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; TO_DN_NONE(0.00)[]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.15), country: US(-0.00), ip: 2001:470:142::17(-0.49)]; MX_GOOD(-0.50)[cached: eggs.gnu.org]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_IN_DNSWL_FAIL(0.00)[2001:470:142::17:server fail]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:22989, ipnet:2001:470:142::/48, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; FROM_NEQ_ENVFROM(0.00)[marcowahlsoft@gmail.com,emacs-orgmode-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : SPF not aligned (relaxed), No valid DKIM,none] X-TUID: Q2mbCJnM1qtj Hi, These are a few lines of experimental code to bring dynamic filtering to the agenda. I think it's not too bad already. I'd like to invite you to check it out. Just mark the code and do {M-x eval-region RET}. Then you have the "dynamic filtering" on key "&" in the agenda. Just type to see the effect. BTW recall key "|" to remove all filters. #+begin_src emacs-lisp (defun org-agenda-dynamic-filter-minibuffer-contents () "Return the contents of the minibuffer when it is active." (when (active-minibuffer-window) (with-current-buffer (window-buffer (active-minibuffer-window)) (minibuffer-contents)))) (defun org-agenda-dynamic-filter-update-regexp () (with-current-buffer "*Org Agenda*" (org-agenda-remove-filter 'regexp)) (setq org-agenda-regexp-filter (if (string= "" (org-agenda-dynamic-filter-minibuffer-contents)) nil (list (concat "+" (org-agenda-dynamic-filter-minibuffer-contents))))) (with-current-buffer "*Org Agenda*" (cl-flet ((recenter (&optional arg redisplay) nil)) (org-agenda-finalize)))) (defun org-agenda-dynamic-filter-regexp-read () "Read string with PROMPT and display results dynamically. See also `org-agenda-filter-by-regexp'." (interactive) (unwind-protect (catch 'click (add-hook 'post-command-hook #'org-agenda-dynamic-filter-update-regexp) (read-string "Regexp: ")) (remove-hook 'post-command-hook #'org-agenda-dynamic-filter-update-regexp))) (org-defkey org-agenda-mode-map "&" #'org-agenda-dynamic-filter-regexp-read) #+end_src As always comments and all are very much appreciated. Possibly this can be developed into something useful. BTW for the implementation I glanced at the--in my opinion very nice--org-velocity.el . Ciao, -- Marco