On 2016-05-29 11:01, Stefan Monnier wrote: >> The docs of load-file-name don't say what this variable becomes when outside >> of load. It is always nil when load-in-progress is nil? > > I believe so, yes. > >>> And why do you need to fallback on byte-compile-current-file or >>> buffer-file-name? >> I'd like this code to work when the form is evaluated with C-M-x in an Emacs >> buffer. Since this isn't in an eval-when-compile form, though, I guess it >> would work to remove the byte-compile-current-file part. > > For C-M-x I guess you do need buffer-file-name. For M-x eval-buffer > you could use > > ;;;###autoload (defconst realgud-subdir-autoloads-name "subdirectory-autoloads.el") > ;;;###autoload (defconst realgud-content-dir) > ;;;###autoload (file-name-directory load-file-name)) > ;;;###autoload (with-demoted-errors "Error loading autoloads: %s" > ;;;###autoload (load (expand-file-name realgud-subdir-autoloads-name realgud-content-dir) t t)) Got it, thanks!