How to refer to the file currently being loaded in Emacs Lisp?

前端 未结 1 762
别那么骄傲
别那么骄傲 2020-12-16 11:36

I am looking to include a reference to a non-elisp file (a small Python program), and would like to be able to say \"it is in the same directory as the current file, but wit

相关标签:
1条回答
  • 2020-12-16 12:33

    M-x describe-variable load-file-name

    load-file-name is a variable defined in `C source code'.
    
    Documentation:
    Full name of file being loaded by `load'.
    

    You might also be interested in the symbol-file function, which will tell you the absolute filename in which a specified function or variable was defined.

    If you want to get fancy, you can check the load-in-progress variable. If that's nil, then no load is in progress (and you're presumably being eval'd in a buffer). In that case, you could try (buffer-file-name) to get the filename.

    0 讨论(0)
提交回复
热议问题