Quote:
Originally posted by vdogvictor
edit: And how can I compile from within Emacs?
|
Within emacs:
frist off, if you open your file, at the bottom of the window (in the black line) it looks like this:
edit_status\write_status FileName (mode)--line_number--cursor_location%
if the mode is not java, you can change it by using the command:
M-x java-mode
if the syntax is not highlighted, you can turn it on with:
M-x global-font-lock-mode
to compile within emacs, the easiest way is to open a shell within emacs:
M-x shell
... and then just type your compile string at the command line. Personally, I prefer to use alt-tab to switch between windows and just go back and forth between a shell and the emacs window.
to switch between your .java file buffer and the shell buffer:
M-x b (then optionally type the name of the buffer if it is not shown as the default)
To open files in emacs:
C-x f
To save:
C-x C-s
To save as:
C-x C-w
In all the above examples, 'M' means "meta key" which is usuually the "alt" key and/or the "esc" key. 'C' means the control key. a '-' means both at the same time. So, to save, you would hit cntl and x followed by cntl and s. To open, you'd hit cntl and x followed by f (by itself).
Emacs also supports auto completeion, so if you type M-x ja<tab> it will show you all of the possible options. This goes the same for file names, but you'll need two tabs to get the list.
YOu can also show two buffers at one time with:
M-x 2
and switch in between the two open buffers with
M-x o (or just use the mouse)
That should be enough to get you started.
edit: oh, you'll probably also want to know:
C-k "kills" a line of text from the cursor to the newline
C-w cuts the current region to the kill ring
C-y "yanks" the text back from the kill ring - kinda like paste from a C-k or C-w
regions are stared with C-<space> and then go to the cursor location...
So say I want to take "bar" out of this line:
foo bar gah
I would put my cursor at the beginning of "bar", then C-<space> to start a region, then C-<right arraow> to the end of "bar", then C-w to cut out "bar"
Then I move the cursor somewhere else & do a C-y to paste "bar" at the new cursor location.
.... oh yeah... and..
if you're going to move code between Linux & windows, the tabs are often different, so set a region to your entire file (from start to end) and use:
M-x untabify
to change all the tabs to spaces - then your projects will look the same regardless of the viewing editor's tab stops.