[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Inefficient code in reftex-index.el
From: |
Kim F. Storm |
Subject: |
Re: Inefficient code in reftex-index.el |
Date: |
Mon, 06 Jun 2005 16:18:26 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
David Kastrup <address@hidden> writes:
> That is not the same: the above will set beg and end to markers,
How "clever" ... I would NEVER have guessed that.
> whereas match-beginning/match-end happen to be integers. However, the
> above will also create markers that are unused, so it would be saner
> to call (match-data) only once _if_ indeed markers are what is
> required.
>
> Unused markers slow done editing operations afterwards. So even if
> markers _are_ what is wanted for some reason, they should be
> explicitly unseated with set-marker once they are no longer needed.
Which brings me to the suggestion that we add an optional arg to
set-match-data like this:
(set-match-data list &optional destroy-markers)
and change save-match-data to use it
(defmacro save-match-data (&rest body)
"Execute the BODY forms, restoring the global value of the match data.
The value returned is the value of the last form in BODY."
;; It is better not to use backquote here,
;; because that makes a bootstrapping problem
;; if you need to recompile all the Lisp files using interpreted code.
(declare (indent 0) (debug t))
(list 'let
'((save-match-data-internal (match-data)))
(list 'unwind-protect
(cons 'progn body)
'(set-match-data save-match-data-internal t))))
--
Kim F. Storm <address@hidden> http://www.cua.dk
- Inefficient code in reftex-index.el, Kim F. Storm, 2005/06/06
- Re: Inefficient code in reftex-index.el, David Kastrup, 2005/06/06
- Re: Inefficient code in reftex-index.el, Stefan Monnier, 2005/06/06
- Re: Inefficient code in reftex-index.el,
Kim F. Storm <=
- Re: Inefficient code in reftex-index.el, Kim F. Storm, 2005/06/06
- Re: Inefficient code in reftex-index.el, David Kastrup, 2005/06/06
- Re: Inefficient code in reftex-index.el, Kim F. Storm, 2005/06/07
- Re: Inefficient code in reftex-index.el, David Kastrup, 2005/06/07
- Re: Inefficient code in reftex-index.el, Kim F. Storm, 2005/06/07
- Re: Inefficient code in reftex-index.el, David Kastrup, 2005/06/07
- Re: Inefficient code in reftex-index.el, Kim F. Storm, 2005/06/07
- Re: Inefficient code in reftex-index.el, Richard Stallman, 2005/06/07
- Re: Inefficient code in reftex-index.el, Kim F. Storm, 2005/06/07
- Re: Inefficient code in reftex-index.el, Stefan Monnier, 2005/06/07