Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem emulating load with eval #53

Open
alastairdb opened this issue Apr 18, 2018 · 8 comments
Open

Problem emulating load with eval #53

alastairdb opened this issue Apr 18, 2018 · 8 comments

Comments

@alastairdb
Copy link

It seems commit 81f5f4d changed esup-child.el to use advice on the load function. The advised function then steps through the code one sexp at at time doing an eval. This causes problems with the files automatically generated by package-install, which all contain lines such as:

(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))

The #$ construct is handled by load, but generates an error with eval.

On a related note, since my esup only works when esup-child-max-depth is 0, how does one set this variable?

@colinxy
Copy link

colinxy commented Apr 26, 2018

Having the same problem here. More specifically, it always fails with the following error:

  ERROR(profile-sexp) at /home/colinxy/.emacs.d/elpa/yasnippet-20180412.1548/yasnippet-autoloads.el:4 with sexp (add-to-list (quote load-path) (directory-file-name (or (file-name-directory nil) (car load-path)))): error=(wrong-type-argument stringp nil)

Results will be incomplete due to errors.

jschaf added a commit that referenced this issue May 6, 2018
@jschaf
Copy link
Owner

jschaf commented May 6, 2018

Oh, I didn't realize load had special variables.

I added the customize variable esup-depth for controlling the depth. So, set esup-depth via customize or setq and it will get passed to esup-child.

@jschaf
Copy link
Owner

jschaf commented May 7, 2018

There's a couple ways to handle this:

  1. Don't intercept any load calls. That feels like throwing the baby out with the bathwater.
  2. Don't intercept files that end in -autoloads.el.
  3. Use a customized read-function that sets #$ to the current file name.

@raxod502
Copy link
Contributor

Just dynamically bind load-file-name to the appropriate value. That will cause read to expand #$ correctly. I had to do this for straight.el to correctly read autoloads files that used #$, for example.

@etu
Copy link

etu commented Aug 20, 2018

Getting exactly this same error just by initializing package.el:

  ERROR(profile-sexp) at /nix/store/xklyvs4b31dl37pyfyjbvri69wckgmmr-emacs-packages-deps/share/emacs/site-lisp/elpa/memoize-20180614.1230/memoize-autoloads.el:5 with sexp (add-to-list (quote load-path) (directory-file-name (or (file-name-directory nil) (car load-path)))): error=(wrong-type-argument stringp nil)

Would be nice is a fix was made so esup can be used with package.el at all 😄

@bymoz089
Copy link

Please fix it! This bug makes esup completely incompatible with package.el!

A crappy workaround this bug:

  1. write a shell skript /tmp/sed.sh:
#/bin/bash
 FILE="$PWD/$1"
 sed -i.bak -e "s|^\(.*\)#\$\(.*\)$|;;\1#$\2\n\1\"$FILE\"\2|" "$1"
  1. then cd to the ~/.emacs/elpa directory
  2. then call this script with find:
find . -iname "*-autoloads.el" -exec /tmp/sed.sh {} \;

@kiennq
Copy link

kiennq commented Oct 16, 2020

Ping, is there workaround for this that I can set in init.el?

@undefinedDarkness
Copy link

Any luck with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants