From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joe Wells Newsgroups: gmane.emacs.help Subject: Re: ansi-term questions Date: 12 Aug 2005 07:02:34 -0400 Organization: Boston University CAS Computer Science Dept. Message-ID: References: NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1123844905 23198 80.91.229.2 (12 Aug 2005 11:08:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 12 Aug 2005 11:08:25 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 12 13:08:24 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E3XNR-0005jb-Hq for geh-help-gnu-emacs@m.gmane.org; Fri, 12 Aug 2005 13:07:05 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E3XQe-0000j2-LE for geh-help-gnu-emacs@m.gmane.org; Fri, 12 Aug 2005 07:10:24 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!bloom-beacon.mit.edu!news.bu.edu!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 76 Original-X-Trace: news3.bu.edu 1123844567 27255 128.197.10.4 (12 Aug 2005 11:02:47 GMT) Original-X-Complaints-To: news@bu.edu X-no-archive: yes X-Newsreader: Red Gnus v0.81/Emacs 20.7 Original-Xref: shelby.stanford.edu gnu.emacs.help:133151 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org X-Gmane-Expiry: 2005-08-26 Xref: news.gmane.org gmane.emacs.help:28676 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:28676 >>>>> "Angelina" == Angelina Carlton writes: Angelina> Hello emacs users.. Angelina> In M-x ansi-term I no longer have the use of my direction keys, up Angelina> prints A, down prints B and left/right print D/C Angelina> Is there a way to get the direction keys to work properly? I need them Angelina> for bash history and for some other apps that I run in that term inside Angelina> emacs. See the discussion in term.el where it says: ;; Which would be better: "\e[A" or "\eOA"? readline accepts either. There are examples of how you can configure it like this: (defun term-send-up () (interactive) (term-send-raw-string "\eOA")) Angelina> Second question, I use M-o to switch windows (M-x other-window) Angelina> Is it possible to make emacs skip the *ansi-term* window when I cycle my Angelina> windows? Angelina> I would like to have to explicitly call it with C-x b *ansi-term* and Angelina> have M-x other-window ignore it. Here you go: (defvar my-other-window-excluded-buffer-regexp "\\`\\*.*term.*\\*\\'") (defun my-other-window (arg &optional all-frames) (interactive "p") (let* ((window (selected-window)) (count (abs arg)) (direction (if (< arg 0) 'previous-window 'next-window))) (while (> count 0) (while (progn (setq window (funcall direction window nil all-frames)) (and (string-match my-other-window-excluded-buffer-regexp (buffer-name (window-buffer window))) ;; need this to avoid possible infinite loop: (not (equal window (selected-window)))))) (setq count (1- count))) (select-window window) nil)) (define-key global-map [remap other-window] 'my-other-window) A cute programming exercise; it took me about 10 minutes, which was much longer than I expected because I had to copy the C code definition of other-window and turn it into Lisp. If it had been written in Lisp, I could have done something simpler by using defadvice on next-window and previous-window. Angelina> Thanks! You're welcome. Hope this helps. -- Joe "Did anyone write a function to switch to a buffer which is closest to the top of buffer stack and not displayed in all existing screens? -- Chi-Sharn Wu No, but I wrote one once to switch to a buffer in a screen that lies under all other screens except for the screen containing a window that held a buffer that was below the original buffer in the buffer stack, unless the window was in a screen that was currently iconified and the buffer was unmodified but above any other buffer that was contained in more than one window in the buffer stack, in which case I looped through the screen list looking for windows holding buffers that were in windows that were iconified but raised over all other screens holding windows with buffers that were shown in multiple windows with buffers that were only in one screen." -- Marc Andreessen , nowadays a Netscape millionaire