diff --git a/core/fg42/utils.el b/core/fg42/utils.el index 402fb59..ff180ea 100644 --- a/core/fg42/utils.el +++ b/core/fg42/utils.el @@ -129,5 +129,34 @@ or (last paths)))) +(defmacro -> (x &optional form &rest more) + "Thread the expr through the forms FORM and rest of form in MORE. +Insert X as the second item in the first form, making a list of +it if it is not a list already. If there are more forms, insert +the first form as the second item in second form, etc." + (declare (debug (form &rest [&or symbolp (sexp &rest form)]))) + (cond + ((null form) x) + ((null more) (if (listp form) + `(,(car form) ,x ,@(cdr form)) + (list form x))) + (:else `(-> (-> ,x ,form) ,@more)))) + + +(defmacro ->> (x &optional form &rest more) + "Thread the expr through the forms FORM and the rest at MORE. +Insert X as the last item in the first form, making a list of +it if it is not a list already. If there are more forms, insert +the first form as the +last item in second form, etc." + (declare (debug ->)) + (cond + ((null form) x) + ((null more) (if (listp form) + `(,@form ,x) + (list form x))) + (:else `(->> (->> ,x ,form) ,@more)))) + + (provide 'fg42/utils) ;;; utils.el ends here diff --git a/lib/fg42/wm.el b/lib/fg42/wm.el index 3f3c732..4868d06 100644 --- a/lib/fg42/wm.el +++ b/lib/fg42/wm.el @@ -84,6 +84,7 @@ ;; Bind "s-r" to exit char-mode and fullscreen mode. ([?\s-r] . exwm-reset) ([?\s-g] . keyboard-quit) + ([8388640] . other-window) ;; Bind "s-w" to switch workspace interactively. ([?\s-w] . exwm-workspace-switch) ;; Bind "s-0" to "s-9" to switch to a workspace by its index.