[ACCEPTED]-How to switch to a different buffer from a terminal buffer-emacs23
In term-mode, any regular C-x whatever
keybinding becomes 1 C-c whatever
instead.
I'm not sure I understand your question. If 6 you run M-x terminal, most of the key events are sent 5 to the underlying terminal, so the standard 4 C-x o binding and your M-Left are not available in 3 the terminal.
Try using M-x shell to get a shell in 2 one of the windows, and the navigation bindings 1 you set up should still work.
In term-mode, type C-c b RET
to switch to some other 2 buffer.
That does what C-x b RET normally 1 does.
This should do the trick to get C-x b working. You 7 may have to add bindings for any custom 6 move commands.
(add-hook 'term-mode-hook
(lambda ()
;; C-x is the prefix command, rather than C-c
(term-set-escape-char ?\C-x)
(define-key term-raw-map "\M-y" 'yank-pop)
(define-key term-raw-map "\M-w" 'kill-ring-save)))
BTW, there is a big difference 5 between shell-mode and term-mode. The former 4 integrates better with emacs (e.g. cd command). The 3 latter is a full terminal emulation and 2 can handle curses programs. They both have 1 their place.
For a more generic answer dealing with emacs' windows, you 2 can look at windmove
, which started shipping with 1 Emacs circa Emacs 22, I believe:
;;; Commentary:
;;
;; This package defines a set of routines, windmove-{left,up,right,
;; down}, for selection of windows in a frame geometrically. For
;; example, `windmove-right' selects the window immediately to the
;; right of the currently-selected one. This functionality is similar
;; to the window-selection controls of the BRIEF editor of yore.
;;
;; One subtle point is what happens when the window to the right has
;; been split vertically; for example, consider a call to
;; `windmove-right' in this setup:
;;
;; -------------
;; | | A |
;; | | |
;; | |-----
;; | * | | (* is point in the currently
;; | | B | selected window)
;; | | |
;; -------------
;;
;; There are (at least) three reasonable things to do:
;; (1) Always move to the window to the right of the top edge of the
;; selected window; in this case, this policy selects A.
;; (2) Always move to the window to the right of the bottom edge of
;; the selected window; in this case, this policy selects B.
;; (3) Move to the window to the right of point in the selected
;; window. This may select either A or B, depending on the
;; position of point; in the illustrated example, it would select
;; B.
;;
;; Similar issues arise for all the movement functions. Windmove
;; resolves this problem by allowing the user to specify behavior
;; through a prefix argument. The cases are thus:
;; * if no argument is given to the movement functions, or the
;; argument given is zero, movement is relative to point;
;; * if a positive argument is given, movement is relative to the top
;; or left edge of the selected window, depending on whether the
;; movement is to be horizontal or vertical;
;; * if a negative argument is given, movement is relative to the
;; bottom or right edge of the selected window, depending on whether
;; the movement is to be horizontal or vertical.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.