[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: autoload and auto-compression-mode
From: |
Luc Teirlinck |
Subject: |
Re: autoload and auto-compression-mode |
Date: |
Mon, 16 Jan 2006 21:55:50 -0600 (CST) |
Richard Stallman wrote:
I don't think autoload with name "foo" should load foo.gz. foo.gz is
a compressed version of foo, and it would not load foo.
So I think that is a real bug.
My previous attempt at fixing it was _way_ to hasty (I should have
grepped more carefully), but I believe that the set of five patches
below should take care of the problem.
Treating those two kinds of suffixes as a separate feature
is a clean way to handle this. Would you like to implement it?
The five patches below do that. They export `default_suffixes' to
Lisp and have jka-compr-* use it.
I can install if desired. If the patches look OK, I will also update
lispref/loading.texi.
===File ~/lisp.h-diff=======================================
*** lisp.h 11 Dec 2005 11:59:10 -0600 1.547
--- lisp.h 16 Jan 2006 14:28:57 -0600
***************
*** 2610,2616 ****
#define LOADHIST_ATTACH(x) \
if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list)
extern Lisp_Object Vcurrent_load_list;
! extern Lisp_Object Vload_history, Vload_suffixes;
extern int openp P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
Lisp_Object *, Lisp_Object));
extern int isfloat_string P_ ((char *));
--- 2610,2616 ----
#define LOADHIST_ATTACH(x) \
if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list)
extern Lisp_Object Vcurrent_load_list;
! extern Lisp_Object Vload_history, Vload_suffixes, Vdefault_suffixes;
extern int openp P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
Lisp_Object *, Lisp_Object));
extern int isfloat_string P_ ((char *));
============================================================
===File ~/lread-diff========================================
*** lread.c 29 Dec 2005 23:04:56 -0600 1.346
--- lread.c 16 Jan 2006 21:34:05 -0600
***************
*** 98,104 ****
Lisp_Object Vsource_directory;
/* Search path and suffixes for files to be loaded. */
! Lisp_Object Vload_path, Vload_suffixes, default_suffixes;
/* File name of user's init file. */
Lisp_Object Vuser_init_file;
--- 98,104 ----
Lisp_Object Vsource_directory;
/* Search path and suffixes for files to be loaded. */
! Lisp_Object Vload_path, Vload_suffixes, Vdefault_suffixes;
/* File name of user's init file. */
Lisp_Object Vuser_init_file;
***************
*** 751,757 ****
(!NILP (nosuffix) ? Qnil
: !NILP (must_suffix) ? Vload_suffixes
: Fappend (2, (tmp[0] = Vload_suffixes,
! tmp[1] = default_suffixes,
tmp))),
&found, Qnil);
UNGCPRO;
--- 751,757 ----
(!NILP (nosuffix) ? Qnil
: !NILP (must_suffix) ? Vload_suffixes
: Fappend (2, (tmp[0] = Vload_suffixes,
! tmp[1] = Vdefault_suffixes,
tmp))),
&found, Qnil);
UNGCPRO;
***************
*** 1105,1111 ****
fn = (char *) alloca (fn_size = 100 + want_size);
/* Loop over suffixes. */
! for (tail = NILP (suffixes) ? default_suffixes : suffixes;
CONSP (tail); tail = XCDR (tail))
{
int lsuffix = SBYTES (XCAR (tail));
--- 1105,1111 ----
fn = (char *) alloca (fn_size = 100 + want_size);
/* Loop over suffixes. */
! for (tail = NILP (suffixes) ? Vdefault_suffixes : suffixes;
CONSP (tail); tail = XCDR (tail))
{
int lsuffix = SBYTES (XCAR (tail));
***************
*** 3901,3909 ****
This list should not include the empty string. */);
Vload_suffixes = Fcons (build_string (".elc"),
Fcons (build_string (".el"), Qnil));
/* We don't use empty_string because it's not initialized yet. */
! default_suffixes = Fcons (build_string (""), Qnil);
! staticpro (&default_suffixes);
DEFVAR_BOOL ("load-in-progress", &load_in_progress,
doc: /* Non-nil iff inside of `load'. */);
--- 3901,3912 ----
This list should not include the empty string. */);
Vload_suffixes = Fcons (build_string (".elc"),
Fcons (build_string (".el"), Qnil));
+ DEFVAR_LISP ("default-suffixes", &Vdefault_suffixes,
+ doc: /* Additional list of suffixes to try for files to load.
+ Loading tries these after `load-suffixes' if a suffix in `load-suffixes'
+ is not required. Normally includes the empty string. */);
/* We don't use empty_string because it's not initialized yet. */
! Vdefault_suffixes = Fcons (build_string (""), Qnil);
DEFVAR_BOOL ("load-in-progress", &load_in_progress,
doc: /* Non-nil iff inside of `load'. */);
============================================================
===File ~/jka-compr-diff====================================
*** jka-compr.el 10 Nov 2005 21:26:53 -0600 1.88
--- jka-compr.el 16 Jan 2006 13:59:06 -0600
***************
*** 706,712 ****
(dolist (suffix load-suffixes)
(unless (string-match re suffix)
(push suffix suffixes)))
! (setq load-suffixes (nreverse suffixes))))
(provide 'jka-compr)
--- 706,718 ----
(dolist (suffix load-suffixes)
(unless (string-match re suffix)
(push suffix suffixes)))
! (setq load-suffixes (nreverse suffixes)))
! (let ((suffixes nil)
! (re (jka-compr-build-file-regexp)))
! (dolist (suffix default-suffixes)
! (unless (string-match re suffix)
! (push suffix suffixes)))
! (setq default-suffixes (nreverse suffixes))))
(provide 'jka-compr)
============================================================
===File ~/jka-cmpr-hook-diff================================
*** jka-cmpr-hook.el 15 Nov 2005 21:55:16 -0600 1.8
--- jka-cmpr-hook.el 16 Jan 2006 14:02:11 -0600
***************
*** 217,230 ****
;; Make sure that (load "foo") will find /bla/foo.el.gz.
(setq load-suffixes
! (apply 'append
! (append (mapcar (lambda (suffix)
! (cons suffix
! (mapcar (lambda (ext) (concat suffix
ext))
! jka-compr-load-suffixes)))
! load-suffixes)
! (list jka-compr-load-suffixes)))))
!
(defun jka-compr-installed-p ()
"Return non-nil if jka-compr is installed.
--- 217,235 ----
;; Make sure that (load "foo") will find /bla/foo.el.gz.
(setq load-suffixes
! (apply 'append (mapcar (lambda (suffix)
! (cons suffix
! (mapcar (lambda (ext)
! (concat suffix ext))
! jka-compr-load-suffixes)))
! load-suffixes)))
! (setq default-suffixes
! (apply 'append (mapcar (lambda (suffix)
! (cons suffix
! (mapcar (lambda (ext)
! (concat suffix ext))
! jka-compr-load-suffixes)))
! default-suffixes))))
(defun jka-compr-installed-p ()
"Return non-nil if jka-compr is installed.
============================================================
===File ~/subr-diff=========================================
*** subr.el 30 Dec 2005 08:35:47 -0600 1.493
--- subr.el 16 Jan 2006 18:47:52 -0600
***************
*** 1328,1334 ****
t))
(let ((file (locate-file library
(or path load-path)
! (append (unless nosuffix load-suffixes) '("")))))
(if interactive-call
(if file
(message "Library is file %s" (abbreviate-file-name file))
--- 1328,1335 ----
t))
(let ((file (locate-file library
(or path load-path)
! (append (unless nosuffix load-suffixes)
! default-suffixes))))
(if interactive-call
(if file
(message "Library is file %s" (abbreviate-file-name file))
============================================================
- Re: autoload and auto-compression-mode, (continued)
- Re: autoload and auto-compression-mode, Richard M. Stallman, 2006/01/16
- Re: autoload and auto-compression-mode, Luc Teirlinck, 2006/01/15
- Re: autoload and auto-compression-mode, Luc Teirlinck, 2006/01/15
- Re: autoload and auto-compression-mode, Stefan Monnier, 2006/01/15
- Re: autoload and auto-compression-mode, Luc Teirlinck, 2006/01/15
- Re: autoload and auto-compression-mode, Stefan Monnier, 2006/01/16
- Re: autoload and auto-compression-mode, Luc Teirlinck, 2006/01/16
- Re: autoload and auto-compression-mode, Luc Teirlinck, 2006/01/16
- Re: autoload and auto-compression-mode, Richard M. Stallman, 2006/01/17
- Re: autoload and auto-compression-mode, Richard M. Stallman, 2006/01/16
- Re: autoload and auto-compression-mode,
Luc Teirlinck <=
- Re: autoload and auto-compression-mode, Stefan Monnier, 2006/01/17
- Re: autoload and auto-compression-mode, Richard M. Stallman, 2006/01/17
- Re: autoload and auto-compression-mode, Luc Teirlinck, 2006/01/17
- Re: autoload and auto-compression-mode, Richard M. Stallman, 2006/01/19
- Re: autoload and auto-compression-mode, Luc Teirlinck, 2006/01/17
- Re: autoload and auto-compression-mode, Stefan Monnier, 2006/01/17
- Re: autoload and auto-compression-mode, Richard M. Stallman, 2006/01/19
- Re: autoload and auto-compression-mode, Luc Teirlinck, 2006/01/19
- Re: autoload and auto-compression-mode, Stefan Monnier, 2006/01/20
- Re: autoload and auto-compression-mode, Richard M. Stallman, 2006/01/21