emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: url/url.el - Duplicate requires


From: David Kastrup
Subject: Re: url/url.el - Duplicate requires
Date: Fri, 14 Oct 2005 12:17:52 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Cheng Gao <address@hidden> writes:

> Line 44-46:
> ,----
> | (eval-when-compile
> |   (require 'mm-decode)
> |   (require 'mm-view))
> `----
> But line 237-241:
> ,----
> | (defun url-mm-url (url)
> |   "Retrieve URL and pass to the appropriate viewing application."
> |   (require 'mm-decode)
> |   (require 'mm-view)
> |   (url-retrieve url 'url-mm-callback nil))
> `----
> mm-decode and mm-view are required again.
>
> Should the requires in function url-mm-url be removed?

require at run-time is a bad idea, and constructs like above with
eval-when-compile tend to create byte compiler warnings.  I think the
correct way to deal with this would be something like

(autoload 'url-retrieve 'mm-decode)
(defun url-mm-url (url)
  (url-retrieve url ...

That way, the byte compiler is satisfied, and no runtime performance
hit is scored by unneeded requires.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum




reply via email to

[Prev in Thread] Current Thread [Next in Thread]