Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newer version of map library is required for pcase expansion #70

Open
rmolinari opened this issue Jul 22, 2021 · 40 comments
Open

Newer version of map library is required for pcase expansion #70

rmolinari opened this issue Jul 22, 2021 · 40 comments
Assignees
Labels
bug Something isn't working compatibility

Comments

@rmolinari
Copy link

rmolinari commented Jul 22, 2021

I installed bufler and I saw the given message out of the box when I run M-x bufler. What am I doing wrong?

(Edit: the message - no longer in the subject - was "Symbol's value as variable is void: max-width")

I use straight and use-package. The bufler config is just

(use-package bufler
  :bind (("C-x C-b" . bufler)))

I see the same behavior when starting in a clean emacs:

  • $ emacs -Q
  • M-x load-file RET ~/.emacs.d/straight/repos/straight.el/bootstrap.el RET
  • M-x straight-use-package RET bufler RET
  • M-x bufler

I appear to have the latest version (from the repo that straight downloads):

17:21:54 $ git describe
0.2-50-g3017104

Here is the backtrace that I see:

Debugger entered--Lisp error: (void-variable max-width)
  (cons max-width (cons max-width-docstring '(:type '(choice (integer :tag "Maximum width") (const :tag "Unlimited width" nil)))))
  (cons max-width-variable (cons max-width (cons max-width-docstring '(:type '(choice (integer :tag "Maximum width") (const :tag "Unlimited width" nil))))))
  (cons 'defcustom (cons max-width-variable (cons max-width (cons max-width-docstring '(:type '(choice ... ...))))))
  (progn (cons 'defcustom (cons max-width-variable (cons max-width (cons max-width-docstring '(:type '...))))))
  (if (plist-member plist :max-width) (progn (cons 'defcustom (cons max-width-variable (cons max-width (cons max-width-docstring '(:type ...)))))))
  (list 'progn (if (plist-member plist :max-width) (progn (cons 'defcustom (cons max-width-variable (cons max-width (cons max-width-docstring '...)))))) (list 'defun fn-name '(buffer depth) (cons 'if-let (cons (list (list 'string (cons 'progn body))) (cons (cons 'progn (cons (if max-width ...) (cons ... ...))) '(""))))) (list 'setf (list 'map-elt 'bufler-column-format-fns name) (list 'function fn-name)))
  (let* ((max-width-variable (intern (concat "bufler-column-" name "-max-width"))) (max-width-docstring (format "Maximum width of the %s column." name))) (list 'progn (if (plist-member plist :max-width) (progn (cons 'defcustom (cons max-width-variable (cons max-width (cons max-width-docstring ...)))))) (list 'defun fn-name '(buffer depth) (cons 'if-let (cons (list (list 'string (cons ... body))) (cons (cons 'progn (cons ... ...)) '(""))))) (list 'setf (list 'map-elt 'bufler-column-format-fns name) (list 'function fn-name))))
  (progn (let* ((max-width-variable (intern (concat "bufler-column-" name "-max-width"))) (max-width-docstring (format "Maximum width of the %s column." name))) (list 'progn (if (plist-member plist :max-width) (progn (cons 'defcustom (cons max-width-variable (cons max-width ...))))) (list 'defun fn-name '(buffer depth) (cons 'if-let (cons (list (list ... ...)) (cons (cons ... ...) '...)))) (list 'setf (list 'map-elt 'bufler-column-format-fns name) (list 'function fn-name)))))
  (let* ((fn-name (intern (concat "bufler-column-format-" (downcase name)))) (x26 (map-elt plist ':face)) (x27 (map-elt plist ':max-width))) (progn (let* ((max-width-variable (intern (concat "bufler-column-" name "-max-width"))) (max-width-docstring (format "Maximum width of the %s column." name))) (list 'progn (if (plist-member plist :max-width) (progn (cons 'defcustom (cons max-width-variable ...)))) (list 'defun fn-name '(buffer depth) (cons 'if-let (cons (list ...) (cons ... ...)))) (list 'setf (list 'map-elt 'bufler-column-format-fns name) (list 'function fn-name))))))
  (closure (cl-struct-bufler-group-tags bufler-groups t) (name plist &rest body) "Define a column formatting function with NAME.\nNAM..." (progn (or (stringp name) (signal 'wrong-type-argument (list 'string name 'name))) nil) (let* ((fn-name (intern (concat "bufler-column-format-" (downcase name)))) (x26 (map-elt plist ':face)) (x27 (map-elt plist ':max-width))) (progn (let* ((max-width-variable (intern ...)) (max-width-docstring (format "Maximum width of the %s column." name))) (list 'progn (if (plist-member plist :max-width) (progn ...)) (list 'defun fn-name '... (cons ... ...)) (list 'setf (list ... ... name) (list ... fn-name)))))))("Name" (:max-width nil) (let ((indentation (make-string (* 2 depth) 32)) (mode-annotation (when (cl-loop for fn in bufler-buffer-mode-annotate-preds thereis (funcall fn buffer)) (propertize (concat (replace-regexp-in-string ... "" ... t t) " ") 'face 'bufler-mode))) (buffer-name (buffer-name buffer)) (modified (when (and (buffer-file-name buffer) (buffer-modified-p buffer)) (propertize bufler-column-name-modified-buffer-sigil 'face 'font-lock-warning-face)))) (concat indentation mode-annotation buffer-name modified)))
  (bufler-define-column "Name" (:max-width nil) (let ((indentation (make-string (* 2 depth) 32)) (mode-annotation (when (cl-loop for fn in bufler-buffer-mode-annotate-preds thereis (funcall fn buffer)) (propertize (concat (replace-regexp-in-string ... "" ... t t) " ") 'face 'bufler-mode))) (buffer-name (buffer-name buffer)) (modified (when (and (buffer-file-name buffer) (buffer-modified-p buffer)) (propertize bufler-column-name-modified-buffer-sigil 'face 'font-lock-warning-face)))) (concat indentation mode-annotation buffer-name modified)))
  eval-buffer(#<buffer  *load*> nil "/Users/rory/.emacs.d/straight/build/bufler/bufler...." nil t)  ; Reading at buffer position 35354
  load-with-code-conversion("/Users/rory/.emacs.d/straight/build/bufler/bufler...." "/Users/rory/.emacs.d/straight/build/bufler/bufler...." nil t)
  autoload-do-load((autoload "bufler" "Show Bufler's list.\nWith prefix argument ARG, forc..." t nil) bufler)
  command-execute(bufler record)
  execute-extended-command(nil "bufler" "bufler")
  funcall-interactively(execute-extended-command nil "bufler" "bufler")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)
@alphapapa
Copy link
Owner

What version of Emacs are you using, and what version of the map package do you have installed?

@rmolinari
Copy link
Author

rmolinari commented Jul 22, 2021

M-x emacs-version gives

  • GNU Emacs 27.2 (build 1, x86_64-apple-darwin19.6.0, Carbon Version 162 AppKit 1894.6) of 2021-03-27

The only map.el I can find is in my Emacs distribution's emacs-lisp directory. (Edit: this is also the file given by M-x locate-library RET map RET.) The first few lines are

;;; map.el --- Map manipulation functions  -*- lexical-binding: t; -*-

;; Copyright (C) 2015-2021 Free Software Foundation, Inc.

;; Author: Nicolas Petton <nicolas@petton.fr>
;; Keywords: convenience, map, hash-table, alist, array
;; Version: 2.0
;; Package-Requires: ((emacs "25"))
;; Package: map

@alphapapa
Copy link
Owner

alphapapa commented Jul 22, 2021

Thanks. Note that you can find the package's information with C-h P map RET.

Please try this:

  1. Install version 3.0 of map from GNU ELPA (you can use the clickable buttons in the describe-package buffer).
  2. M-x package-delete RET bufler RET.
  3. Restart Emacs.
  4. M-x package-install RET bufler RET.

I suspect that will work.

@rmolinari
Copy link
Author

Yes, this works. Thanks!

Using straight and use-package, I found I need to put (use-package map) very early in init.el. If I put it just before my bufler config then the built-in version of map.el appears to be used by the bufler code, presumably because some earlier part of my config loads it.

I've been using Emacs for 30 years but didn't know about describe-package! Though the command doesn't seem to know about packages installed by straight.

@alphapapa alphapapa reopened this Jul 22, 2021
@alphapapa alphapapa changed the title M-x bufler gives "cons: Symbol’s value as variable is void: max-width" Newer version of map library is required for pcase expansion Jul 22, 2021
@alphapapa alphapapa self-assigned this Jul 22, 2021
@alphapapa alphapapa added the bug Something isn't working label Jul 22, 2021
@alphapapa
Copy link
Owner

Thanks. I need to add map to the dependency header to cause a newer version to be installed.

@alphapapa
Copy link
Owner

@rmolinari If you have time, would you mind testing the fix I just pushed? i.e. install Bufler having only v2.0 of map installed. Straight should install v2.1 (or greater) of map automatically now.

@rmolinari
Copy link
Author

rmolinari commented Jul 22, 2021

Verdict: yes and no.

So, when I cleared out straight's installation of the bufler and map packages and started up Emacs again the dependency was correctly resolved. Straight installed v 3.0 of map as expected, and M-x locate-library shows the path to this version.

But I still saw the max-width error on M-x bufler. When the bufler macros are expanded the old version of map is active.

If I add an explicit (use-package map) early in my init.el, bufler works again.

I don't have a good mental model of how everything comes together, but this is my guess at the chain of events when things go wrong.

  1. As my init.el is loaded, the built-in version of map is loaded because it is required by another package. If I'm reading the value of load-history correctly it is required by the json package, which in turn is required by one of the packages I'm installing. At this point straight hasn't seen (use-package bufler) and so hasn't done anything related to map. In particular it hasn't added its version of map to my load-path.
  2. We reach my (use-package bufler) line. Now straight correctly determines that bufler depends on v2.1 of map and so installs the latest if necessary and adds it to the load path. But since map has already been loaded, (require 'map) doesn't do anything and bufler is stuck with the built-in version.
  3. Because of straight's modification of the load path, locate-library shows the path to the latest version of map, even though that's not the version that has been loaded.
  4. With an early, explicit (use-package map) the load path gets updated soon enough that the right version of map is loaded when first requested.

This isn't bufler's fault. It feels like straight's responsibility to notice, when it is handling bufler, that the wrong version of map is loaded and to reload the right one, but I don't know if that's a reasonable expectation. In fact, I'm surprised this sort of dependency doesn't trip people up more often, which makes me suspect that my understanding of the situation is wrong. And maybe this isn't the job of straight at all, but of use-package.

@alphapapa
Copy link
Owner

Thanks for that thorough investigation. I'm waiting on MELPA to rebuild the package, and then I'll try installing it in a clean config with package-install again.

In the meantime, since I don't use Straight, I can't offer much help. But Straight is very carefully developed, and I'm sure this kind of issue has come up before, so I'd be surprised if it hasn't been discussed on their tracker before.

use-package is just a macro that expands to, e.g. require or with-eval-after-load. It doesn't install any packages itself; it just delegates to package (or Quelpa or Straight, if their use-package integration is being used).

The bottom line is that it's probably a load-path issue, but how to solve it in your case, I don't know. Maybe something's not configured quite right somewhere.

Until I can confirm that this is fixed (i.e. that it installs properly into a clean Emacs config), I'll leave this open.

@alphapapa alphapapa reopened this Jul 22, 2021
@alphapapa
Copy link
Owner

Also, another aspect of this issue is that of byte-compilation: when package installs a package, it byte-compiles it, which involves expanding the macros (in this case, pcase with its extension by map). If a too-old version of map is loaded when bufler is installed and byte-compiled, the macros won't expand properly. If you then load the newer version of map and then load bufler, I guess that the non-compiled form is loaded (i.e. bufler.el rather than bufler.elc), which means, AFAIK, expanding the macros every time functions are called. Performance will be quite poor in that case. So it's important that the newer version of map is loaded when Bufler is installed so byte-compilation will work and the byte-compiled form will be loaded later.

@rmolinari
Copy link
Author

Thanks for your quick responses! I will study your notes on byte compilation and make sure I understand them.

For what it's worth I did another experiment. I deleted the directories for bufler and map under ~/.emacs.d/straight/repos and ~/.emacs.d/straight/build. Then

  • $ emacs -Q
  • (load-file "~/.emacs.d/straight/repos/straight.el/bootstrap.el")
  • (straight-use-package 'bufler)
  • M-x bufler RET

I see that straight clones both bufler and map and the bufler command works fine.

BUT, if, before executing (straight-use-package 'bufler) I do (require 'json) then M-x bufler fails.

I'll have a look through straight's issues and see if there has been chatter about built-in packages and this sort of versioning.

@alphapapa
Copy link
Owner

alphapapa commented Jul 22, 2021

Thanks. Yeah, ideally the newer version of map would be loaded after it's installed. package doesn't do that by default. I would hope that alternatives like Straight would, but I don't know if that's implemented.

This kind of issue, failed macro expansions due to dependency versions, is reported on my repos often. AFAIK it's simply a shortcoming of the packaging systems, and it's just something that users need to be aware of; usually deleting the packages, restarting Emacs, and reinstalling them fixes it. However, sometimes issue can arise due to how package loads packages during compilation, especially if done in the same Emacs process rather than an async one. (That is another factor to consider: do you use async package installation? Does Straight support that?)

I wrote this function to reload a package's symbols. It may not necessarily work in all cases, because unload-feature isn't guaranteed to work in all cases, but it's helpful to me: https://github.com/alphapapa/unpackaged.el#reload-a-packages-features

@rmolinari
Copy link
Author

I just filed a ticket against straight: radian-software/straight.el#822.

@progfolio
Copy link

I would hope that alternatives like Straight would, but I don't know if that's implemented.

Not currently implemented.

... async package installation? Does Straight support that?

Packages are built in a child Emacs process which loads the package dependencies.

@alphapapa
Copy link
Owner

@rmolinari Thanks.

@progfolio Thanks, hopefully a solution can be found. Ideally it would also be fixed in package, because I think this can affect users of it as well.

@iffsid
Copy link

iffsid commented Aug 27, 2021

I too have the same problem, but I don't use straight.el, just vanilla emacs.
M-x emacs-version RET gives me

GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, cairo version 1.16.0) of 2021-08-11

I've tested it with as minimal a setup as possible, but the package still fails to compile
Here's my super minimal .emacs

(require 'map)
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(package-initialize)

After emacs starts up with the above config, I run M-x locate-library RET map RET and it returns

Library is file ~/.emacs.d/elpa/map-3.1/map.elc

It looks like it's picking up the correct package for map but when I try to install bufler by issuing M-x package-install RET bufler RET I get the following errors in the compile log

^L
Compiling file ~/.emacs.d/elpa/bufler-20210722.1703/bufler-group-tree.el at Fri Aug 27 22:28:17 2021
Entering directory ‘~/.emacs.d/elpa/bufler-20210722.1703/’
^L
Compiling file ~/.emacs.d/elpa/bufler-20210722.1703/bufler-workspace-tabs.el at Fri Aug 27 22:28:17 2021
bufler-workspace-tabs.el:70:34:Error: Symbol’s value as variable is void: max-width
^L
Compiling file ~/.emacs.d/elpa/bufler-20210722.1703/bufler-workspace.el at Fri Aug 27 22:28:17 2021
bufler-workspace.el:31:1:Error: Symbol’s value as variable is void: max-width
^L
Compiling file ~/.emacs.d/elpa/bufler-20210722.1703/bufler.el at Fri Aug 27 22:28:17 2021

In bufler-define-column:
bufler.el:743:15:Warning: reference to free variable ‘max-width’
bufler.el:753:23:Warning: reference to free variable ‘face’
bufler.el:762:1:Error: Symbol’s value as variable is void: max-width

I've double checked that the .emacs.elc file is up to date, and also emptied custom.el to make sure nothing else could interfere with things.

@alphapapa
Copy link
Owner

@iffsid I have repeatedly installed this package into a clean Emacs config to verify that it works. And I just did it again now:

$ emacs-sandbox.sh -i bufler
...
For information about GNU Emacs and the GNU system, type C-h C-a.
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443
Contacting host: melpa.org:443 [2 times]
Contacting host: orgmode.org:443
Package refresh done
(New file)
Saving file /tmp/tmp.Kj6mmebiCX/init.el...
Wrote /tmp/tmp.Kj6mmebiCX/init.el [2 times]
Saving file /tmp/tmp.Kj6mmebiCX/init.el...
Wrote /tmp/tmp.Kj6mmebiCX/init.el [2 times]
Parsing tar file...done
Extracting map-3.1/
Extracting map-3.1/map-pkg.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/map-3.1/map-pkg.el
Extracting map-3.1/map.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/map-3.1/map.el
Generating autoloads for map-pkg.el...done
Generating autoloads for map.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/map-3.1/map-autoloads.el [2 times]
Checking /tmp/tmp.Kj6mmebiCX/elpa/map-3.1... [3 times]
Compiling /tmp/tmp.Kj6mmebiCX/elpa/map-3.1/map.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/map-3.1/map.elc
Checking /tmp/tmp.Kj6mmebiCX/elpa/map-3.1...
Done (Total of 1 file compiled, 2 skipped)
Contacting host: melpa.org:443
Parsing tar file...done
Extracting dash-20210826.1149/
Extracting dash-20210826.1149/dash.info
Wrote /tmp/tmp.Kj6mmebiCX/elpa/dash-20210826.1149/dash.info
Extracting dash-20210826.1149/dash.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/dash-20210826.1149/dash.el
Extracting dash-20210826.1149/dir
Wrote /tmp/tmp.Kj6mmebiCX/elpa/dash-20210826.1149/dir
Extracting dash-20210826.1149/dash-pkg.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/dash-20210826.1149/dash-pkg.el
Generating autoloads for dash-pkg.el...done
Generating autoloads for dash.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/dash-20210826.1149/dash-autoloads.el [2 times]
Checking /tmp/tmp.Kj6mmebiCX/elpa/dash-20210826.1149... [3 times]
Compiling /tmp/tmp.Kj6mmebiCX/elpa/dash-20210826.1149/dash.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/dash-20210826.1149/dash.elc
Checking /tmp/tmp.Kj6mmebiCX/elpa/dash-20210826.1149...
Done (Total of 1 file compiled, 2 skipped)
Contacting host: melpa.org:443
Parsing tar file...done
Extracting magit-section-20210819.1119/
Extracting magit-section-20210819.1119/magit-section.info
Wrote /tmp/tmp.Kj6mmebiCX/elpa/magit-section-20210819.1119/magit-section.info
Extracting magit-section-20210819.1119/magit-section.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/magit-section-20210819.1119/magit-section.el
Extracting magit-section-20210819.1119/dir
Wrote /tmp/tmp.Kj6mmebiCX/elpa/magit-section-20210819.1119/dir
Extracting magit-section-20210819.1119/magit-section-pkg.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/magit-section-20210819.1119/magit-section-pkg.el
Generating autoloads for magit-section-pkg.el...done
Generating autoloads for magit-section.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/magit-section-20210819.1119/magit-section-autoloads.el [2 times]
Checking /tmp/tmp.Kj6mmebiCX/elpa/magit-section-20210819.1119... [3 times]
Compiling /tmp/tmp.Kj6mmebiCX/elpa/magit-section-20210819.1119/magit-section.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/magit-section-20210819.1119/magit-section.elc
Checking /tmp/tmp.Kj6mmebiCX/elpa/magit-section-20210819.1119...
Done (Total of 1 file compiled, 2 skipped)
Contacting host: melpa.org:443
Generating autoloads for s.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/s-20210616.619/s-autoloads.el [2 times]
Checking /tmp/tmp.Kj6mmebiCX/elpa/s-20210616.619... [3 times]
Compiling /tmp/tmp.Kj6mmebiCX/elpa/s-20210616.619/s.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/s-20210616.619/s.elc
Checking /tmp/tmp.Kj6mmebiCX/elpa/s-20210616.619...
Done (Total of 1 file compiled, 2 skipped)
Contacting host: melpa.org:443
Generating autoloads for lv.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/lv-20200507.1518/lv-autoloads.el [2 times]
Checking /tmp/tmp.Kj6mmebiCX/elpa/lv-20200507.1518... [3 times]
Compiling /tmp/tmp.Kj6mmebiCX/elpa/lv-20200507.1518/lv.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/lv-20200507.1518/lv.elc
Checking /tmp/tmp.Kj6mmebiCX/elpa/lv-20200507.1518...
Done (Total of 1 file compiled, 2 skipped)
Parsing tar file...done
Extracting hydra-20201115.1055/
Extracting hydra-20201115.1055/hydra-ox.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/hydra-20201115.1055/hydra-ox.el
Extracting hydra-20201115.1055/hydra-examples.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/hydra-20201115.1055/hydra-examples.el
Extracting hydra-20201115.1055/hydra.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/hydra-20201115.1055/hydra.el
Extracting hydra-20201115.1055/hydra-pkg.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/hydra-20201115.1055/hydra-pkg.el
Generating autoloads for hydra-examples.el...done
Generating autoloads for hydra-ox.el...done
Generating autoloads for hydra-pkg.el...done
Generating autoloads for hydra.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/hydra-20201115.1055/hydra-autoloads.el [2 times]
Checking /tmp/tmp.Kj6mmebiCX/elpa/hydra-20201115.1055... [3 times]
Compiling /tmp/tmp.Kj6mmebiCX/elpa/hydra-20201115.1055/hydra-ox.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/hydra-20201115.1055/hydra-ox.elc
Checking /tmp/tmp.Kj6mmebiCX/elpa/hydra-20201115.1055... [2 times]
Compiling /tmp/tmp.Kj6mmebiCX/elpa/hydra-20201115.1055/hydra.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/hydra-20201115.1055/hydra.elc
Checking /tmp/tmp.Kj6mmebiCX/elpa/hydra-20201115.1055...
Done (Total of 2 files compiled, 3 skipped)
Contacting host: melpa.org:443
Generating autoloads for pretty-hydra.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/pretty-hydra-20210221.834/pretty-hydra-autoloads.el [2 times]
Checking /tmp/tmp.Kj6mmebiCX/elpa/pretty-hydra-20210221.834... [3 times]
Compiling /tmp/tmp.Kj6mmebiCX/elpa/pretty-hydra-20210221.834/pretty-hydra.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/pretty-hydra-20210221.834/pretty-hydra.elc
Checking /tmp/tmp.Kj6mmebiCX/elpa/pretty-hydra-20210221.834...
Done (Total of 1 file compiled, 2 skipped)
Contacting host: melpa.org:443
Generating autoloads for f.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/f-20210624.1103/f-autoloads.el [2 times]
Checking /tmp/tmp.Kj6mmebiCX/elpa/f-20210624.1103... [3 times]
Compiling /tmp/tmp.Kj6mmebiCX/elpa/f-20210624.1103/f.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/f-20210624.1103/f.elc
Checking /tmp/tmp.Kj6mmebiCX/elpa/f-20210624.1103...
Done (Total of 1 file compiled, 2 skipped)
Parsing tar file...done
Extracting bufler-20210722.1703/
Extracting bufler-20210722.1703/bufler-group-tree.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler-group-tree.el
Extracting bufler-20210722.1703/bufler.info
Wrote /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler.info
Extracting bufler-20210722.1703/bufler-workspace-tabs.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler-workspace-tabs.el
Extracting bufler-20210722.1703/dir
Wrote /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/dir
Extracting bufler-20210722.1703/bufler.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler.el
Extracting bufler-20210722.1703/bufler-workspace.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler-workspace.el
Extracting bufler-20210722.1703/bufler-pkg.el
Wrote /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler-pkg.el
Generating autoloads for bufler-group-tree.el...done
Generating autoloads for bufler-pkg.el...done
Generating autoloads for bufler-workspace-tabs.el...done
Generating autoloads for bufler-workspace.el...done
Generating autoloads for bufler.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler-autoloads.el [2 times]
Checking /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703... [2 times]
Compiling /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler-group-tree.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler-group-tree.elc
Checking /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703... [2 times]
Compiling /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler-workspace-tabs.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler-workspace-tabs.elc
Checking /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703...
Compiling /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler-workspace.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler-workspace.elc
Checking /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703...
Compiling /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler.el...done
Wrote /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703/bufler.elc
Checking /tmp/tmp.Kj6mmebiCX/elpa/bufler-20210722.1703...
Done (Total of 4 files compiled, 2 skipped)
Loading /tmp/tmp.Kj6mmebiCX/init.el (source)...done

No warnings, no errors. I can't offer support for your Emacs configuration or installation problems here.

@iffsid
Copy link

iffsid commented Aug 28, 2021

@alphapapa thanks for checking; 👍

There seems to be some oddity to do with the emacs base install itself that's triggering an error.
I used your emacs-sandbox script to run the same test you ran.
It fails, but the log gives me a bit more info; indicates an eager macro-expansion failure 😕
Will try to debug this and report back if I find anything useful.

For information about GNU Emacs and the GNU system, type C-h C-a.
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443 [2 times]
Contacting host: melpa.org:443
Contacting host: orgmode.org:443
Package refresh done
(New file)
Saving file /tmp/tmp.r16iyFabMj/init.el...
Wrote /tmp/tmp.r16iyFabMj/init.el
Saving file /tmp/tmp.r16iyFabMj/init.el...
Wrote /tmp/tmp.r16iyFabMj/init.el
Contacting host: elpa.gnu.org:443 [2 times]
Parsing tar file...done
Extracting...done
  INFO     Scraping files for map-autoloads.el... 
Generating autoloads for map-pkg.el...done
Generating autoloads for map.el...done
  INFO     Scraping files for map-autoloads.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/map-3.1/map-autoloads.el [2 times]
Checking /tmp/tmp.r16iyFabMj/elpa/map-3.1... [3 times]
Compiling /tmp/tmp.r16iyFabMj/elpa/map-3.1/map.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/map-3.1/map.elc
Checking /tmp/tmp.r16iyFabMj/elpa/map-3.1...
Done (Total of 1 file compiled, 2 skipped)
Contacting host: melpa.org:443
Parsing tar file...done
Extracting...done
  INFO     Scraping files for dash-autoloads.el... 
Generating autoloads for dash-pkg.el...done
Generating autoloads for dash.el...done
  INFO     Scraping files for dash-autoloads.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/dash-20210826.1149/dash-autoloads.el [2 times]
Checking /tmp/tmp.r16iyFabMj/elpa/dash-20210826.1149... [3 times]
Compiling /tmp/tmp.r16iyFabMj/elpa/dash-20210826.1149/dash.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/dash-20210826.1149/dash.elc
Checking /tmp/tmp.r16iyFabMj/elpa/dash-20210826.1149...
Done (Total of 1 file compiled, 2 skipped)
Contacting host: melpa.org:443
Parsing tar file...done
Extracting...done
  INFO     Scraping files for magit-section-autoloads.el... 
Generating autoloads for magit-section-pkg.el...done
Generating autoloads for magit-section.el...done
  INFO     Scraping files for magit-section-autoloads.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/magit-section-20210819.1119/magit-section-autoloads.el [2 times]
Checking /tmp/tmp.r16iyFabMj/elpa/magit-section-20210819.1119... [3 times]
Compiling /tmp/tmp.r16iyFabMj/elpa/magit-section-20210819.1119/magit-section.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/magit-section-20210819.1119/magit-section.elc
Checking /tmp/tmp.r16iyFabMj/elpa/magit-section-20210819.1119...
Done (Total of 1 file compiled, 2 skipped)
  INFO     Scraping files for s-autoloads.el... 
Generating autoloads for s.el...done
  INFO     Scraping files for s-autoloads.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/s-20210616.619/s-autoloads.el [2 times]
Checking /tmp/tmp.r16iyFabMj/elpa/s-20210616.619... [3 times]
Compiling /tmp/tmp.r16iyFabMj/elpa/s-20210616.619/s.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/s-20210616.619/s.elc
Checking /tmp/tmp.r16iyFabMj/elpa/s-20210616.619...
Done (Total of 1 file compiled, 2 skipped)
Contacting host: melpa.org:443
  INFO     Scraping files for lv-autoloads.el... 
Generating autoloads for lv.el...done
  INFO     Scraping files for lv-autoloads.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/lv-20200507.1518/lv-autoloads.el [2 times]
Checking /tmp/tmp.r16iyFabMj/elpa/lv-20200507.1518... [3 times]
Compiling /tmp/tmp.r16iyFabMj/elpa/lv-20200507.1518/lv.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/lv-20200507.1518/lv.elc
Checking /tmp/tmp.r16iyFabMj/elpa/lv-20200507.1518...
Done (Total of 1 file compiled, 2 skipped)
Parsing tar file...done
Extracting...done
  INFO     Scraping files for hydra-autoloads.el... 
Generating autoloads for hydra-examples.el...done
Generating autoloads for hydra-ox.el...done
Generating autoloads for hydra-pkg.el...done
Generating autoloads for hydra.el...done
  INFO     Scraping files for hydra-autoloads.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/hydra-20201115.1055/hydra-autoloads.el [2 times]
Checking /tmp/tmp.r16iyFabMj/elpa/hydra-20201115.1055... [3 times]
Compiling /tmp/tmp.r16iyFabMj/elpa/hydra-20201115.1055/hydra-ox.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/hydra-20201115.1055/hydra-ox.elc
Checking /tmp/tmp.r16iyFabMj/elpa/hydra-20201115.1055... [2 times]
Compiling /tmp/tmp.r16iyFabMj/elpa/hydra-20201115.1055/hydra.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/hydra-20201115.1055/hydra.elc
Checking /tmp/tmp.r16iyFabMj/elpa/hydra-20201115.1055...
Done (Total of 2 files compiled, 3 skipped)
Contacting host: melpa.org:443
  INFO     Scraping files for pretty-hydra-autoloads.el... 
Generating autoloads for pretty-hydra.el...done
  INFO     Scraping files for pretty-hydra-autoloads.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/pretty-hydra-20210221.834/pretty-hydra-autoloads.el [2 times]
Checking /tmp/tmp.r16iyFabMj/elpa/pretty-hydra-20210221.834... [3 times]
Compiling /tmp/tmp.r16iyFabMj/elpa/pretty-hydra-20210221.834/pretty-hydra.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/pretty-hydra-20210221.834/pretty-hydra.elc
Checking /tmp/tmp.r16iyFabMj/elpa/pretty-hydra-20210221.834...
Done (Total of 1 file compiled, 2 skipped)
Contacting host: melpa.org:443
  INFO     Scraping files for f-autoloads.el... 
Generating autoloads for f.el...done
  INFO     Scraping files for f-autoloads.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/f-20210624.1103/f-autoloads.el [2 times]
Checking /tmp/tmp.r16iyFabMj/elpa/f-20210624.1103... [3 times]
Compiling /tmp/tmp.r16iyFabMj/elpa/f-20210624.1103/f.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/f-20210624.1103/f.elc
Checking /tmp/tmp.r16iyFabMj/elpa/f-20210624.1103...
Done (Total of 1 file compiled, 2 skipped)
Parsing tar file...done
Extracting...done
  INFO     Scraping files for bufler-autoloads.el... 
Generating autoloads for bufler-group-tree.el...done
Generating autoloads for bufler-pkg.el...done
Generating autoloads for bufler-workspace-tabs.el...done
Generating autoloads for bufler-workspace.el...done
Generating autoloads for bufler.el...done
  INFO     Scraping files for bufler-autoloads.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/bufler-20210722.1703/bufler-autoloads.el [2 times]
Checking /tmp/tmp.r16iyFabMj/elpa/bufler-20210722.1703... [2 times]
Compiling /tmp/tmp.r16iyFabMj/elpa/bufler-20210722.1703/bufler-group-tree.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/bufler-20210722.1703/bufler-group-tree.elc
Checking /tmp/tmp.r16iyFabMj/elpa/bufler-20210722.1703... [2 times]
Compiling /tmp/tmp.r16iyFabMj/elpa/bufler-20210722.1703/bufler-workspace-tabs.el...
Eager macro-expansion failure: (void-variable max-width) [2 times]
Checking /tmp/tmp.r16iyFabMj/elpa/bufler-20210722.1703...
Compiling /tmp/tmp.r16iyFabMj/elpa/bufler-20210722.1703/bufler-workspace.el...
Eager macro-expansion failure: (void-variable max-width) [2 times]
Checking /tmp/tmp.r16iyFabMj/elpa/bufler-20210722.1703...
Compiling /tmp/tmp.r16iyFabMj/elpa/bufler-20210722.1703/bufler.el... (bufler-define-column)
Checking /tmp/tmp.r16iyFabMj/elpa/bufler-20210722.1703...
Done (Total of 1 file compiled, 3 failed, 2 skipped)
Loading /tmp/tmp.r16iyFabMj/init.el (source)...done

@iffsid
Copy link

iffsid commented Aug 28, 2021

@alphapapa it looks like issue could be related to the emacs version!
I installed version 26.3 and your test script runs just fine.

@alphapapa
Copy link
Owner

alphapapa commented Aug 28, 2021

You can see here that map 3.1 gets installed:

Contacting host: elpa.gnu.org:443 [2 times]
Parsing tar file...done
Extracting...done
  INFO     Scraping files for map-autoloads.el... 
Generating autoloads for map-pkg.el...done
Generating autoloads for map.el...done
  INFO     Scraping files for map-autoloads.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/map-3.1/map-autoloads.el [2 times]
Checking /tmp/tmp.r16iyFabMj/elpa/map-3.1... [3 times]
Compiling /tmp/tmp.r16iyFabMj/elpa/map-3.1/map.el...done
Wrote /tmp/tmp.r16iyFabMj/elpa/map-3.1/map.elc
Checking /tmp/tmp.r16iyFabMj/elpa/map-3.1...
Done (Total of 1 file compiled, 2 skipped)

However, that does not mean that map 3.1 is loaded before bufler is installed. So you will probably need to upgrade map, then restart Emacs (or otherwise force the new version of map to be loaded), and then install bufler.

This is, AFAICT, not a bug in Bufler, but an idiosyncrasy of the Emacs package system (and of Lisp image-based systems in general). The package library ensures that the required package versions are installed, but it does not ensure that they are loaded before compiling the dependent package.

In general, if nothing else seems to work, even Emacs users should try "have you tried turning it off and on again?"

@iffsid
Copy link

iffsid commented Aug 28, 2021

Right, so I tried to sequence the install of map and bufler.

./emacs-sandbox.sh -d /tmp/test-bufler

Then, inside emacs, installed map-3.1.

Edited init.el to start with just the following

(require 'map)

Ensure that init.elc was byte-compiled from init.el

Then, I reran the sandbox script above, and
a. checked map version Library is file /tmp/test-bufler/elpa/map-3.1/map.elc
b. installed bufler
Get the same error with max-width

So I tried some high-level debugging and installed 4 different versions of emacs to try out your simple script

./emacs-sanbox.sh -i bufler
version status
26.3 rel 🆗
27.2 rel
27.2 vcs
28.0 vcs 🆗*

where rel is official release and vcs is HEAD on git for branch emacs-27 and master respectively.
It works for 26.3 but fails for both instances of 27.2.

For 28.0 it works, and the package seems to load and work when I invoke M-x bufler, but *Messages* has the following:

For information about GNU Emacs and the GNU system, type C-h C-a.
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:443 [2 times]
Contacting host: elpa.nongnu.org:443
Contacting host: melpa.org:443 [2 times]
Contacting host: orgmode.org:443
Package refresh done
(New file)
Saving file /tmp/tmp.HSfFaSyv56/init.el...
Wrote /tmp/tmp.HSfFaSyv56/init.el
Saving file /tmp/tmp.HSfFaSyv56/init.el...
Wrote /tmp/tmp.HSfFaSyv56/init.el
Contacting host: melpa.org:443
Parsing tar file...done
Extracting...done
  INFO     Scraping files for dash-autoloads.el... 
Generating autoloads for dash-pkg.el...done
Generating autoloads for dash.el...done
  INFO     Scraping files for dash-autoloads.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/dash-20210826.1149/dash-autoloads.el [2 times]
Checking /tmp/tmp.HSfFaSyv56/elpa/dash-20210826.1149... [3 times]
Compiling /tmp/tmp.HSfFaSyv56/elpa/dash-20210826.1149/dash.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/dash-20210826.1149/dash.elc
Checking /tmp/tmp.HSfFaSyv56/elpa/dash-20210826.1149...
Done (Total of 1 file compiled, 2 skipped)
Contacting host: melpa.org:443
Parsing tar file...done
Extracting...done
  INFO     Scraping files for magit-section-autoloads.el... 
Generating autoloads for magit-section-pkg.el...done
Generating autoloads for magit-section.el...done
  INFO     Scraping files for magit-section-autoloads.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/magit-section-20210819.1119/magit-section-autoloads.el [2 times]
Checking /tmp/tmp.HSfFaSyv56/elpa/magit-section-20210819.1119... [3 times]
Compiling /tmp/tmp.HSfFaSyv56/elpa/magit-section-20210819.1119/magit-section.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/magit-section-20210819.1119/magit-section.elc
Checking /tmp/tmp.HSfFaSyv56/elpa/magit-section-20210819.1119...
Done (Total of 1 file compiled, 2 skipped)
Contacting host: melpa.org:443
  INFO     Scraping files for s-autoloads.el... 
Generating autoloads for s.el...done
  INFO     Scraping files for s-autoloads.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/s-20210616.619/s-autoloads.el [2 times]
Checking /tmp/tmp.HSfFaSyv56/elpa/s-20210616.619... [3 times]
Compiling /tmp/tmp.HSfFaSyv56/elpa/s-20210616.619/s.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/s-20210616.619/s.elc
Checking /tmp/tmp.HSfFaSyv56/elpa/s-20210616.619...
Done (Total of 1 file compiled, 2 skipped)
Contacting host: melpa.org:443
  INFO     Scraping files for lv-autoloads.el... 
Generating autoloads for lv.el...done
  INFO     Scraping files for lv-autoloads.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/lv-20200507.1518/lv-autoloads.el [2 times]
Checking /tmp/tmp.HSfFaSyv56/elpa/lv-20200507.1518... [3 times]
Compiling /tmp/tmp.HSfFaSyv56/elpa/lv-20200507.1518/lv.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/lv-20200507.1518/lv.elc
Checking /tmp/tmp.HSfFaSyv56/elpa/lv-20200507.1518...
Done (Total of 1 file compiled, 2 skipped)
Contacting host: melpa.org:443
Parsing tar file...done
Extracting...done
  INFO     Scraping files for hydra-autoloads.el... 
Generating autoloads for hydra-examples.el...done
Generating autoloads for hydra-ox.el...done
Generating autoloads for hydra-pkg.el...done
Generating autoloads for hydra.el...done
  INFO     Scraping files for hydra-autoloads.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/hydra-20201115.1055/hydra-autoloads.el [2 times]
Checking /tmp/tmp.HSfFaSyv56/elpa/hydra-20201115.1055... [3 times]
Compiling /tmp/tmp.HSfFaSyv56/elpa/hydra-20201115.1055/hydra-ox.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/hydra-20201115.1055/hydra-ox.elc
Checking /tmp/tmp.HSfFaSyv56/elpa/hydra-20201115.1055... [2 times]
Compiling /tmp/tmp.HSfFaSyv56/elpa/hydra-20201115.1055/hydra.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/hydra-20201115.1055/hydra.elc
Checking /tmp/tmp.HSfFaSyv56/elpa/hydra-20201115.1055...
Done (Total of 2 files compiled, 3 skipped)
Contacting host: melpa.org:443
  INFO     Scraping files for pretty-hydra-autoloads.el... 
Generating autoloads for pretty-hydra.el...done
  INFO     Scraping files for pretty-hydra-autoloads.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/pretty-hydra-20210221.834/pretty-hydra-autoloads.el [2 times]
Checking /tmp/tmp.HSfFaSyv56/elpa/pretty-hydra-20210221.834... [3 times]
Compiling /tmp/tmp.HSfFaSyv56/elpa/pretty-hydra-20210221.834/pretty-hydra.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/pretty-hydra-20210221.834/pretty-hydra.elc
Checking /tmp/tmp.HSfFaSyv56/elpa/pretty-hydra-20210221.834...
Done (Total of 1 file compiled, 2 skipped)
  INFO     Scraping files for f-autoloads.el... 
Generating autoloads for f.el...done
  INFO     Scraping files for f-autoloads.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/f-20210624.1103/f-autoloads.el [2 times]
Checking /tmp/tmp.HSfFaSyv56/elpa/f-20210624.1103... [3 times]
Compiling /tmp/tmp.HSfFaSyv56/elpa/f-20210624.1103/f.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/f-20210624.1103/f.elc
Checking /tmp/tmp.HSfFaSyv56/elpa/f-20210624.1103...
Done (Total of 1 file compiled, 2 skipped)
Contacting host: melpa.org:443
Parsing tar file...done
Extracting...done
  INFO     Scraping files for bufler-autoloads.el... 
Generating autoloads for bufler-group-tree.el...done
Generating autoloads for bufler-pkg.el...done
Generating autoloads for bufler-workspace-tabs.el...done
Generating autoloads for bufler-workspace.el...done
Generating autoloads for bufler.el...done
  INFO     Scraping files for bufler-autoloads.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703/bufler-autoloads.el [2 times]
Checking /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703... [2 times]
Compiling /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703/bufler-group-tree.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703/bufler-group-tree.elc
Checking /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703... [2 times]
Compiling /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703/bufler-workspace-tabs.el...
Warning: Eager macro-expansion skipped due to cycle:
  … => (load "bufler-workspace-tabs.el") => (macroexpand-all …) => (macroexpand (eval-when-compile …)) => (load "bufler-workspace.el") => (load "bufler-workspace-tabs.el")
Eager macro-expansion failure: (error "Recursive ‘require’ for feature ‘bufler-workspace’")
Compiling /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703/bufler-workspace-tabs.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703/bufler-workspace-tabs.elc
Checking /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703...
Compiling /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703/bufler-workspace.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703/bufler-workspace.elc
Checking /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703...
Compiling /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703/bufler.el...done
Wrote /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703/bufler.elc
Checking /tmp/tmp.HSfFaSyv56/elpa/bufler-20210722.1703...
Done (Total of 4 files compiled, 2 skipped)
Package ‘bufler’ installed.
Loading /tmp/tmp.HSfFaSyv56/init.el (source)...done

Note that for 28.0, map-3.1 is the builtin version, so it doesn't need the separate map install.
In any case, I tried the same sequenced approach as you suggested, and get the exact same 'skipped due to cycle' message immediately above. But it works in this instance.

There seems to be something to do with macro expansion that changed during 27.2 that breaks things when installing bufler.

Oh well, at least I know I can use 28.0 now 🤷‍♂️

Not sure if all this is of any use to you, but I thought it might be useful for anyone else stumbling into the same problem to document what I did. 🙂

@alphapapa
Copy link
Owner

@iffsid Thanks for that thorough investigation. (And I'm sorry I didn't notice it for 10 days. I have too many GitHub notifications, and comments on closed issues tend to go unnoticed.) I don't have a way to easily test on multiple Emacs versions at the moment, other than using GitHub CI...which I now see that I forgot to set up for this repo. sigh Maybe I have too many Emacs packages...

In any case, I tried the same sequenced approach as you suggested, and get the exact same 'skipped due to cycle' message immediately above.

Ok, I haven't seen that before. Maybe the real problem is this:

Warning: Eager macro-expansion skipped due to cycle:
  … => (load "bufler-workspace-tabs.el") => (macroexpand-all …) => (macroexpand (eval-when-compile …)) => (load "bufler-workspace.el") => (load "bufler-workspace-tabs.el")
Eager macro-expansion failure: (error "Recursive ‘require’ for feature ‘bufler-workspace’")

That's probably because of code in bufler-workspace-tabs.el that's conditional on the Emacs version, and I haven't been using that Emacs version, so I didn't notice the problem. I'll see if I can fix that...

@alphapapa
Copy link
Owner

alphapapa commented Sep 7, 2021

Well, I've confirmed the problem:

On Emacs 26.3, with map 3.1 installed and loaded, this code:

(macroexpand-all '(pcase-let* (((map :max-width) plist))
                                 max-width))

correctly expands to this code (according to a debug message wrapped in eval-when-compile):

(let* ((x6 (map-elt plist :max-width))) (let ((max-width x6)) max-width))

as shown in this CI run (which will eventually expire from GitHub): https://github.com/alphapapa/bufler.el/runs/3533167237#step:5:28

But on Emacs 27.1 and 27.2, the same code incorrectly expands to:

(let* ((x6 (map-elt plist ':max-width))) (progn max-width))

And as the CI run shows, map 3.1 is installed and loaded:

LOG (2021-09-07 11:31:03): Compiling file: bufler-workspace.el...
MAP VERSION IS: (3 1)
MAP IS AT: "/tmp/tmp.cEPHlNUWYk/27.1/elpa/map-3.1/map.elc"
EXPANSION TEST: (let* ((x6 (map-elt plist ':max-width))) (progn max-width))
Eager macro-expansion failure: (void-variable max-width)
Eager macro-expansion failure: (void-variable max-width)

as shown here: https://github.com/alphapapa/bufler.el/runs/3533167285#step:5:21

I have no explanation for this. I'm hesitant to file a bug report, but I don't know what the problem could be, so that might be necessary. Then again, since Emacs 28 doesn't exhibit the problem, maybe I could just ask on emacs-devel.

In the meantime, I guess I'll have to change the pcase binding form.

alphapapa added a commit that referenced this issue Sep 7, 2021
I have no explanation for why this fails on Emacs 27 only.  See
<#70>.
@alphapapa
Copy link
Owner

Although the applied workaround should resolve the problem here, I'm going to leave the issue open until I find what caused it.

@alphapapa alphapapa reopened this Sep 7, 2021
@alphapapa
Copy link
Owner

I posted a message on emacs-devel: https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg00597.html

@alphapapa
Copy link
Owner

After further digging, I found some more information. Reproducing my reply on emacs-devel here to make it easier for me to keep track of:

Kevin Vigouroux via "Emacs development discussions."
<emacs-devel@gnu.org> writes:

> However, in my test, the macro expansion returns a good result. Why?
>
> It seems to me that I proceeded as indicated by first loading ‘map
> v3.1’ and then compiling the code.

After further digging, the problem seems to be that Emacs 27.2 is not
activating the newer version of map.el installed from ELPA.  I'm able to
reproduce the problem like so:

1.  Ensure that map.el >=2.1 is installed into ~/.emacs.d/elpa.

2.  Make file "/tmp/argh.el" with these contents:

      (require 'package)
      (message "PACKAGE-DIR: %S"
               package-user-dir)
      (package-activate-all)
      (require 'map)
      (message "MAP IS: %S"
               (package-desc-version (car (alist-get 'map package-alist))))
      (message "MAP IS AT: %S"
               (locate-library "map"))
      (message "EXPANSION TEST: %S"
               (macroexpand-all '(pcase-let* (((map :max-width) plist))
                                   max-width)))
      (byte-compile-file "argh2.el" t)

3.  Make file "/tmp/argh2.el" with these contents:

      (let ((plist '(:max-width 2)))
        (pcase-let* (((map :max-width) plist))
          (message "MAX-WIDTH: %S" max-width)))

4.  Run this command:

      emacs -q --batch -l /tmp/argh.el

On Emacs 27.2, I get this output:

  PACKAGE-DIR: "~/.emacs.d/elpa"
  MAP IS: (2 1)
  MAP IS AT: "/home/me/.emacs.d/elpa/map-2.1/map.elc"
  EXPANSION TEST: (let* ((x6 (map-elt plist ':max-width))) (progn max-width))
  In toplevel form:
  argh2.el:3:30:Warning: reference to free variable ‘max-width’
  Loading /tmp/argh2.elc...
  Symbol’s value as variable is void: max-width

You can see that, even though `locate-library' returns the map-2.1
version, the expansion is not correct.  And when I run Emacs
interactively and `eval-buffer', I get the same result.

However, when I do "M-x unload-feature RET map RET", I get this message:

  Loaded libraries ("/home/me/tmp/src/emacs/emacs/lisp/json.elc")
  depend on /home/me/tmp/src/emacs/emacs/lisp/emacs-lisp/map.elc

So even though `locate-library' returns the map-2.1 version, apparently
the non-ELPA version is what's actually loaded, and that version does
not support the pcase pattern in question.

So, changing "/tmp/argh.el" to these contents, adding a call to
`unload-feature' to force the already-loaded version to be unloaded, and
allowing the subsequent `require' to load the newer version, fixes it:

  (require 'package)
  (message "PACKAGE-DIR: %S"
           package-user-dir)
  (package-activate-all)
  (unload-feature 'map t)
  (require 'map)
  (message "MAP IS: %S"
           (package-desc-version (car (alist-get 'map package-alist))))
  (message "MAP IS AT: %S"
           (locate-library "map"))
  (message "EXPANSION TEST: %S"
           (macroexpand-all '(pcase-let* (((map :max-width) plist))
                               max-width)))
  (byte-compile-file "argh2.el" t)

When run in batch mode, that gives this output:

  PACKAGE-DIR: "~/.emacs.d/elpa"
  MAP IS: (2 1)
  MAP IS AT: "/home/me/.emacs.d/elpa/map-2.1/map.elc"
  EXPANSION TEST: (let* ((x6 (map-elt plist :max-width))) (let ((max-width x6)) max-width))
  Loading /tmp/argh2.elc...
  MAX-WIDTH: 2

So there seems to be a discrepancy between the version of the library
returned by `locate-library' and the version of the activated package,
and the version *actually* loaded into Emacs.  Installing newer versions
of core libraries from ELPA doesn't seem to work, or at least not
reliably, on Emacs 27.  But on Emacs 26.3 and Emacs 28.0.50, it seems to
work--for me, anyway.

Is this a bug in Emacs 27, or am I misunderstanding something?  I
thought the point of having newer versions of these core libs on ELPA
was that they could be used in older--or current--Emacs versions, but
this doesn't seem to be working reliably.

@iffsid
Copy link

iffsid commented Sep 9, 2021

@alphapapa thanks for digging into things!
It still looks like there is an issue with emacs 27, but now seems to be about a recursive require between bufler-workspace and bufler-workspace-tabs.

I've included the log from running emacs-sandbox.sh -i bufler here.

I've switched to using emacs 28 now anyways, but thought it might be worth flagging this up just in case. :)

@alphapapa
Copy link
Owner

@iffsid Please try installing the version in the wip/ci branch, which no longer loads bufler-workspace from bufler-workspace-tabs: https://github.com/alphapapa/bufler.el/blob/wip/ci/bufler-workspace-tabs.el

@sarg
Copy link

sarg commented Feb 17, 2024

I'm affected by this on emacs 29.1, map version seem to be 3.3.1
Anyway, an easy fix is to replace the problematic line:

diff --git a/bufler.el b/bufler.el
index e67f9df..cb45ed1 100644
--- a/bufler.el
+++ b/bufler.el
@@ -794,7 +794,8 @@ PLIST may be a plist setting the following options:
                ;; NOTE: Emacs 27 inexplicably fails to expand this `pcase' binding form correctly at compile time,
                ;; so we use the more explicit form.  See <https://github.com/alphapapa/bufler.el/issues/70>.
                ;;  ((map :face :max-width) plist)
-               ((map (:face face) (:max-width max-width)) plist)
+               (max-width (map-elt plist :max-width))
+               (face (map-elt plist :face))
                (max-width-variable (intern (concat "bufler-column-" name "-max-width")))
                (max-width-docstring (format "Maximum width of the %s column." name)))
     `(progn
-- 
2.41.0

@alphapapa
Copy link
Owner

alphapapa commented Feb 17, 2024

I'm affected by this on emacs 29.1, map version seem to be 3.3.1 Anyway, an easy fix is to replace the problematic line:

diff --git a/bufler.el b/bufler.el
index e67f9df..cb45ed1 100644
--- a/bufler.el
+++ b/bufler.el
@@ -794,7 +794,8 @@ PLIST may be a plist setting the following options:
                ;; NOTE: Emacs 27 inexplicably fails to expand this `pcase' binding form correctly at compile time,
                ;; so we use the more explicit form.  See <https://github.com/alphapapa/bufler.el/issues/70>.
                ;;  ((map :face :max-width) plist)
-               ((map (:face face) (:max-width max-width)) plist)
+               (max-width (map-elt plist :max-width))
+               (face (map-elt plist :face))
                (max-width-variable (intern (concat "bufler-column-" name "-max-width")))
                (max-width-docstring (format "Maximum width of the %s column." name)))
     `(progn
-- 
2.41.0

Your Emacs must be misconfigured or this package is not installed correctly. This is not a problem on Emacs 29.

@sarg
Copy link

sarg commented Feb 17, 2024

When evaluating this code:

(let ((plist '(:max-width 2)))
  (pcase-let* (((map :max-width) plist))
    (message "MAX-WIDTH: %S" max-width)))

I get this error

Debugger entered--Lisp error: (void-variable _)
  (map-elt _ :max-width plist)
  (let* ((x3420 (map-elt _ :max-width plist))) (let ((max-width x3420)) (message "MAX-WIDTH: %S" max-width)))
  (progn (ignore (mapp plist)) (let* ((x3420 (map-elt _ :max-width plist))) (let ((max-width x3420)) (message "MAX-WIDTH: %S" max-width))))
  (let ((plist '(:max-width 2))) (progn (ignore (mapp plist)) (let* ((x3420 (map-elt _ :max-width plist))) (let ((max-width x3420)) (message "MAX-WIDTH: %S" max-width)))))
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  eros-eval-last-sexp(nil)
  funcall-interactively(eros-eval-last-sexp nil)
  command-execute(eros-eval-last-sexp)

There was a change in map.el 4 days ago: emacs-straight/map@613340b

@alphapapa
Copy link
Owner

Yes, and there is a test for that: https://git.savannah.gnu.org/cgit/emacs.git/tree/test/lisp/emacs-lisp/map-tests.el?id=40994d2bafafa53464d3678b06f391fd13c884ec#n621

And you said that you're running Emacs 29.1, which does not have that change to map.el that was made 4 days ago. So are you running some kind of chimera with straight?

@sarg
Copy link

sarg commented Feb 17, 2024

I'm on doom-emacs (which uses straight) and honestly I have no idea why map is fetched externally. I've forced it putting (package! map :built-in t) to packages.el and it resolved the issue.

@alphapapa
Copy link
Owner

Please report that bug to the DOOM maintainer!

@sarg
Copy link

sarg commented Feb 17, 2024

It looks to me as a bug in map.el. The test you've mentioned is failing now

@alphapapa
Copy link
Owner

alphapapa commented Feb 17, 2024

Forgive me, @monnier, but I punt to you.

@sarg You still need to report it to the DOOM maintainer, because DOOM should not be loading pre-release versions of ELPA/core libraries into released versions of Emacs.

@alphapapa
Copy link
Owner

@progfolio Please see above.

@monnier
Copy link

monnier commented Feb 21, 2024 via email

@progfolio
Copy link

No idea how Straight's map package is following emacs.git, but FWIW
the latest map.el can also be installed via package.el from
GNU-devel ELPA.

There is a mirroring script run daily: https://github.com/radian-software/gnu-elpa-mirror

In any case, I just pushed a patch to Emacs's master branch which
should hopefully fix it.

So long as that script is working, the change should be picked up within a day.

@monnier
Copy link

monnier commented Feb 21, 2024 via email

@progfolio
Copy link

There is a mirroring script run daily: https://github.com/radian-software/gnu-elpa-mirror

"GNU ELPA uses an overly complex, unwieldy, and fragile build process."
Nice! 🙂

Lol not my commentary, though I do think there are some fair criticisms of the tarball distribution model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compatibility
Projects
None yet
Development

No branches or pull requests

6 participants