Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to get a terminal to work in Emacs

I've been having a lot of problems with emacs and trying to get the terminal to work with:

    M-x term

I installed cygwin and I fixed up my .emacs to include the paths:

    (setenv "PATH" (concat "c:/cygwin/bin;" (getenv "PATH")))
    (setq exec-path (cons "c:/cygwin/bin" exec-path))
    (require 'cygwin-mount)
    (cygwin-mount-activate)
    (add-hook 'comint-output-filter-functions
    'shell-strip-ctrl-m nil t)
    (add-hook 'comint-output-filter-functions
    'comint-watch-for-password-prompt nil t)
    (setq explicit-shell-file-name "bash.exe")
    ;; For subprocesses invoked via the shell
    ;; (e.g., "shell -c command")
    (setq shell-file-name explicit-shell-file-name)

However now when I launch terminal, it seems to give nothing but a blank screen and "hang"

When I launch:

    M-x shell

It does indeed launch the bash shell and flying around the file directories is okay (with cd, ls, cp, rm, etc.). However, when I do something like try to open up a Python shell, it again hands, and I type in ... and the shell crashes. Is there anything significantly wrong with what I am doing or perhaps somebody could direct me towards solutions online? (I've looked quite extensively.)

SSH also gives the error:

"Pseudo-terminal will not be allocated because stdin is not a terminal."

like image 505
mduvall Avatar asked Dec 29 '25 02:12

mduvall


1 Answers

Are you using the default 'Cygwin Bash Shell'? This is the one that launches inside a Windows cmd shell, and you can't drag to resize the screen. This shell is horribly broken, because of the underlying Windows component. Try using something like rxvt, or one of the putty forks.

If this is all set, then the issue is likely a termcap issue. Some people set their Cygwin TERM variable to 'xterm', because many remote machines don't have termcaps installed for things like rxvt-cygwin-native. Overridding it locally will cause problems with programs that attempt a range of terminal operations.

In your ~/.bash_profile, you can set your terminal to the following. export TERM=rxvt-cygwin-native

See my rxvt install guide and tips for more on rxvt.

like image 111
brianegge Avatar answered Dec 31 '25 17:12

brianegge