5

I see that a few packages, and package.el use (file-name-directory #$). How does Emacs know what directory #$ is? On OSX, that returns Wrong type argument: stringp, nil.

Excerpt from cl-lib.el when installing a package evil-mc through the package manager, which goes into cl-lib-autoloads.el and then Emacs chokes:

;; First line of defense: try to make sure the built-in cl-lib comes earlier in
;; load-path so we never get loaded:
;;;###autoload (let ((d (file-name-directory #$)))
;;;###autoload   (when (member d load-path)
;;;###autoload     (setq load-path (append (remove d load-path) (list d)))))
  • 1
    Can you show an example of its use? – Drew Jun 26 '17 at 3:46
  • @Drew -- Thanks, I updated the question with a specific example. As to package-autoload-ensure-default-file, I added (or (and #$ (file-name-directory #$)) ...) to avoid an error. But, I have no control over fixing the entry in cl-lib.el that the package manager is installing . . . . – lawlist Jun 26 '17 at 3:52
  • I also get Lisp error: (wrong-type-argument stringp nil) file-name-directory(nil) on macOS from (file-name-directory #$), but only when using --debug-init. This is with the emacs-mac port. – sandinmyjoints Oct 24 at 14:14
  • I find that I typically get this error after updating packages, and I can fix it by deleting all elc files (then recompiling them). – sandinmyjoints Nov 14 at 15:56
7

M-x elisp-index-search RET #$ RET tells us:

   Internally, the dynamic loading of documentation strings is
accomplished by writing compiled files with a special Lisp reader
construct, ‘#@COUNT’.  This construct skips the next COUNT characters.
It also uses the ‘#$’ construct, which stands for the name of this file,
as a string.  Do not use these constructs in Lisp source files; they are
not designed to be clear to humans reading the file.

C-hig (elisp)Docs and Compilation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.