moom
moom copied to clipboard
[FEATURE REQUEST] Hope this package can add transient or hydra support
Because this package provides so many commands. Hope this package can add transient or hydra UI interface. It will help user interact with so many commands. WDYT?
Yeah, actually adding such feature is my wish listed in my org file. I'll select transient rather than hydra due to my personal preference.
I've implemented moom-transient.el. It is still the initial and testing version, so it may be changed in future. You can get it from the transient branch https://github.com/takaxp/moom/tree/transient.
I got error when execute transient command 0 move top-left in moom-transient-dispatch. Other commands has same error too.
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
+(-1080 nil nil)
(let ((left (frame-parameter nil 'left))) (+ (if (listp left) (nth 1 left) left) (nth 0 moom--virtual-grid) (nth 0 moom--screen-grid)))
moom--frame-left()
(moom--pos-x (moom--frame-left))
(cons "left" (moom--pos-x (moom--frame-left)))
(list (cons "font-size" (if moom--font-module-p moom-font--size nil)) (cons "left" (moom--pos-x (moom--frame-left))) (cons "top" (moom--frame-top)) (cons "width" (moom--frame-width)) (cons "height" (moom--frame-height)) (cons "pixel-width" (moom--frame-pixel-width)) (cons "pixel-height" (moom--frame-pixel-height)))
(setq moom--last-status (list (cons "font-size" (if moom--font-module-p moom-font--size nil)) (cons "left" (moom--pos-x (moom--frame-left))) (cons "top" (moom--frame-top)) (cons "width" (moom--frame-width)) (cons "height" (moom--frame-height)) (cons "pixel-width" (moom--frame-pixel-width)) (cons "pixel-height" (moom--frame-pixel-height))))
moom--save-last-status()
(let ((last (moom--save-last-status))) (let ((pos-x (nth 2 moom--screen-margin)) (pos-y (nth 0 moom--screen-margin))) (if (eq window-system 'w32) (progn (setq pos-x (+ pos-x (nth 0 moom--screen-grid))) (setq pos-y (+ pos-y (nth 1 moom--screen-grid))))) (cond ((not arg) t) ((numberp arg) (setq pos-x (+ pos-x arg)) (setq pos-y (moom--frame-top))) ((listp arg) (setq pos-x (+ pos-x (nth 0 arg))) (setq pos-y (+ pos-y (nth 1 arg))))) (if (eq window-system 'w32) (modify-frame-parameters nil (list (list 'left '+ pos-x) (list 'top '+ pos-y))) (if (and (eq pos-x (moom--frame-left)) (eq pos-y (moom--frame-top))) nil (set-frame-position nil (moom--pos-x pos-x) (moom--pos-y pos-y))))) (if (or moom--non-interactive-history (called-interactively-p 'any)) (progn (moom--add-command-history last))))
moom-move-frame()
funcall-interactively(moom-move-frame)
call-interactively(moom-move-frame nil nil)
command-execute(moom-move-frame)
Here is my moom config:
(use-package moom
;; :ensure t
:quelpa (moom :fetcher github :repo "takaxp/moom" :branch "transient")
;; :init (moom-mode 1)
:config
(require 'moom-font)
(require 'moom-transient) ; `moom-transient-dispatch', `moom-transient-config'
(with-eval-after-load "moom" ;; 'all
(moom-recommended-keybindings '(move fit expand fill font reset undo))))
Thanks! It's strange for me, but I'll check it.
I'm not good at use-package, but at least (moom-mode 1) is needed since this package is a minor mode.
Enabled (moom-mode 1) fixed upper problem. And tested moom commands works fine.
Thank you! moom-transient-config may not work correctly so I still working on it and investigating optimal design to list the commands.
[Off Topic] Currenltly I only explored some commands of moom. Some theory of moom is hard to guess. For example, the font scale is changed when I execute some moom commands. If this package can record a screen video of moom demo for all commands when you got time. That will be great helpful. (The GIF images are small, hard to watch.)
I got error when I restart Emacs.
Debugger entered--Lisp error: (void-function transient-define-prefix)
(transient-define-prefix moom-transient-dispatch nil "Command list of `moom'." :transient-suffix 'moom-transient--do-stay [:description moom-transient--dispatch-description ["Move the frame" ("0" "move top-left" moom-move-frame) ("1" "move left" moom-move-frame-left) ("2" "move center" moom-move-frame-to-center) ("3" "move right" moom-move-frame-right)] ["Expand" ("w s" "single" moom-change-frame-width-single) ("w d" "double" moom-change-frame-width-double) ("w a" "3/2" moom-change-frame-width-half-again) ("c h" "height" moom-cycle-frame-height)] ["Fit (edge)" ("e l" "edge left" moom-move-frame-to-edge-left) ("e r" "edge right" moom-move-frame-to-edge-right) ("e t" ,"edge top" moom-move-frame-to-edge-top) ("e b" ,"edge bottom" moom-move-frame-to-edge-bottom)] ["Fit (center)" ("c l" "center left" moom-move-frame-to-centerline-from-left) ("c r" "center right" moom-move-frame-to-centerline-from-right) ("c t" "center top" moom-move-frame-to-centerline-from-top) ("c b" "center bottom" moom-move-frame-to-centerline-from-bottom)]] [["Fill screen" ("f s" "screen" moom-fill-screen) ("f w" "width" moom-fill-width) ("f h" "height" moom-fill-height) ("f m" "band" moom-fill-band)] ["Fill screen (half)" ("f t" "top" moom-fill-top) ("f b" "bottom" moom-fill-bottom) ("f l" "left" moom-fill-left) ("f r" "right" moom-fill-right)] ["Fill screen (quarter)" ("f 1" "top left" moom-fill-top-left) ("f 2" "top right" moom-fill-top-right) ("f 3" "bottom left" moom-fill-bottom-left) ("f 4" "bottom right" moom-fill-bottom-right)] ["Utilities" ("r" "reset" moom-reset) ("u" "undo" moom-undo) ("v" "version" moom-version) ("q" "quit" transient-quit-all)]])
eval-buffer(#<buffer *load*> nil "/Users/stardiviner/.config/emacs/elpa/moom-2022082..." nil t) ; Reading at buffer position 13375
load-with-code-conversion("/Users/stardiviner/.config/emacs/elpa/moom-2022082..." "/Users/stardiviner/.config/emacs/elpa/moom-2022082..." nil t)
load("/Users/stardiviner/.config/emacs/elpa/moom-2022082..." nil t)
I checked the moom-transient.el source code, it indeed (require 'transient). Maybe somewhere is wrong?
Thanks. Fortunately, GitHub recently supports for uploading mov file not converted GIF. So I can provide higher quality videos.
Regarding on the font size changing, commands in "Expand" and "Fill screen(width)", "Fill screen(height) will not change the font size. But as you mentioned, it is confusing. I'll try to improve it.
Thanks. Fortunately, GitHub recently supports for uploading mov file not converted GIF. So I can provide higher quality videos.
Regarding on the font size changing, commands in "Expand" and "Fill screen(width)", "Fill screen(height) will not change the font size. But as you mentioned, it is confusing. I'll try to improve it.
Thanks a lot for your work! My regards.
Yeah, if you use version ~~0.9.1~~ 0.9.0, please update to ~~0.9.2~~ 0.9.1. ~~0.9.1~~ 0.9.2 uses eval-when-compile but ~0.9.2~ 0.9.1 requires transient.el at top-level of the code.
Sorry! 0.9.2 is still in my local PC. Please use 0.9.1, not 0.9.0.
I updated to latest version. Still has same error. I will try again later after you updated. Thanks for notify.
OK... now it strange.. but anyway I'll check it.
Can you reproduce this error on your PC? If not, maybe I need to figure out more.
Actually, I cannot reproduce the error, but I didn't try it in a clean environment like only moom.el with transient.el.
I figured out why:
(use-package moom
;; :ensure t
:quelpa (moom :fetcher github :repo "takaxp/moom" :branch "transient")
:preface
(require 'moom-font)
(require 'moom-transient)
:commands (moom-transient-dispatch moom-transient-config)
:bind ("C-c z" . moom-transient-dispatch)
:config
(with-eval-after-load "moom" ;; 'all
(moom-recommended-keybindings '(move fit expand fill font reset undo))))
My config the :preface section of use-package caused this error. Then I adjust my config:
(use-package moom
;; :ensure t
;; :quelpa (moom :fetcher github :repo "takaxp/moom" :branch "transient")
:load-path "~/Code/Emacs/moom/"
:init
(require 'moom)
(moom-mode 1)
(require 'moom-font)
(require 'moom-transient)
:commands (moom-transient-dispatch moom-transient-config)
:bind ("C-c z" . moom-transient-dispatch)
:config
(with-eval-after-load "moom" ;; 'all
(moom-recommended-keybindings '(move fit expand fill font reset undo))))
Now the error gone.
I checked the use-package documents, found the :preface is loaded before the package loading. This is the reason caused my upper error. Sorry for wasting your time to investigating this problem. My fault without deep checking.
:require (transient) may help and no need to write require 'moom-font ~~and 'transient~~ in the section. But now you resolve it by yourself. Happy!