emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@science.uva.nl>
To: Adam Spiers <orgmode@adamspiers.org>
Cc: org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: proposal: defconst/defcustom org-tags-regexp
Date: Wed, 18 Jul 2007 23:24:40 +0200	[thread overview]
Message-ID: <56626b2502c1e0ead302243cb947b0b2@science.uva.nl> (raw)
In-Reply-To: <20070716132118.GA28297@atlantic.linksys.moosehall>


On Jul 16, 2007, at 15:21, Adam Spiers wrote:

> Hi again,
>
> There seem to be a number of hardcoded regexps currently used for
> matching heading tags, all very similar looking, and typically
> something like:
>
>   [ \t]*\\(:[[:alnum:]_@:]+:\\)?[ \t]*\\($\\|\r\\)
>
> Is there any reason why these shouldn't be factored out into a new
> defcustom org-tags-regexp?

Well, one reason is efficiency.  When a regular expression is a 
constant,
Emacs is able to cache the compiled version of the regular expression,
and this can speed up code that does a lot of matching quite a bit.  The
token you show above is usually part of a larger string, so the full
regular expression would have to be make with concat and will therefore
be recompiled all the time.

However, we could use a macro to process the concat at compile time.
This would still require that you have set the appropriate variables
at compile time, and you would need to recompile the Lisp
file after each change in this constant - not something that Emacs users
do expect.

Do you know a solution for this problem?

Still, I agree that what I did is bad programming in the sense that
things like this could/should be factored out.

- Carsten



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

  reply	other threads:[~2007-07-19  5:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-16 13:21 proposal: defconst/defcustom org-tags-regexp Adam Spiers
2007-07-18 21:24 ` Carsten Dominik [this message]
2007-07-19 13:08   ` Eddward DeVilla
2007-07-19 15:08     ` Carsten Dominik
2007-07-19 16:14       ` Eddward DeVilla
2007-07-20 15:05   ` Adam Spiers
     [not found]     ` <931245f7aaa24436377e537552f1beab@science.uva.nl>
2007-09-01 11:01       ` Adam Spiers
2007-09-02  7:30         ` 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=56626b2502c1e0ead302243cb947b0b2@science.uva.nl \
    --to=dominik@science.uva.nl \
    --cc=emacs-orgmode@gnu.org \
    --cc=orgmode@adamspiers.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).