straight.el icon indicating copy to clipboard operation
straight.el copied to clipboard

[BUG] Straight should not conclude these two version strings indicate a different Emacs Version.

Open jasonm23 opened this issue 3 years ago • 3 comments

What's wrong

Straight is checking (emacs-version) and using it, without sanitizing, to determine the need to build again.

For example:

(emacs-version)

=> "GNU Emacs 28.1 (build 1, x86_64-apple-darwin20.6.0, Carbon Version 164 AppKit 2202.7)
 of 2022-08-02"

Which is effectively the same as a build done the next day with the same code.

(emacs-version)

=> "GNU Emacs 28.1 (build 1, x86_64-apple-darwin20.6.0, Carbon Version 164 AppKit 2202.7)
 of 2022-08-03"

A sanitized version check could avoid unnecessary errors, for example:

;; draft implementation
(defun straight-emacs-version () 
  "Emacs version sanitized."
  (let ((version-string (emacs-version)))
     (replace-regexp-in-string "^\\(.*\\)\n.*" "\\1" version-string)  

jasonm23 avatar Sep 04 '22 07:09 jasonm23

Agreed. Even better would probably be to use the emacs-version variable.

progfolio avatar Sep 04 '22 07:09 progfolio

What's worse is that a lot of functionality that shouldn't be blocked by this, e.g. (describe-function straight-use-package) ... is. It's infuriating, given the total build time to "fix" it.

jasonm23 avatar Sep 04 '22 07:09 jasonm23

Although a quick way to fix it is just to (byte-compile-file "~/.emacs.d/.local/straight/build-nn.n/straight/straight.el")

I'm referring to the Doom Emacs "kill .local & doom sync" style fix.

jasonm23 avatar Sep 04 '22 07:09 jasonm23