From: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: Changing load-suffixes
Date: Sun, 19 Feb 2006 00:21:29 -0500 [thread overview]
Message-ID: <87bqx3hqjq.fsf@stupidchicken.com> (raw)
In-Reply-To: <E1F8oFY-0007W4-7Q@fencepost.gnu.org> (Richard M. Stallman's message of "Mon, 13 Feb 2006 19:41:00 -0500")
"Richard M. Stallman" <rms@gnu.org> writes:
> We decided to change how load-suffixes would work,
> but it looks like that change has not been installed.
Since this issue seems to have gotten stalled, I looked into it. How
about the following patch?
*** emacs/src/lread.c.~1.349.~ 2006-02-18 18:19:03.000000000 -0500
--- emacs/src/lread.c 2006-02-19 00:13:13.000000000 -0500
***************
*** 99,104 ****
--- 99,105 ----
/* Search path and suffixes for files to be loaded. */
Lisp_Object Vload_path, Vload_suffixes, default_suffixes;
+ Lisp_Object Vload_file_rep_suffixes;
/* File name of user's init file. */
Lisp_Object Vuser_init_file;
***************
*** 727,732 ****
--- 728,734 ----
if (SCHARS (file) > 0)
{
int size = SBYTES (file);
+ Lisp_Object tail, stail, reps, rep, suffixes, all_suffixes;
Lisp_Object tmp[2];
found = Qnil;
***************
*** 747,759 ****
must_suffix = Qnil;
}
! fd = openp (Vload_path, file,
! (!NILP (nosuffix) ? Qnil
! : !NILP (must_suffix) ? Vload_suffixes
! : Fappend (2, (tmp[0] = Vload_suffixes,
! tmp[1] = default_suffixes,
! tmp))),
! &found, Qnil);
UNGCPRO;
}
--- 749,779 ----
must_suffix = Qnil;
}
! all_suffixes = suffixes = (!NILP (nosuffix) ? default_suffixes
! : !NILP (must_suffix) ? Vload_suffixes
! : Fappend (2, (tmp[0] = Vload_suffixes,
! tmp[1] = default_suffixes,
! tmp)));
!
! for (tail = Vload_file_rep_suffixes; CONSP (tail); tail = XCDR (tail))
! {
! rep = XCAR (tail);
!
! if (!GC_STRINGP (rep))
! continue;
!
! reps = Fcopy_sequence (suffixes);
! for (stail = reps; CONSP (stail); stail = XCDR (stail))
! if (GC_STRINGP (XCAR (stail)))
! XSETCAR (stail, Fconcat (2, (tmp[0] = XCAR (stail),
! tmp[1] = rep, tmp)));
!
! all_suffixes = Fappend (2, (tmp[0] = all_suffixes,
! tmp[1] = reps, tmp));
! }
!
! fd = openp (Vload_path, file, all_suffixes, &found, Qnil);
!
UNGCPRO;
}
***************
*** 3909,3914 ****
--- 3929,3944 ----
default_suffixes = Fcons (build_string (""), Qnil);
staticpro (&default_suffixes);
+ DEFVAR_LISP ("load-file-rep-suffixes", &Vload_file_rep_suffixes,
+ doc: /* List of additional suffixes to try for files to load.
+ These suffixes stand for different ways of representing the same file.
+
+ For example, if `load-suffixes' is '(\".elc\" \".el\") and
+ `load-file-rep-suffixes' is '(\"gz\"), then (load \"foo\") will look
+ for \"foo.elc\", \"foo.el\", \"foo\", \"foo.elc.gz\", \"foo.el.gz\",
+ and \"foo.gz\", in that order. */);
+ Vload_file_rep_suffixes = Qnil;
+
DEFVAR_BOOL ("load-in-progress", &load_in_progress,
doc: /* Non-nil iff inside of `load'. */);
*** emacs/lisp/jka-cmpr-hook.el.~1.9.~ 2006-02-06 23:43:16.000000000 -0500
--- emacs/lisp/jka-cmpr-hook.el 2006-02-18 23:46:23.000000000 -0500
***************
*** 216,229 ****
(append auto-mode-alist jka-compr-mode-alist-additions))
;; 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 ()
--- 216,223 ----
(append auto-mode-alist jka-compr-mode-alist-additions))
;; Make sure that (load "foo") will find /bla/foo.el.gz.
! (setq load-file-rep-suffixes
! (append jka-compr-load-suffixes load-file-rep-suffixes)))
(defun jka-compr-installed-p ()
*** emacs/lisp/jka-compr.el.~1.89.~ 2006-02-06 23:43:16.000000000 -0500
--- emacs/lisp/jka-compr.el 2006-02-18 23:47:57.000000000 -0500
***************
*** 703,712 ****
;; Remove the suffixes that were added by jka-compr.
(let ((suffixes nil)
(re (jka-compr-build-file-regexp)))
! (dolist (suffix load-suffixes)
(unless (string-match re suffix)
(push suffix suffixes)))
! (setq load-suffixes (nreverse suffixes))))
(provide 'jka-compr)
--- 703,712 ----
;; Remove the suffixes that were added by jka-compr.
(let ((suffixes nil)
(re (jka-compr-build-file-regexp)))
! (dolist (suffix load-file-rep-suffixes)
(unless (string-match re suffix)
(push suffix suffixes)))
! (setq load-file-rep-suffixes (nreverse suffixes))))
(provide 'jka-compr)
next prev parent reply other threads:[~2006-02-19 5:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-14 0:41 Changing load-suffixes Richard M. Stallman
2006-02-14 1:13 ` Luc Teirlinck
2006-02-19 5:21 ` Chong Yidong [this message]
2006-02-19 15:59 ` Luc Teirlinck
2006-02-19 16:33 ` Chong Yidong
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=87bqx3hqjq.fsf@stupidchicken.com \
--to=cyd@stupidchicken.com \
--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.