How do I make Emacs' other-window command ignore terminal windows? -
emacs okay job of being window manager. i've been splitting emacs frame this:
+---------------------------+ | | | | | | | | b | | | | | | | | | | | |-------------| | | c | +---------------------------+ c terminal kind of long-running process, web server or daemon. i'll move point there restart daemon, of time i'd swap between a , b. how can make convenient?
there's nothing built-in want. can use following code want (just customize regular expression match name of buffer(s) want avoid).
note: my-other-window doesn't implement features other-window does, left exercise reader.
my-other-window try switch window buffer doesn't match avoid-window-regexp. if there's no such window available, switches next one.
(require 'cl) (defvar avoid-window-regexp "^[0-9]$") (defun my-other-window () "similar 'other-window, try avoid windows buffers match avoid-window-regexp" (interactive) (let* ((window-list (delq (selected-window) (window-list))) (filtered-window-list (remove-if (lambda (w) (string-match-p avoid-window-regexp (buffer-name (window-buffer w)))) window-list))) (if filtered-window-list (select-window (car filtered-window-list)) (and window-list (select-window (car window-list)))))) and bind appropriately:
(global-set-key (kbd "c-x o") 'my-other-window)
Comments
Post a Comment