emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Adam Porter <adam@alphapapa.net>
To: emacs-orgmode@gnu.org
Subject: Re: Properties Drawer versus tags
Date: Fri, 20 Dec 2019 11:17:15 -0600	[thread overview]
Message-ID: <87r20yq5lw.fsf@alphapapa.net> (raw)
In-Reply-To: CAFAhFSVTGWS+hDKjWMTytr0AAqfA8aXzAtJk+F2uzR=vcUOJOw@mail.gmail.com

I'll try to explain my view of tags.  Let's see if it makes sense.  :)

Conceptually, properties are like a generic key-value store for
headings, and tags are like a certain property.  Imagine if, instead of
tags being placed in headings, like this:

  * Blueberries  :food:fruit:

...tags were implemented as properties, like this:

  * Blueberries
  :PROPERTIES:
  :TAGS: food fruit
  :END:

The meaning would be essentially the same.

From a technical perspective, putting tags on headings makes them much
faster to search for, because a regexp can be used to search directly to
them (local ones, anyway).  In contrast, to find the next location of a
certain property, a single regexp search is not enough, because even if
a regexp search was done to find an entry like the previous example,
like:

  (re-search-forward
    (rx bol ":TAGS:" (1+ blank) (0+ nonl) bow "food" eow)
    nil t)

...it would not be guaranteed that the result would actually be in a
heading's property drawer, so additional checks must be done to ensure
that.

Some properties are special, like CATEGORY.  As well, some properties
are "virtual," like SCHEDULED, which is written like:

  * Heading
  SCHEDULED: <2019-12-20 Fri 11:00>

...but is accessible with org-entry-get, like a property in a drawer.

So, use tags for applying simple, conceptual labels to headings, because
they're faster to search for than properties and always visible.  Use
properties as a key-value store for details that are less likely to be
used in a query and are less important to see.

What do you think?  :)

      parent reply	other threads:[~2019-12-20 17:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20  6:24 Properties Drawer versus tags Lawrence Bottorff
     [not found] ` <CACv55yT8Lg+Z=gR0hyUhQ-08bFqn9xMtLn6JP=EZQzQMf_SXqg@mail.gmail.com>
2019-12-20  6:46   ` David R
2019-12-20  6:47   ` Fwd: " David R
2019-12-20 11:54 ` Allen Li
2019-12-20 15:18 ` Ken Mankoff
2019-12-20 16:35   ` Lawrence Bottorff
2019-12-20 17:17 ` Adam Porter [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=87r20yq5lw.fsf@alphapapa.net \
    --to=adam@alphapapa.net \
    --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).