emacs-exwm / exwm

Emacs X Window Manager
https://elpa.gnu.org/packages/exwm.html
GNU General Public License v3.0
189 stars 7 forks source link

wrong-type-argument listp rect #58

Closed gdindi closed 3 weeks ago

gdindi commented 3 weeks ago

Hi, First of all, thank you for your work. EXWM is my daily driver and has been for a couple of years!

I use the master branch that I update once a week (as I do with emacs itself). This is how I do it with use-package

(use-package xelb
  :ensure t
  :vcn t
  :load-path "/home/garjola/local/src/EXWM/xelb"
)
(use-package exwm
  :ensure t
  :vc t
  :load-path "/home/garjola/local/src/EXWM/exwm"
)

Yesterday, I updated the branch and I noticed a problem in the initialization process:

Debugger entered--Lisp error: (wrong-type-argument listp rect)
  car(rect)
  #f(compiled-function (binding then &optional else) "Bind value according to BINDING and check for truthy-ness\nIf the test passes then eval THEN with the BINDING varlist bound\nIf no, eval ELSE with no binding" #<bytecode -0x197a6feff3664419>)((rect (frame-parameter frame 'exwm-geometry)) (clone rect) (make-instance 'xcb:RECTANGLE :x 0 :y 0 :width root-width :height root-height))
  apply(#f(compiled-function (binding then &optional else) "Bind value according to BINDING and check for truthy-ness\nIf the test passes then eval THEN with the BINDING varlist bound\nIf no, eval ELSE with no binding" #<bytecode -0x197a6feff3664419>) ((rect (frame-parameter frame 'exwm-geometry)) (clone rect) (make-instance 'xcb:RECTANGLE :x 0 :y 0 :width root-width :height root-height)))
  macroexpand-1((if-let (rect (frame-parameter frame 'exwm-geometry)) (clone rect) (make-instance 'xcb:RECTANGLE :x 0 :y 0 :width root-width :height root-height)) nil)
  macroexp-macroexpand((if-let (rect (frame-parameter frame 'exwm-geometry)) (clone rect) (make-instance 'xcb:RECTANGLE :x 0 :y 0 :width root-width :height root-height)) nil)
  macroexp--expand-all((if-let (rect (frame-parameter frame 'exwm-geometry)) (clone rect) (make-instance 'xcb:RECTANGLE :x 0 :y 0 :width root-width :height root-height)))
  macroexp--all-forms((lambda (frame) (if-let (rect (frame-parameter frame 'exwm-geometry)) (clone rect) (make-instance 'xcb:RECTANGLE :x 0 :y 0 :width root-width :height root-height))) 2)
  macroexp--expand-all((lambda (frame) (if-let (rect (frame-parameter frame 'exwm-geometry)) (clone rect) (make-instance 'xcb:RECTANGLE :x 0 :y 0 :width root-width :height root-height))))
  macroexp--all-forms((mapcar (lambda (frame) (if-let (rect (frame-parameter frame 'exwm-geometry)) (clone rect) (make-instance 'xcb:RECTANGLE :x 0 :y 0 :width root-width :height root-height))) exwm-workspace--list) 1)
  #f(compiled-function (form func) #<bytecode -0x16b542aca93b349f>)(((mapcar (lambda (frame) (if-let (rect (frame-parameter frame 'exwm-geometry)) (clone rect) (make-instance 'xcb:RECTANGLE :x 0 :y 0 :width root-width :height root-height))) exwm-workspace--list)) mapcar)
  macroexp--expand-all((mapcar (lambda (frame) (if-let (rect (frame-parameter frame 'exwm-geometry)) (clone rect) (make-instance 'xcb:RECTANGLE :x 0 :y 0 :width root-width :height root-height))) exwm-workspace--list))
  macroexp--all-forms((workareas (mapcar (lambda (frame) (if-let (rect (frame-parameter frame 'exwm-geometry)) (clone rect) (make-instance 'xcb:RECTANGLE :x 0 :y 0 :width root-width :height root-height))) exwm-workspace--list)) 1)
  macroexp--all-clauses(((root-width (x-display-pixel-width)) (root-height (x-display-pixel-height)) (workareas (mapcar (lambda (frame) (if-let (rect (frame-parameter frame ...)) (clone rect) (make-instance 'xcb:RECTANGLE :x 0 :y 0 :width root-width :height root-height))) exwm-workspace--list))) 1)
  macroexp--expand-all((let* ((root-width (x-display-pixel-width)) (root-height (x-display-pixel-height)) (workareas (mapcar (lambda (frame) (if-let (rect ...) (clone rect) (make-instance ... :x 0 :y 0 :width root-width :height root-height))) exwm-workspace--list))) (dolist (struts exwm-workspace--struts) (let* ((edge (aref struts 0)) (size (aref struts 1)) (position (aref struts 2)) (beg (and position (aref position 0))) (end (and position (aref position 1))) delta) (dolist (w workareas) (with-slots (x y width height) w (pcase edge (... ... ...) (... ... ...) (... ... ...) (... ... ...)))))) (setq exwm-workspace--workareas workareas) (xcb:flush exwm--connection)))
  macroexp--all-forms((lambda nil "Update `exwm-workspace--workareas'." (let* ((root-width (x-display-pixel-width)) (root-height (x-display-pixel-height)) (workareas (mapcar (lambda (frame) (if-let ... ... ...)) exwm-workspace--list))) (dolist (struts exwm-workspace--struts) (let* ((edge (aref struts 0)) (size (aref struts 1)) (position (aref struts 2)) (beg (and position ...)) (end (and position ...)) delta) (dolist (w workareas) (with-slots (x y width height) w (pcase edge ... ... ... ...))))) (setq exwm-workspace--workareas workareas) (xcb:flush exwm--connection)) (exwm--log "%s" exwm-workspace--workareas) (run-hooks 'exwm-workspace--update-workareas-hook)) 2)
  macroexp--expand-all(#'(lambda nil "Update `exwm-workspace--workareas'." (let* ((root-width (x-display-pixel-width)) (root-height (x-display-pixel-height)) (workareas (mapcar (lambda ... ...) exwm-workspace--list))) (dolist (struts exwm-workspace--struts) (let* ((edge ...) (size ...) (position ...) (beg ...) (end ...) delta) (dolist (w workareas) (with-slots ... w ...)))) (setq exwm-workspace--workareas workareas) (xcb:flush exwm--connection)) (exwm--log "%s" exwm-workspace--workareas) (run-hooks 'exwm-workspace--update-workareas-hook)))
  macroexp--all-forms((defalias 'exwm-workspace--update-workareas #'(lambda nil "Update `exwm-workspace--workareas'." (let* ((root-width (x-display-pixel-width)) (root-height (x-display-pixel-height)) (workareas (mapcar ... exwm-workspace--list))) (dolist (struts exwm-workspace--struts) (let* (... ... ... ... ... delta) (dolist ... ...))) (setq exwm-workspace--workareas workareas) (xcb:flush exwm--connection)) (exwm--log "%s" exwm-workspace--workareas) (run-hooks 'exwm-workspace--update-workareas-hook))) 1)
  #f(compiled-function (form func) #<bytecode -0x16b542aca93b349f>)(((defalias 'exwm-workspace--update-workareas #'(lambda nil "Update `exwm-workspace--workareas'." (let* ((root-width ...) (root-height ...) (workareas ...)) (dolist (struts exwm-workspace--struts) (let* ... ...)) (setq exwm-workspace--workareas workareas) (xcb:flush exwm--connection)) (exwm--log "%s" exwm-workspace--workareas) (run-hooks 'exwm-workspace--update-workareas-hook)))) defalias)
  macroexp--expand-all((defalias 'exwm-workspace--update-workareas #'(lambda nil "Update `exwm-workspace--workareas'." (let* ((root-width (x-display-pixel-width)) (root-height (x-display-pixel-height)) (workareas (mapcar ... exwm-workspace--list))) (dolist (struts exwm-workspace--struts) (let* (... ... ... ... ... delta) (dolist ... ...))) (setq exwm-workspace--workareas workareas) (xcb:flush exwm--connection)) (exwm--log "%s" exwm-workspace--workareas) (run-hooks 'exwm-workspace--update-workareas-hook))))
  macroexpand--all-toplevel((defalias 'exwm-workspace--update-workareas #'(lambda nil "Update `exwm-workspace--workareas'." (let* ((root-width (x-display-pixel-width)) (root-height (x-display-pixel-height)) (workareas (mapcar ... exwm-workspace--list))) (dolist (struts exwm-workspace--struts) (let* (... ... ... ... ... delta) (dolist ... ...))) (setq exwm-workspace--workareas workareas) (xcb:flush exwm--connection)) (exwm--log "%s" exwm-workspace--workareas) (run-hooks 'exwm-workspace--update-workareas-hook))))
  internal-macroexpand-for-load((defalias 'exwm-workspace--update-workareas #'(lambda nil "Update `exwm-workspace--workareas'." (let* ((root-width (x-display-pixel-width)) (root-height (x-display-pixel-height)) (workareas (mapcar ... exwm-workspace--list))) (dolist (struts exwm-workspace--struts) (let* (... ... ... ... ... delta) (dolist ... ...))) (setq exwm-workspace--workareas workareas) (xcb:flush exwm--connection)) (exwm--log "%s" exwm-workspace--workareas) (run-hooks 'exwm-workspace--update-workareas-hook))) t)
  eval-buffer(#<buffer  *load*-811507> nil "/home/garjola/local/src/EXWM/exwm/exwm-workspace.el" nil t)  ; Reading at buffer position 16179
  load-with-code-conversion("/home/garjola/local/src/EXWM/exwm/exwm-workspace.el" "/home/garjola/local/src/EXWM/exwm/exwm-workspace.el" nil t)
  require(exwm-workspace)
  eval-buffer(#<buffer  *load*> nil "/home/garjola/local/src/EXWM/exwm/exwm.el" nil t)  ; Reading at buffer position 2552
  load-with-code-conversion("/home/garjola/local/src/EXWM/exwm/exwm.el" "/home/garjola/local/src/EXWM/exwm/exwm.el" nil t)
  command-execute(exwm-init record)
  counsel-M-x-action("exwm-init")
  #f(compiled-function (x) #<bytecode -0x1fd3ab389fe984ed>)("exwm-init")

I tried to solve the issue by just removing the byte-compiled and native-compiled files (elc and eln), but it didn’t help. I also tried going back in the git repo a couple of weeks, but it didn’t work either. If I use the package available on GNU ELPA (0.30) everything works as expected.

Maybe I am not using the git version in a correct way, because updating the repo does not byte-compile the sources. Of course, I don’t need to follow master (I started doing that when the ELPA package was lacking behind), but I am submitting this issue in case it helps to debug before a new release. So don’t bother if you think that this is related to me using the git repo with use-package.

On the other hand, if you think I can do something to better diagnose the problem, do not hesitate to tell me.

Thanks again!

Stebalien commented 3 weeks ago

Lol, that was fun to debug. Please uninstall the j-mode package.

https://github.com/zellio/j-mode/blob/e8725ac8af95498faabb2ca3ab3bd809a8f148e6/j-help.el#L45-L47

It's re-defining if-let incorrectly. Luckily, https://grep.app is a thing.

Stebalien commented 3 weeks ago

Alternatively, there appears to be an active fork at https://github.com/LdBeth/j-mode/. Melpa issue at https://github.com/melpa/melpa/issues/9055.

Stebalien commented 3 weeks ago

Never mind. The fix has been merged upstream and will be included in the next melpa rebuild. When it updates, you'll have to run package-recompile-all to rebuild all packages.

gdindi commented 3 weeks ago

On Sun 09-Jun-2024 at 17:24:33 +02, Steven Allen @.***> wrote:

Never mind. The fix has been merged upstream and will be included in the next melpa rebuild. When it updates, you'll have to run package-recompile-all to rebuild all packages.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

Nice. Thank you very much.

Is it recommended to run package-recompile-all regularly if I am following master?

Stebalien commented 3 weeks ago

Is it recommended to run package-recompile-all regularly if I am following master?

The issue here isn't related to EXWM. j-mode re-defined the if-let macro which means anything compiled after loading j-mode will use that macro instead of the built-in version. That means other packages you have may also be subtly broken.

NOTE: you can (sort of) also avoid this issue by installing the async package and enabling async-bytecomp-mode. That'll do all byte-compiliation in separate "sandboxed" Emacs processes so packages are less-likely to have conflicts like this. On the other hand:

  1. It won't help if packages re-define functions, only macros.
  2. It won't help when code is evaluated, only when you've loaded the byte-compiled version.