unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* do-after-load-evaluation
@ 2006-06-23  3:22 Noah Friedman
  2006-06-23  8:08 ` do-after-load-evaluation Romain Francoise
  0 siblings, 1 reply; 5+ messages in thread
From: Noah Friedman @ 2006-06-23  3:22 UTC (permalink / raw)


The following change:

    2006-05-24  Alan Mackenzie  <acm@muc.de>

            * lread.c (Vafter_load_alist): doc-string: state that an element
            now has a regexp to match file names, not a file name as such.
  
breaks backward compatibility because now the after-load forms for "foo"
will be evaluated when "foobar" is loaded.

This is not backward compatible and it breaks things in a bad way, because
lots of packages have a common prefix, and it's not really possible to have
the same alist values for all versions of emacs.

If there were some new syntax for regexp members, e.g.

      ((:re "regexp")  forms...)

then an assoc in older versions of emacs won't match and the new syntax
won't confuse them.

So I propose making that change.


Besides that, the existing implementation looks only halfway finished to
me.  Why does Fprovide still use the old hardcoded Fassq+Fprogn evaluation
method?  It should call do-after-load-evaluation too and that function
should do the right thing for symbols.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: do-after-load-evaluation
  2006-06-23  3:22 do-after-load-evaluation Noah Friedman
@ 2006-06-23  8:08 ` Romain Francoise
  2006-06-23  8:12   ` do-after-load-evaluation David Kastrup
  0 siblings, 1 reply; 5+ messages in thread
From: Romain Francoise @ 2006-06-23  8:08 UTC (permalink / raw)
  Cc: emacs-devel

Noah Friedman <friedman@splode.com> writes:

> The following change:

>     2006-05-24  Alan Mackenzie  <acm@muc.de>

>             * lread.c (Vafter_load_alist): doc-string: state that an element
>             now has a regexp to match file names, not a file name as such.
>
> breaks backward compatibility because now the after-load forms for "foo"
> will be evaluated when "foobar" is loaded.

You should use `eval-after-load' instead of adding to `after-load-alist'
directly; it builds the following regexp for "foo":

    "\\(\\`\\|/\\)foo\\(\\.elc\\|\\.el\\)?\\(\\.gz\\)?\\'"

-- 
Romain Francoise <romain@orebokech.com> | The sea! the sea! the open
it's a miracle -- http://orebokech.com/ | sea! The blue, the fresh, the
                                        | ever free! --Bryan W. Procter

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: do-after-load-evaluation
  2006-06-23  8:08 ` do-after-load-evaluation Romain Francoise
@ 2006-06-23  8:12   ` David Kastrup
  2006-06-23 12:12     ` do-after-load-evaluation Romain Francoise
  0 siblings, 1 reply; 5+ messages in thread
From: David Kastrup @ 2006-06-23  8:12 UTC (permalink / raw)
  Cc: emacs-devel, Noah Friedman

Romain Francoise <romain@orebokech.com> writes:

> Noah Friedman <friedman@splode.com> writes:
>
>> The following change:
>
>>     2006-05-24  Alan Mackenzie  <acm@muc.de>
>
>>             * lread.c (Vafter_load_alist): doc-string: state that an element
>>             now has a regexp to match file names, not a file name as such.
>>
>> breaks backward compatibility because now the after-load forms for "foo"
>> will be evaluated when "foobar" is loaded.
>
> You should use `eval-after-load' instead of adding to `after-load-alist'
> directly; it builds the following regexp for "foo":
>
>     "\\(\\`\\|/\\)foo\\(\\.elc\\|\\.el\\)?\\(\\.gz\\)?\\'"

Any reason this is not
"\\(\\`\\|/\\)foo\\(\\.elc?\\)?\\(\\.gz\\)?\\'"
instead (should perform better)?  And is there a reason that .elc? is
optional?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: do-after-load-evaluation
  2006-06-23  8:12   ` do-after-load-evaluation David Kastrup
@ 2006-06-23 12:12     ` Romain Francoise
  2006-06-23 12:14       ` do-after-load-evaluation David Kastrup
  0 siblings, 1 reply; 5+ messages in thread
From: Romain Francoise @ 2006-06-23 12:12 UTC (permalink / raw)
  Cc: emacs-devel, Noah Friedman

David Kastrup <dak@gnu.org> writes:

> Any reason this is not "\\(\\`\\|/\\)foo\\(\\.elc?\\)?\\(\\.gz\\)?\\'"
> instead (should perform better)?

The regexp is built from `load-suffixes' in a place where we can't use
regexp-opt, so it's a simple mapconcat...  I'm not sure if performance
is an important factor in this context, anyway.

> And is there a reason that .elc? is optional?

I don't know about that... it's probably just to make the code do the
same thing as it did before the change.

-- 
Romain Francoise <romain@orebokech.com> | The sea! the sea! the open
it's a miracle -- http://orebokech.com/ | sea! The blue, the fresh, the
                                        | ever free! --Bryan W. Procter

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: do-after-load-evaluation
  2006-06-23 12:12     ` do-after-load-evaluation Romain Francoise
@ 2006-06-23 12:14       ` David Kastrup
  0 siblings, 0 replies; 5+ messages in thread
From: David Kastrup @ 2006-06-23 12:14 UTC (permalink / raw)
  Cc: emacs-devel, Noah Friedman

Romain Francoise <romain@orebokech.com> writes:

> David Kastrup <dak@gnu.org> writes:
>
>> Any reason this is not "\\(\\`\\|/\\)foo\\(\\.elc?\\)?\\(\\.gz\\)?\\'"
>> instead (should perform better)?
>
> The regexp is built from `load-suffixes' in a place where we can't use
> regexp-opt, so it's a simple mapconcat...  I'm not sure if performance
> is an important factor in this context, anyway.
>
>> And is there a reason that .elc? is optional?
>
> I don't know about that... it's probably just to make the code do the
> same thing as it did before the change.

Probably to catch (load "foo").  Ok.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-06-23 12:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-23  3:22 do-after-load-evaluation Noah Friedman
2006-06-23  8:08 ` do-after-load-evaluation Romain Francoise
2006-06-23  8:12   ` do-after-load-evaluation David Kastrup
2006-06-23 12:12     ` do-after-load-evaluation Romain Francoise
2006-06-23 12:14       ` do-after-load-evaluation David Kastrup

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).