Stefan Monnier writes: >> (loaddefs-generate >> - pkg-dir output-file >> - nil >> - "(add-to-list 'load-path (directory-file-name >> - (or (file-name-directory #$) (car load-path))))") >> + (file-name-concat pkg-dir lisp-dir) >> + output-file nil >> + (prin1-to-string >> + `(add-to-list 'load-path >> + (directory-file-name >> + ,(file-name-concat pkg-dir lisp-dir))))) >> (let ((buf (find-buffer-visiting output-file))) >> (when buf (kill-buffer buf))) >> auto-name)) >> --8<---------------cut here---------------end--------------->8--- >> >> Git tells me that Lars was wrote the "(or (file-name-directory #$) (car >> load-path))" bit, so I've added him to the CC's: Can you explain what >> the intention was here, and if my suggested replacement would break >> anything? > > I suspect he just copy/pasted the code from elsewhere. > The point is to make the file work regardless of where it is whereas > your replacement makes it work only in the location we used to > generate it. I see, that makes sense. > You can/should replace #$ with `load-file-name`, which will make it > behave better w.r.t byte-compilation. I suspected so much from lread.c, but wanted to make sure. So in that case the following should suffice: