[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RP] emacs windmove and focus
From: |
Russell Carden |
Subject: |
[RP] emacs windmove and focus |
Date: |
Thu, 11 Oct 2012 10:46:10 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux i686 on x86_64; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2 |
Hello,
I have been using ratpoison for a little over a year. Over the summer I
discovered emacs windmove package. I finally got around to making
emacs's windmove to work with my keybindings for ratpoison's focus
commands. I had to modify the windmove-do-window-select function in
windmove.el. It would be nice if windmove's response to hitting the
edge of the frame could be determined by a user defined function.
Anyway, for my fix, windmove wrapping has to be disabled. If
windmove-{dir} would result in an error due to there not being a window
in the direction dir, then a call is made to ratpoison's focus{dir}
command. I setup keyboard shorcuts for ratpoison's focus{dir} that call
windmove-{dir} if the current frame is emacs and otherwise call focus{dir}.
I modified the following function in windmove.el
#+begin_src emacs-lisp
;; Selects the window that's hopefully at the location returned by
;; `windmove-other-window-loc', or screams if there's no window there.
(defun windmove-do-window-select (dir &optional arg window)
"Move to the window at direction DIR.
DIR, ARG, and WINDOW are handled as by `windmove-other-window-loc'.
If no window is at direction DIR, an error is signaled."
(let ((other-window (windmove-find-other-window dir arg window)))
(cond ((null other-window)
;Added code
(call-process-shell-command (concat "ratpoison -c "
(combine-and-quote-strings (list (concat "focus" (format "%s" dir))))
"&") nil 0 )
(message "focus%s" dir)
;End added code
(error "No window %s from selected window" dir))
((and (window-minibuffer-p other-window)
(not (minibuffer-window-active-p other-window)))
(error "Minibuffer is inactive"))
(t
(select-window other-window)))))
Modifications to ratpoisonrc.
- definekey top s-h exec result=`ratpoison -c "info %a"` ;if
[ "$result" == "emacs" ]; then emacsclient -e "(windmove-left)" ; else
ratpoison -c "focusleft";fi; exit 0
- definekey top s-j exec result=`ratpoison -c "info %a"` ;if
[ "$result" == "emacs" ]; then emacsclient -e "(windmove-down)" ; else
ratpoison -c "focusdown";fi; exit 0
- definekey top s-k exec result=`ratpoison -c "info %a"` ;if
[ "$result" == "emacs" ]; then emacsclient -e "(windmove-up)" ; else
ratpoison -c "focusup";fi; exit 0
- definekey top s-l exec result=`ratpoison -c "info %a"` ;if
[ "$result" == "emacs" ]; then emacsclient -e "(windmove-right)" ;
else ratpoison -c "focusright";fi; exit 0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [RP] emacs windmove and focus,
Russell Carden <=