* Generate list of all tags in use?
@ 2010-11-25 1:38 Uriel Avalos
2010-11-25 3:15 ` Richard Lawrence
2010-11-26 5:01 ` Matt Lundin
0 siblings, 2 replies; 6+ messages in thread
From: Uriel Avalos @ 2010-11-25 1:38 UTC (permalink / raw)
To: emacs-orgmode
Is there a way to generate a list of all tags in use in all agenda files?
I'm thinking of something like a tag cloud.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Generate list of all tags in use?
2010-11-25 1:38 Generate list of all tags in use? Uriel Avalos
@ 2010-11-25 3:15 ` Richard Lawrence
2010-11-30 18:40 ` Uriel Avalos
2010-11-26 5:01 ` Matt Lundin
1 sibling, 1 reply; 6+ messages in thread
From: Richard Lawrence @ 2010-11-25 3:15 UTC (permalink / raw)
To: emacs-orgmode
Hi Uriel,
> Is there a way to generate a list of all tags in use in all agenda files?
> I'm thinking of something like a tag cloud.
Would org-get-buffer-tags help you out?
Richard
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Generate list of all tags in use?
2010-11-25 1:38 Generate list of all tags in use? Uriel Avalos
2010-11-25 3:15 ` Richard Lawrence
@ 2010-11-26 5:01 ` Matt Lundin
1 sibling, 0 replies; 6+ messages in thread
From: Matt Lundin @ 2010-11-26 5:01 UTC (permalink / raw)
To: Uriel Avalos; +Cc: emacs-orgmode
Uriel Avalos <amscopub-mail@yahoo.com> writes:
> Is there a way to generate a list of all tags in use in all agenda files?
Yes. Please see the documentation for the function
org-global-tags-completion-table, as suggested in the other recent
thread on this topic:
http://permalink.gmane.org/gmane.emacs.orgmode/33995
The function above returns a list suitable for use with, say,
completing-read.
> I'm thinking of something like a tag cloud.
Could you please clarify in which context you'd like this list generated
(in a buffer, as a list returned to another function, etc.)?
The following expression will return a list of strings (without text
properties) containing all the tags in your agenda files:
--8<---------------cut here---------------start------------->8---
(mapcar (lambda (tag)
(substring-no-properties (car tag)))
(org-global-tags-completion-table))
--8<---------------cut here---------------end--------------->8---
If you'd like to insert an alphabetical list of tags in an org buffer,
you could evaluate a source block such as the following:
--8<---------------cut here---------------start------------->8---
#+begin_src emacs-lisp
(mapconcat 'identity
(sort (mapcar
(lambda (tag)
(substring-no-properties (car tag)))
(org-global-tags-completion-table))
'string<)
"\n")
#+end_src
--8<---------------cut here---------------end--------------->8---
Finally, you could write a function (or, say, a quick perl script) to
find all tags in your org files, sort them by the number of times they
appear, and spit out the results. I use the following:
--8<---------------cut here---------------start------------->8---
#!/usr/bin/perl
use strict;
use warnings;
my %tags;
while (<>) {
next unless (/^\*+\s/);
if (/\s:([\w:]+):\s/) {
for my $tag (split(/:/, $1)) {
$tags{$tag} += 1;
}
}
}
for my $tag (sort {$tags{$b} <=> $tags{$a}} keys %tags) {
print "$tag ($tags{$tag})\n";
}
--8<---------------cut here---------------end--------------->8---
Save this script and name orgtags.pl or the like. Then simply run
orgtags.pl on the desired org files:
% perl orgtags.pl ~/org/*.org
And you should receive a listing of tags that looks like this:
home (185)
email (93)
read (75)
think (73)
errands (62)
phone (59)
CONTACT (49)
ATTACH (45)
yard (37)
desk (36)
BIB (34)
NEXT (28)
...
[snip]
Obviously, you could do a lot more, but this is an example of a "quick
and dirty" tag cloud.
HTH,
Matt
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: Generate list of all tags in use?
2010-11-25 3:15 ` Richard Lawrence
@ 2010-11-30 18:40 ` Uriel Avalos
2010-12-08 23:32 ` Matt Lundin
0 siblings, 1 reply; 6+ messages in thread
From: Uriel Avalos @ 2010-11-30 18:40 UTC (permalink / raw)
To: emacs-orgmode
That's a start but not quite what I was looking for. First, I thinking
of a global tag list. Second, I was thinking in terms of some kind of
agenda view. That function just ouputs the buffer tags in the
mini-buffer at the bottom.
On Wed, 24 Nov 2010 19:15:17 -0800
Richard Lawrence <richard.lawrence@berkeley.edu> wrote:
> Hi Uriel,
>
> > Is there a way to generate a list of all tags in use in all agenda files?
> > I'm thinking of something like a tag cloud.
>
> Would org-get-buffer-tags help you out?
>
> Richard
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Generate list of all tags in use?
2010-11-30 18:40 ` Uriel Avalos
@ 2010-12-08 23:32 ` Matt Lundin
2010-12-11 14:04 ` Uriel Avalos
0 siblings, 1 reply; 6+ messages in thread
From: Matt Lundin @ 2010-12-08 23:32 UTC (permalink / raw)
To: Uriel Avalos; +Cc: emacs-orgmode
Uriel Avalos <amscopub-mail@yahoo.com> writes:
> That's a start but not quite what I was looking for. First, I thinking
> of a global tag list. Second, I was thinking in terms of some kind of
> agenda view. That function just ouputs the buffer tags in the
> mini-buffer at the bottom.
Did you see this post?
http://permalink.gmane.org/gmane.emacs.orgmode/34069
- Matt
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Generate list of all tags in use?
2010-12-08 23:32 ` Matt Lundin
@ 2010-12-11 14:04 ` Uriel Avalos
0 siblings, 0 replies; 6+ messages in thread
From: Uriel Avalos @ 2010-12-11 14:04 UTC (permalink / raw)
To: Matt Lundin, emacs-orgmode
Thanks for the reply and the code.
No I hadn't seen that post. What would also be awesome is that when you click on one of the tags in the generated list, it launches a search for all headlines with that tag (C-c C-o with the cursor on a tag).
Unfortunately, I'm not a lisp programmer (yet).
On Wed, 08 Dec 2010 18:32:12 -0500
Matt Lundin <mdl@imapmail.org> wrote:
> Uriel Avalos <amscopub-mail@yahoo.com> writes:
>
> > That's a start but not quite what I was looking for. First, I thinking
> > of a global tag list. Second, I was thinking in terms of some kind of
> > agenda view. That function just ouputs the buffer tags in the
> > mini-buffer at the bottom.
>
> Did you see this post?
>
> http://permalink.gmane.org/gmane.emacs.orgmode/34069
>
> - Matt
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-12-11 14:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-25 1:38 Generate list of all tags in use? Uriel Avalos
2010-11-25 3:15 ` Richard Lawrence
2010-11-30 18:40 ` Uriel Avalos
2010-12-08 23:32 ` Matt Lundin
2010-12-11 14:04 ` Uriel Avalos
2010-11-26 5:01 ` Matt Lundin
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.