summaryrefslogtreecommitdiffstats
path: root/.emacs.d/init.org
diff options
context:
space:
mode:
authorGravatar Tom Willemse2013-11-07 21:56:15 +0100
committerGravatar Tom Willemse2013-11-07 21:56:15 +0100
commit541b4c606f927b0a9506338b05fd52f03b03f3ff (patch)
tree8d7a1cbfa18b6056f5c39001023cedc75cdd2f6a /.emacs.d/init.org
parentb8b205e064d46dbd1f7a72b4555d73e8659a6ab5 (diff)
downloademacs-541b4c606f927b0a9506338b05fd52f03b03f3ff.tar.gz
emacs-541b4c606f927b0a9506338b05fd52f03b03f3ff.zip
Update link to stante-after, move stumpwm stuff to init.org
Diffstat (limited to '.emacs.d/init.org')
-rw-r--r--.emacs.d/init.org62
1 files changed, 61 insertions, 1 deletions
diff --git a/.emacs.d/init.org b/.emacs.d/init.org
index c921e9d..e471651 100644
--- a/.emacs.d/init.org
+++ b/.emacs.d/init.org
@@ -20,7 +20,7 @@
certain package has been loaded. So in order to keep start-up as
fast as possible, while still taking advantage of byte-compiling
everything, I wrap most settings in the following macro, which is
- explained [[http://lunaryorn.com/blog/2013/05/31_byte-compiling-eval-after-load.html][here]].
+ explained [[http://lunaryorn.com/2013/05/31/byte-compiling-eval-after-load/][here]].
#+BEGIN_SRC emacs-lisp
(defmacro stante-after (feature &rest forms)
@@ -323,3 +323,63 @@
(stante-after simple
(define-key special-mode-map "z" #'kill-this-buffer))
#+END_SRC
+
+* Falling back to WM to switch windows
+
+ Emacs and any window manager have a difference op opinion on what
+ windows are. It doesn't have to matter, Emacs can manage its windows
+ and stumpwm can do the rest. When moving around with ~windmove~ and it
+ finds that there's no way to move in that direction, let stumpwm do
+ it.
+
+ First we have to know where the stumpish program is. SLIME could
+ also be used, but calling stumpish might be easier for now.
+
+ #+BEGIN_SRC emacs-lisp
+ (defvar init-stumpish-program
+ (expand-file-name
+ "~/.local/share/quicklisp/local-projects/stumpwm/contrib/stumpish")
+ "The location of the stumpish executable.")
+ #+END_SRC
+
+ Now that we know that, we should have an easy way to send stuff to
+ it.
+
+ #+BEGIN_SRC emacs-lisp
+ (defun stumpwm-command (cmd)
+ "Execute CMD in stumpwm."
+ (call-process init-stumpish-program nil nil nil cmd))
+ #+END_SRC
+
+ And then we can advise =windmove-do-window-select=, so that when it
+ finds there are no more windows to move to, it asks stumpwm to move
+ in the same direction.
+
+ #+BEGIN_SRC emacs-lisp
+ (defadvice windmove-do-window-select
+ (around init-windmove-stumpwm activate)
+ "If no window can be moved to, move stumpwm."
+ (condition-case err
+ ad-do-it
+ (error (stumpwm-command (format "move-focus %s" (ad-get-arg 0))))))
+ #+END_SRC
+
+ Now, whenever I try to move out of my Emacs windows, it just moves
+ to the next X11 window, whatever it might be. My stumpwm config has
+ a matching command that checks to see if the current window is
+ Emacs, and if so sends the ~S-<direction>~ key to Emacs, which in turn
+ calls stumpwm when it can't (getting a little crazy here).
+
+ I also wrote a simplistic macro to execute some stumpwm lisp in
+ Emacs.
+
+ #+BEGIN_SRC emacs-lisp
+ (defmacro stumpwm (&rest body)
+ "Execute BODY in stumpwm."
+ (declare (indent 0))
+ `(call-process init-stumpish-program nil nil nil
+ ,(format "eval '%S'" `(progn ,@body))))
+ #+END_SRC
+
+ Which is pretty much the same as my =elisp= macro in my stumpwm
+ config.