unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* ansi-term questions
@ 2005-08-11 17:12 Angelina Carlton
  0 siblings, 0 replies; 2+ messages in thread
From: Angelina Carlton @ 2005-08-11 17:12 UTC (permalink / raw)


Hello emacs users..

In M-x ansi-term I no longer have the use of my direction keys, up
prints A, down prints B and left/right print D/C 

Is there a way to get the direction keys to work properly? I need them
for bash history and for some other apps that I run in that term inside
emacs.

Second question, I use M-o to switch windows (M-x other-window)
Is it possible to make emacs skip the *ansi-term* window when I cycle my
windows?
I would like to have to explicitly call it with C-x b *ansi-term* and
have M-x other-window ignore it.

Thanks!
 
-- 
-----Angelina Carlton-----
orchid on irc.freenode.net
     brat@magma.ca
web:bzgirl.bakadigital.com
--------------------------

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ansi-term questions
       [not found] <mailman.3445.1123780765.20277.help-gnu-emacs@gnu.org>
@ 2005-08-12 11:02 ` Joe Wells
  0 siblings, 0 replies; 2+ messages in thread
From: Joe Wells @ 2005-08-12 11:02 UTC (permalink / raw)


>>>>> "Angelina" == Angelina Carlton <brat@magma.ca> 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 <swu@probe.att.com>

  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 <marca@ncsa.uiuc.edu>, nowadays a Netscape millionaire

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-12 11:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.3445.1123780765.20277.help-gnu-emacs@gnu.org>
2005-08-12 11:02 ` ansi-term questions Joe Wells
2005-08-11 17:12 Angelina Carlton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).