From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: A puzzle to solve: saved categories vs. tags Date: Mon, 8 Oct 2007 09:48:49 +0200 Message-ID: <7fc2c048b6b1f8d2359406c8e67b3e0e@science.uva.nl> References: Mime-Version: 1.0 (Apple Message framework v624) Content-Type: multipart/mixed; boundary=Apple-Mail-4-921648675 Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IenMU-0001rb-3S for emacs-orgmode@gnu.org; Mon, 08 Oct 2007 03:49:10 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IenMO-0001lG-NQ for emacs-orgmode@gnu.org; Mon, 08 Oct 2007 03:49:05 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IenMO-0001kh-CZ for emacs-orgmode@gnu.org; Mon, 08 Oct 2007 03:49:04 -0400 Received: from korteweg.uva.nl ([146.50.98.70]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IenMN-0000AI-OD for emacs-orgmode@gnu.org; Mon, 08 Oct 2007 03:49:04 -0400 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: John Wiegley Cc: emacs-orgmode@gnu.org --Apple-Mail-4-921648675 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On Oct 7, 2007, at 11:14, John Wiegley wrote: > Ok, I have 147k of archived todos and notes now. Some are tagged, > some are > not. Most have an ARCHIVE_CATEGORY property (ever since Carsten so > kindly > implemented it). > > My desire: To hit C-u C-c \ and have it prompt me for the "entity" its > going > to search for. The possible entities are TAGS, or a property name. > Then it > asks for the text string, as usual. The result should make it > possible for me > to see all entries that came from a specific category or group of > categories. If I understand correctly, this will be just for typing convenience? So that you do not have to fully type the property name? Because you can of course do this search as Bastien described. Also, should this result in a sparse tree, or in an agenda buffer? I guess you mean a sparse tree since you refer to `C-c \'. Here is a first attempt at such a function, comments are welcome! Maybe we should bind this function to `C-c /', instead of org-occur? - Carsten --Apple-Mail-4-921648675 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="org-sparse-tree-interactive.el" Content-Disposition: attachment; filename=org-sparse-tree-interactive.el (defun org-sparse-tree (&optional arg) "Create a sparse tree, prompt for the details. This command can create sparse trees. You first need to select the type of match used to create the tree: t Show entries with a specific TODO keyword. T Show entries selected by a tags match. p Enter a property name and its value (both with completion on existing names/values) and show entries with that property. r Show entries matching a regular expression" (interactive "P") (let (ans kwd value) (message "Sparse tree: [r]egexp [t]odo-kwd [T]ag [p]roperty") (setq ans (read-char-exclusive)) (cond ((equal ans ?t) (org-show-todo-tree '(4))) ((equal ans ?T) (call-interactively 'org-tags-sparse-tree)) ((member ans '(?p ?P)) (setq kwd (completing-read "Property: " (mapcar 'list (org-buffer-property-keys t t)))) (setq value (completing-read "Value: " (mapcar 'list (org-property-values kwd)))) (or (string-match "\\`{.*}\\'") (setq value (concat "\"" value "\""))) (org-tags-sparse-tree arg (concat kwd "=" value))) ((member ans '(?r ?R)) (call-interactively 'org-occur)) (t (error "No such sparse tree command \"%c\"" ans))))) (defun org-property-values (key) "Return a list of all values of property KEY." (save-excursion (save-restriction (widen) (goto-char (point-min)) (let ((re (concat "^[ \t]*:" key ":[ \t]*\\(\\S-.*\\)")) values) (while (re-search-forward re nil t) (add-to-list 'values (org-trim (match-string 1)))) (delete "" values))))) --Apple-Mail-4-921648675 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed -- Carsten Dominik Sterrenkundig Instituut "Anton Pannekoek" Universiteit van Amsterdam Kruislaan 403 NL-1098SJ Amsterdam phone: +31 20 525 7477 --Apple-Mail-4-921648675 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --Apple-Mail-4-921648675--