esup icon indicating copy to clipboard operation
esup copied to clipboard

Problem emulating load with eval

Open alastairdb opened this issue 6 years ago • 8 comments

It seems commit 81f5f4da26b2b9e8c4ce9cc0272c3fb7ea4dbf3e 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?

alastairdb avatar Apr 18 '18 17:04 alastairdb

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.

colinxy avatar Apr 26 '18 00:04 colinxy

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 avatar May 06 '18 23:05 jschaf

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.

jschaf avatar May 07 '18 00:05 jschaf

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.

raxod502 avatar Jul 14 '18 22:07 raxod502

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 :smile:

etu avatar Aug 20 '18 11:08 etu

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 {} \;

bymoz089 avatar Mar 23 '19 20:03 bymoz089

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

kiennq avatar Oct 16 '20 02:10 kiennq

Any luck with this?

undefinedDarkness avatar Jun 10 '21 08:06 undefinedDarkness