GNU bug report logs -
#77468
30.1.50; package-quickstart file is not relocatable
Previous Next
Reported by: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Wed, 2 Apr 2025 18:47:01 UTC
Severity: normal
Found in version 30.1.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> Makes sense. How about this?
See comments below.
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index b9a8dacab15..1269a9c95e7 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -4591,6 +4591,14 @@ package--quickstart-maybe-refresh
> (delete-file (concat package-quickstart-file "c"))
> (delete-file package-quickstart-file)))
>
> +(defun package--quickstart-relative (load-name file)
> + "Return an expression which evaluates to FILE while loading LOAD-NAME."
> + (let* ((dir (file-name-directory (expand-file-name load-name)))
> + (relname (file-relative-name file dir)))
> + (if (string-prefix-p ".." relname)
> + file
> + `(file-name-concat (file-name-directory load-file-name) ,relname))))
I think I'd test "../" just in case of dirnames that start with "..".
Also, could we compute (file-name-directory load-file-name)
once at the beginning of the quickstart file instead of once per
inlined file?
> (defun package-quickstart-refresh ()
> "(Re)Generate the `package-quickstart-file'."
> (interactive)
> @@ -4605,7 +4613,8 @@ package-quickstart-refresh
> ;; aren't truncated.
> (print-length nil)
> (print-level nil)
> - (Info-directory-list '("")))
> + (Info-directory-list '(""))
> + (qs-dir (file-name-directory (expand-file-name package-quickstart-file))))
AFAICT `qs-dir` is not used.
> @@ -4622,7 +4631,7 @@ package-quickstart-refresh
> ;; Prefer uncompiled files (and don't accept .so files).
> (let ((load-suffixes '(".el" ".elc")))
> (locate-library (package--autoloads-file-name pkg))))
> - (pfile (prin1-to-string file)))
> + (pfile (prin1-to-string (package--quickstart-relative package-quickstart-file file))))
> (insert "(let* ((load-file-name " pfile ")\
> \(load-true-file-name load-file-name))\n")
> (insert-file-contents file)
I think this needs wrapping to fit within 80 columns.
> @@ -4638,7 +4647,10 @@ package-quickstart-refresh
> (append ',(mapcar #'package-desc-name package--quickstart-pkgs)
> package-activated-list)))
> (current-buffer))
> - (let ((info-dirs (butlast Info-directory-list)))
> + (let ((info-dirs
> + (mapcar (lambda (info-dir)
> + (package--quickstart-relative package-quickstart-file info-dir))
> + (butlast Info-directory-list))))
> (when info-dirs
> (pp `(progn (require 'info)
> (info-initialize)
I think this won't work because the rest of the code does:
(setq Info-directory-list
(append ',info-dirs Info-directory-list)))
so the `file-name-concat`s won't be evaluated.
Stefan
This bug report was last modified 101 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.