all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Cc: Carsten Dominik <dominik@science.uva.nl>, emacs-devel@gnu.org
Subject: Re: Inefficient code in reftex-index.el
Date: Tue, 07 Jun 2005 01:55:42 +0200	[thread overview]
Message-ID: <858y1n2g75.fsf@lola.goethe.zz> (raw)
In-Reply-To: <m3y89n86oe.fsf@kfs-l.imdomain.dk> (Kim F. Storm's message of "Tue, 07 Jun 2005 00:24:49 +0200")

storm@cua.dk (Kim F. Storm) writes:

> storm@cua.dk (Kim F. Storm) writes:
>
>>
>> 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))))
>
> I made the change slightly different to avoid adding another arg to
> Fset_match_data, which causes problems at C level.  Instead, if first
> arg to match-data is 'evaporate', set-match-data will eventually free
> markers on the resulting list...

So if INTEGERS is 'evaporate, we don't get integers but markers, and
those will be unseated at restore time.

In addition, the list will get prolonged by one additional member.
This is probably not too tragic since I don't see anybody else
accessing a data structure created with (set-match-data 'evaporate),
but it is hardly an element of beauty.  Should not
(match-data whatever '(evaporate marker1 marker2 ...)) also clean
up the markers passed in for reuse?

Anyway, allow me to throw a fit.  The whole match-data thing was ugly
previously, but this surely takes the cake, platter and all.

At the very least, the INTEGERS argument should be renamed to
something more in line with the new function.  But I don't like that
interface at all, really.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  reply	other threads:[~2005-06-06 23:55 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-06 12:08 Inefficient code in reftex-index.el Kim F. Storm
2005-06-06 12:39 ` David Kastrup
2005-06-06 13:52   ` Stefan Monnier
2005-06-06 14:14     ` Kim F. Storm
2005-06-06 14:15     ` Juanma Barranquero
2005-06-06 14:18   ` Kim F. Storm
2005-06-06 22:24     ` Kim F. Storm
2005-06-06 23:55       ` David Kastrup [this message]
2005-06-07  8:46         ` Kim F. Storm
2005-06-07  9:23           ` David Kastrup
2005-06-07 10:38             ` Kim F. Storm
2005-06-07 11:05               ` David Kastrup
2005-06-07 11:28                 ` Kim F. Storm
2005-06-07 14:28               ` Richard Stallman
2005-06-07 14:46                 ` Kim F. Storm
2005-06-07 18:06                 ` Stefan Monnier
2005-06-08  8:44                   ` Kim F. Storm
2005-06-08  9:47                   ` David Kastrup
2005-06-08 10:00                     ` Kim F. Storm
2005-06-08 10:11                       ` David Kastrup
2005-06-08 15:59                   ` Richard Stallman
2005-06-08 16:25                     ` David Kastrup
2005-06-09 14:40                       ` Richard Stallman
2005-06-09 15:05                         ` David Kastrup
2005-06-10 13:30                           ` Richard Stallman
2005-06-10 14:13                             ` David Kastrup
2005-06-07 14:28           ` Richard Stallman
2005-06-07 14:35             ` David Kastrup
2005-06-08 15:59               ` Richard Stallman
2005-06-07 14:42             ` Kim F. Storm
2005-06-07 18:11           ` Stefan Monnier
2005-06-08 12:01       ` Richard Stallman
2005-06-08 23:08         ` Kim F. Storm
2005-06-07 12:24     ` Richard Stallman
2005-06-06 14:41   ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=858y1n2g75.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=dominik@science.uva.nl \
    --cc=emacs-devel@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 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.