Thursday, March 29, 2012

emacs: Cycle windows backward

To cycle windows in emacs you can use the shortcut c-x o that executes the command other-window. Now to cycle windows in the reverse order you need to execute the command other-window with argument -1 (other-window accepts integer as argument, being the number of windows to jump). So I added this code to my .ecmas file:
;; cycle windows in reverse order
(defun prev-window ()
  (interactive)
  (other-window -1)
)
(global-set-key (kbd "C-x p") 'prev-window)
This will create the command prev-window and assign the shortcut C-x p to this function. Note: C-x p is by default assigned to narrow-to-page, a function I never used... This Idea I found it originally in Quora.com

No comments :

Post a Comment