jimeh / build-emacs-for-macos

Somewhat hacky script to automate building of Emac.app on macOS.
484 stars 50 forks source link

Zero byte sized *.eln files #3

Closed jimeh closed 3 years ago

jimeh commented 4 years ago

Sometimes when quitting Emacs while native compilation is running, it will leave one or more *.eln files behind with a size of zero bytes. These files will prevent Emacs from launching until they're deleted either manually, or via the suggested configuration snippet above in the Configuration section.

Currently I work around this issue by finding and deleting any *.eln files in my eln-cache directory at startup, along with also setting a custom eln-cache directory:

(when (boundp 'comp-eln-load-path)
  (let ((eln-cache-dir (expand-file-name "cache/eln-cache/"
                                         user-emacs-directory))
        (find-exec (executable-find "find")))
    (setcar comp-eln-load-path eln-cache-dir)
    ;; Quitting emacs while native compilation in progress can leave zero byte
    ;; sized *.eln files behind. Hence delete such files during startup.
    (when find-exec
      (call-process find-exec nil nil nil eln-cache-dir
                    "-name" "*.eln" "-size" "0" "-delete" "-or"
                    "-name" "*.eln.tmp" "-size" "0" "-delete"))))
jimeh commented 4 years ago

Recent builds seem to create zero-sized *.eln.tmp files instead of *.eln files, meaning their existence do no prevent Emacs from starting. But they can still get left behind in some situations, so I've updated the config snippet to trash both *.eln and *.eln.tmp files with a size of zero bytes.

jimeh commented 3 years ago

I believe that this is not really an issue at all anymore, so I'm closing this issue.