Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8558603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:51:00+00:00 2026-06-11T15:51:00+00:00

I use WindMove in Emacs 24.1 to move around multiple windows using keyboard shortcuts:

  • 0

I use WindMove in Emacs 24.1 to move around multiple windows using keyboard shortcuts:

(global-set-key (kbd "M-J") 'windmove-left)          ; move to window on the left
(global-set-key (kbd "M-L") 'windmove-right)         ; move "       "    the right
(global-set-key (kbd "M-I") 'windmove-up)            ; move "       "    above
(global-set-key (kbd "M-K") 'windmove-down);         ; move "       "    below

Is there a way to associate these WindMove keyboard shortcuts with char run mode on an ansi-term? I would like to avoid having to switch into line run mode for moving between windows. After a while it becomes tedious to type C-c C-k and C-c C-j back and forth to go into/leave the terminal.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:51:01+00:00Added an answer on June 11, 2026 at 3:51 pm

    The code below will work for you. It uses the Emacs advising mechanism, which allows a user to dynamically change a function’s behavior without modifying its source code directly. In this case, it is used to make the winmove-* functions run term-char-mode before executing their original definition. If you are also using other window-selecting functions, such as other-window, besides winmove-*, you can advise those functions in the same way. Refer to Advising Functions for details on the advising mechanism.

    The code also handles the issue related to the term-raw-map keymap. term-raw-map is not defined until term.el is fully loaded (or M-xansi-term is executed). So you should add the (define-key term-raw-map ...) forms to the term-load-hook hook, which is automatically run when term.el is loaded, instead of putting them at the top level of the init file.

    (global-set-key (kbd "M-J") 'windmove-left)
    (global-set-key (kbd "M-L") 'windmove-right)
    (global-set-key (kbd "M-I") 'windmove-up)
    (global-set-key (kbd "M-K") 'windmove-down)
    
    (defun ansi-term-char-mode ()
      (if (string= (buffer-name) "*ansi-term*")
        (term-char-mode)))
    
    (defadvice windmove-left (before windmove-left-ansi-term (&optional arg))
      (ansi-term-char-mode))
    
    (defadvice windmove-right (before windmove-right-ansi-term (&optional arg))
      (ansi-term-char-mode))
    
    (defadvice windmove-up (before windmove-up-ansi-term (&optional arg))
      (ansi-term-char-mode))
    
    (defadvice windmove-down (before windmove-down-ansi-term (&optional arg))
      (ansi-term-char-mode))
    
    (add-hook 'term-load-hook
      (lambda ()
        (define-key term-raw-map (kbd "M-J") 'windmove-left)
        (ad-activate 'windmove-left)
        (define-key term-raw-map (kbd "M-L") 'windmove-right)
        (ad-activate 'windmove-right)
        (define-key term-raw-map (kbd "M-I") 'windmove-up)
        (ad-activate 'windmove-up)
        (define-key term-raw-map (kbd "M-K") 'windmove-down)
        (ad-activate 'windmove-down)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

USE master GO DECLARE @DbName nvarchar(MAX) SET @DbName = N'DataBase' ALTER DATABASE @DbName SET
Use AES/Rijndael or any symmetric encryption. Encrypt the hidden value using itself as the
Use http://jobs.sitesixteen.com/ for reference. I'm using YQL for the city, state auto-complete. IF you
'''use Jython''' import shutil print dir(shutil) There is no, shutil.move, how does one move
USE [Fk_Test2] GO /****** Object: Table [dbo].[Owners] Script Date: 08/20/2010 16:52:44 ******/ SET ANSI_NULLS
Use case: I'm using data templates to match a View to a ViewModel. Data
Use Case Show a photo uploaded by the user in a square box with
use C#,want to upload excel file on google doc. bellow syntax use to upload
use Text::Table; my $tb = Text::Table->new(Planet,Radius\nkm,Density\ng/cm^3); $tb->load( [ Mercury,2360,3.7], [ Mercury,2360,3.7], [ Mercury,2360,3.7], );
use strict; use warnings; use Time::HiRes qw(sleep); use Test::WWW::Selenium; use Test::More no_plan; use Test::Exception;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.