User Tools

Site Tools


emacs

This is an old revision of the document!


Emacs Stuff

This is my third try to get into emacs. Is difficult with all this keyboard related commands, but if you take it with love it kind of works.

Configuring emacs to get some nice feature for programming with python

sources:
http://venkys-dotplan.blogspot.com/2009/05/complete-newbies-guide-to-emacs-and.html
http://www.enigmacurry.com/2009/01/21/autocompleteel-python-code-completion-in-emacs/

  • Get emacs 22
  • Highlighting is integrated in emacs and should work automatically upon file openning. (I think is called python mode)
  • For editing and running python programs from emacs:
    • Get emacs.py from here http://www.loveshack.ukfsn.org/emacs/emacs.py and put it in /usr/share/emacs/22.1/etc overwriting the included version. (don't forget to backup the original file)
    • While editing type C-c C-z , this starts up a window running python
    • From the editor window press C-c C-l, this should execute the python program.
  • For switching between windows press C-x o
  • To start emacs in console mode type emacs -nw
  • For autoindentation add the following to the file “.emacs” :

(add-hook 'python-mode-hook '(lambda () (define-key python-mode-map “\C-m” 'newline-and-indent)))

  • For autocompletition during edition, follow the instructions from http://www.enigmacurry.com/2009/01/21/autocompleteel-python-code-completion-in-emacs/. As May-2009 you need to get the development versions of rope, ropemacs, ropemode. For installing this packages you need easy_install, you can get this application by installing python-setuptools debian package. You need to find AutoComplete.el version 0.1.0, 0.2.0 doesn't work yet with the rest. The other dependencies you can get from debian unstable. Using this is simple, just press TAB when you need to autocomplete something, this is really cool, specially because it runs in console mode.
  • If you install rope stuff then getting the python documentation should work. For getting the rope commands help press C-c d .

Keybindings emacs command list

This list is based on what I feel I need from an editor right now (may-2009), hope it can be useful for someone.

C-x c - Exit
C-x o - Change window
C-k - Delete rest of line
C-e - End of line
C-a - Line start
C-s - Save changes
C-x 0 - Closes the current window
C-x 1 - Closes all the other windows
C-c C-z - Starts python console
C-x C-l - Execute python program
C-c d - Over something gives you the documentations
C-c C-h - Help for the minor and major mode (yas, rope, python)
C-g - Quits what you are doing
C-x r space name - Names a position
C-x r j name - Jumps to a named position
C-x ( - Start recording commands (macro)
C-x ) - Stops recording commands (macro)
C-x e - Executes macro (continue pressing e executes the macro again and again)

Marking

M-x transient-mark-mode
C-M-space - “Marks what you want”
M-h - Marks current paragraph
C-x r s - Saves the marked region to a register

External links with more commands are:
http://www.cs.rutgers.edu/LCSR-Computing/some-docs/emacs-chart.html
http://sip.clarku.edu/tutorials/intro_emacs.html
http://ccrma.stanford.edu/guides/package/emacs/emacs.html
http://www.cs.cmu.edu/cgi-bin/info2www?(emacs)Mark

emacs.1242914393.txt.gz · Last modified: 2021/02/01 05:55 (external edit)