简体   繁体   中英

Jumping to a specified window in Emacs doesn't work when done programatically

I am trying to select the third window (I have opened 6 in my frame) in Emacs.

The problem is that this:

(select-window 3) 

doesn't work.

It throws this error in debugger:

(wrong-type-argument window-live-p 3)

How to make it work?

select-window takes a window object as argument, not a number. The function window-list gives you a list of window objects in the current frame. You can select one of them to pass to select-window , eg

(select-window (nth 2 (window-list)))

will select the window that is the third[1] element of the list that window-list returns.

Do Ch f nth and Ch f window-list for more information on these functions.


[1] Note that list elements are indexed from 0.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM