emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing a cl-defstruct definition in a published package


From: Clément Pit-Claudel
Subject: Re: Changing a cl-defstruct definition in a published package
Date: Mon, 30 Jul 2018 17:52:58 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 2018-07-15 21:51, Stefan Monnier wrote:
> I don't think so, no (by the time we're compiling the file, the package
> is already installed and activated).

Great, thanks :)

I've made a bit of progress on this.  It's indeed fairly easy to force 
recompilation of all packages that Flycheck depends on:

(let ((dependencies nil))
  (dolist (name-descs package-alist)
    (let ((reqs (package-desc-reqs (cadr name-descs))))
      (when (assq 'flycheck reqs)
        (push desc dependencies))))
  (message "Flycheck: forcing recompilation of the following packages: %s"
           (mapconcat (lambda (d) (symbol-name (package-desc-name d)))
                      dependencies ", "))
  (dolist (desc (nreverse dependencies))
    ;; The following fragment was taken from `package-unpack':
    ;; -------------------------------------------------------
    ;; Activation has to be done before compilation, so that if we're
    ;; upgrading and macros have changed we load the new definitions
    ;; before compiling.
    (when (package-activate-1 desc :reload :deps)
      ;; FIXME: Compilation should be done as a separate, optional, step.
      ;; E.g. for multi-package installs, we should first install all packages
      ;; and then compile them.
      (package--compile desc)
      ;; After compilation, load again any files loaded by
      ;; `activate-1', so that we use the byte-compiled definitions.
      (package--load-files-for-activation desc :reload))))

I'm now looking for a way to make sure this only happens once — that is, that 
not all future Flycheck updates cause the recompilation, only the first one 
introducing the breaking change.

Is there a way to know during byte-compilation which version of the package was 
previously installed?

Thanks!
Clément.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]