emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@science.uva.nl>
To: Bastien <bzg@altern.org>
Cc: org-mode list <emacs-orgmode@gnu.org>
Subject: Re: A puzzle to solve: saved categories vs. tags
Date: Mon, 8 Oct 2007 13:48:18 +0200	[thread overview]
Message-ID: <4d056197e283a9e8c04025b4ad022c2e@science.uva.nl> (raw)
In-Reply-To: <87tzp14w7h.fsf@bzg.ath.cx>

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


On Oct 8, 2007, at 14:39, Bastien wrote:

> Carsten Dominik <dominik@science.uva.nl> writes:
>
>> Arrrgh!
>>
>> make that (org-buffer-property-keys t) for now, bug fix in next
>> release.
>
> This patch is also needed:

Indeed, thanks a lot.  So to make this simpler, here is
the modified version that should work out of the box.
Sorry once again for the mess and the bandwidth waste.

- Carsten

[-- Attachment #2: org-sparse-tree-interactive.el --]
[-- Type: application/octet-stream, Size: 1615 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))))
      (setq value (completing-read "Value: "
				   (mapcar 'list (org-property-values kwd))))
      (unless (string-match "\\`{.*}\\'" value)
	(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: 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 11:48 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
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 [this message]

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=4d056197e283a9e8c04025b4ad022c2e@science.uva.nl \
    --to=dominik@science.uva.nl \
    --cc=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    /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).