The tab indent in emacs ipython shell - emacs

The environment is Emacs 24.1.1 on Ubuntu. using Ipython for python programming.
The auto indent is works well when running ipython command on shell directly, but when i come to emacs run ipython there is no auto indent any more. and even worse when i type TAB it will prompt the Completion buffer.I also have searched this issue many times but still not found a practical method. as a result i have to enter space manually.
anyone could help to resolve this issue ?
1. auto indent on emacs ipython shell
2. disable completion on emacs ipython shell separately.keep the Tab-completion work when i am not in ipython interactive shell.

In emacs you can use python-mode, and from there send the code to *REPL* buffer with C-c C-c.
When you send the buffer for the first time, it asks you what executable you use for python, so you can use ipython, or other one.

Any invocation of ipython-shell should do a correct setup.
Please file a bug-report.
If running python-mode.el -- modeline shows "Py" --
please checkout current trunk first
When bazaar is available
bzr branch lp:python-mode

Related

Launching ipython in emacs undesireably moves my windows

When I launch ipython in emacs, it rearranges all the windows. I find this annoying. Yet experimentation with my .emacs file yielded no solution. Where should I look? What should I suspect? What can I query?
With python-mode.el the behaviour is controlled by customizable variable py-split-window-on-execute.
For changes on the fly exist commands py-split-window-on-execute-off, py-split-window-on-execute-on

Emacs shell behavior

I am using cygwin on windows 7. I have a question regarding the Emacs shell.
Whenever I use the shell inside of the Emacs(M-x shell)
It echo pwd directory after prints out the result.
I found it very annoying since it distracts me.
e.g.
$ ls
workspace
^[]0;~/cs61bl^G
myname#pc ~/cs61bl
Is there any way to remove these lines?
^[]0;~/cs61bl^G
myname#pc ~/cs61bl
When using Emacs, try using the eshell: M-x eshell. The eshell does not suffer from this problem.
You might be looking for "shell-dirtrack-mode". You can either do an M-x shell-dirtrack-toggle or (shell-dirtrack-mode 1) in your init file. Recent emacs versions seem to disable it by default.
There is this file http://www.emacswiki.org/emacs/setup-cygwin.el that simplifies setup of various packages in Emacs (including shell) to use cygwin. Also try not to use ANSI sequences in your PS1 prompt because Emacs shell mode wouldn't interpret them, something like
export PS1="\h \W\$ "
should do.

How Can I Get MinTTY (Cygwin Terminal) to Open Emacs in a New Window?

I can't figure out why this isn't easy to find on Google, but after searching for about 10 minutes, I just decided to give up and post here.
The subject basically says it all. I'm running MinTTY as a cygwin terminal on a Windows XP desktop. All I want to do is have emacs open up in a new window rather than inside my terminal. What would be best is a switch for this, so I could toggle it depending on my current needs. This seems like something that would be useful to a lot of people, and I know I've done it before on Linux boxes, so I imagine there must be a way to do this in cygwin too. Anyone know how?
Just start a new mintty, telling it to invoke emacs:
mintty emacs
There are a couple of scenarios that you might clarify:
Running the cygwin version of emacs within a standard windows environment will call emacs within the current shell
If the Cygwin X-Windows server (i.e., “XWin Server”) has been started and the DISPLAY environment variable has been set in the mintty terminal (e.g., export DISPLAY=":0"), calling emacs will start it in its own window.
running the Windows version of emacs within the cygwin terminal should launch the new frame you are seeking.
If you want a separate emacs 'window', you would be best served by installing the Windows native version of emacs (I use the gnu emacs precompiled binaries), and calling it from the cygwin terminal.

Coding in Emacs shell?

I am using shell in my emacs version 22.2.1 (debian stable repos) and it has some kind of broken coding. For example, if I run `ls' command, output is
[0m[01;34margouml-0.30.2[0m
not "argouml-0.30.2" as normal. I have tried commands C-x RET p utf-8 and so others but without any effect. I have properly generated utf-8 locales and everywhere else in emacs coding works perfect. Does anybody knows what may be wrong with it?
Your terminal type in the shell is set incorrectly; those escapes are for colors, but the emacs shell doesn't support them. Try M-x term instead for better support.
You can also try M-x ansi-term, or even download Multi term and try that too.
Links:
Ansi Term
Multi Term

.emacs Edit to Always Start Emacs in Terminal Mode?

I use emacs as my editor-of-choice, and since I'm doing a lot of work in a terminal I always run emacs as
emacs -nw
so that it runs in the terminal instead of in a window.
I'd like to just run emacs and have it know that it should run in a terminal. My question is - how do I edit my .emacs file so that this is the default behavior?
You can't do this in the .emacs file. By the time that file is being parsed, the "chosen" emacs binary is already running.
You can install the emacs-nox package as one commenter suggests, or create an alias in your shell so that "emacs" is always treated as "emacs -nw".
Randy
I'm using a bash alias instead of .emacs to do that.
Add this line to your ~/.bashrc.
alias emacs='emacs -nw'
There is any easy way to solve the problem in general that has nothing to do with emacs at all and will work for any program that can choose between running in the console vs X:
unset DISPLAY
Of course you may not want to put that in your configuration file to be applied globally to all your shell sessions, so if you want it to apply to only emacs, then either call it from the command line like this:
DISPLAY= emacs
note the space!!! if you leave the space out it means you're setting the DISPLAY to emacs instead of setting DISPLAY to nothing... this command is a shorthand for:
DISPLAY=; emacs
So either use the above from the command line(s) or put that in a wrapper script that would look something like this:
#!/bin/bash
unset DISPLAY
exec emacs
I recommend the exec there because it will replace your wrapper script with emacs; to see the difference between the two you can run:
pstree -p
When I was first setting up a "emacs -nw" alias for emacs in windows I got stuck in a situation where I thought tototoshi's explanation hadn't worked. Yet all that was required was a restart of my terminal. Therefore, i think its worth mentioning that in windows (at least) if you are using emacs within the git bash terminal to create the .bashrc file and add "alias emacs='emacs -nw" to it (as tototoshi mentions) you have to close and reopen your terminal for it to work.