emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@science.uva.nl>
To: John Wiegley <johnw@newartisans.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: A puzzle to solve: saved categories vs. tags
Date: Mon, 8 Oct 2007 09:48:49 +0200	[thread overview]
Message-ID: <7fc2c048b6b1f8d2359406c8e67b3e0e@science.uva.nl> (raw)
In-Reply-To: <m2641je17p.fsf@newartisans.com>

[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]


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


[-- Attachment #2: org-sparse-tree-interactive.el --]
[-- Type: application/octet-stream, Size: 1608 bytes --]

(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)))))

[-- Attachment #3: Type: text/plain, Size: 146 bytes --]



--
Carsten Dominik
Sterrenkundig Instituut "Anton Pannekoek"
Universiteit van Amsterdam
Kruislaan 403
NL-1098SJ Amsterdam
phone: +31 20 525 7477

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

  parent reply	other threads:[~2007-10-08  7:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-07  9:14 A puzzle to solve: saved categories vs. tags John Wiegley
2007-10-07 12:27 ` Bastien
2007-10-07 20:27   ` John Wiegley
2007-10-08  9:43     ` Bastien
2007-10-08  7:06   ` Carsten Dominik
2007-10-08 18:09   ` Carsten Dominik
2007-10-08  7:48 ` Carsten Dominik [this message]
2007-10-08 10:54   ` Bastien
2007-10-08 10:50     ` Carsten Dominik
     [not found]       ` <87tzp14w7h.fsf@bzg.ath.cx>
2007-10-08 11:48         ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7fc2c048b6b1f8d2359406c8e67b3e0e@science.uva.nl \
    --to=dominik@science.uva.nl \
    --cc=emacs-orgmode@gnu.org \
    --cc=johnw@newartisans.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).