112 points · by rachbelaid · 13y ago · 54 comments
Take a look here at my dotfiles to see how to use Rope/Ropemode/Ropemacs to get a Python-aware Emacs environment with the goodies that entails:
https://github.com/bitemyapp/dotfiles/
Edit: Try to ignore or not be daunted by the other directories, my Emacs setup is well maintained but very old and has over 400,000 LOC.
Using Emacs is a bit of a paradigm shift in text editing, so you should expect a bit more work up front for great results later on. Going through the tutorial and learning the basic vocabulary and commands takes care of most of that up-front cost and should not take long. I think it took me less than two weeks of fairly casual use.
Part of the beauty is that most of the things in the blog are not limited to Python. All the general text-editing stuff trivially transfers to other languages you may want to learn. And Emacs supports any language you do want to learn to one extent or the other. For some languages, Emacs is even the only option!
So you should consider going through at least the beginning of all this even if you're not interested in Python per se.
Also, check out some of the Emacs Rocks![1] videos. I keep on recommending them because they are awesome. They really show off why Emacs is truly magical.
Which ones would those be? Common Lisp using SLIME?
But OrgMode is probably one of the most powerful and unique emacs modes. There is nothing like it anywhere else.
Once you go OrgMode, there is no going back.
You could write Common Lisp in Notepad if you really wanted to. I do not think using Agda would be at all practical without Emacs.
[1]: http://wiki.portal.chalmers.se/agda/pmwiki.php
[2]: http://coq.inria.fr/
If that doesn't work, you might have to find the variable which specifies which buffer has the current running Python process. You should then be able to just change that to a remote shell as above.
You can also automate all of this with a bit of elisp. After you've played around with it a bit, ask around on #emacs--I'm sure there are people there both willing and able to help you out.
I understand what you're saying in the rest of your comment though -- basically I will have to learn some elisp. Thanks for the help.
My goal was to connect a local emacsclient to a remote emacs server over TCP... if this were possible, I would be fairly ecstatic.
Thanks for the tip though.
Being a fully programmable work environment.
Edit: I used ST2 for about a month. The Python was neat but it's going to fade away eventually.
Which goes back to my original point.
Seen lots of IDEs and editors come and go. Nothing new here, just more polish than the last guy.
[1]: demo at http://www.youtube.com/watch?v=dP1xVpMPn8M
Though neither Vim nor Emacs currently provide all the APIs necessary for elastic tabstops plugins, either. They only have the possible advantage that since they’re open source, such support is a little more likely to be added.
The Java world is a great example of tool-driving-workflow. IDEs are massive, and you are generally constrained to a code-build process as thought out by the vendor. Generally speaking, the tools have good "average" efficiency. Anybody who has used the tool could sit in front of anybody else's and be as efficient.
Emacs is obviously the other end. My workflow influences the tool in so many ways that it would be nearly impossible for somebody to sit in front of my Emacs and use it efficiently. However, I am far more efficient than within any IDE, because I have bent the tool to my will.
Something like Sublime doesn't necessarily prohibit you from building a workflow and tools around it. It would just have include the command line as the programmable part.
EDIT: Specifics. A simple example: I was editing a bunch of wiki pages, do a combination of creating, formatting and moving content. I built a small set of tools to handle the repetitive parts. It is the aggregation of all the small things like this that makes the tool so much more valuable.
At work I have to use a proprietary version control and build system (don't ask), and it was relatively easy to hook it into Emacs.
We also have an internal website with a cross referenced, hyperlinked version of the code. I have a function to launch a browser and go to the cross reference site for the symbol under the cursor.
One of our coding conventions is that the .h file for a class named ClassName is ClassName.h. When I use a class I haven't used before, I have a keyboard shortcut to add the #include for me. If I miss one, the compile error jumps right to the class name and I use the keyboard shortcut - it takes about 2 seconds.
I have a function that will take whatever text I've highlighted and launch a web browser doing a search in DuckDuckGo for that text.
I have a function to run the selected text through Python and replace the selection with the result. If I type 4+5 I can select it, press Ctrl + Alt + P and it gets replaced with 9.
By default Emacs opens *.h files in C mode. I have a function that checks whether there's more .cpp files or .c files in the same directory and sets C++ or C mode appropriately. I replaced the default behavior with my version, so it happens automatically.
I could go on all day.
Having a fully programmable editor means that if I ever find myself doing the same thing more than a few times, I can automate it. It means that if I don't like the way Emacs does something I can change it. Customization in most other editors is limited by the editor's plugin API. There's no such limitation in Emacs.
Everything else is done in emacs because it is the better editor. Just wish it was pretty.
http://giuliofidente.com/2013/04/getting-to-know-and-use-ema...
In there I tried to address also other issues like saving the backup files out of the working dir, show the line numbers, highlight long lines.
You can split tmux tabs so that you can have vim up in one pane on a 'tab' and python running in another pane in the same 'tab'. Both tmux and screen have decent copy/paste functionality that mimics vim's movement behaviour to some degree. (Tmux also has scriptable sessions, if you like different workflows for different types of projects)
If you want a nice vim setup SPF-13 is a decent place to start. There are tmux configs everywhere. Also Ipython does a lot for you as far as completion, looking at documentation, and the like.
I think that's kind of what you're after, sorry if it's not.
It has Klen's python-mode plugin as a submodule: https://github.com/klen/python-mode
Python-mode provides awesome sause :) To get the repo, clone it recursively, or you won't have all the submodules. `git clone --recursive https://github.com/srathbun/vim-plugins.git ~/.vim`
(It's also a bit in flux as I migrate to tpope/vim-dispatch)
I can try elaborating feature-wise when I get home.