Emacs move between split windows not C+x 0 - emacs

If I move between split windows as in this SO answer https://stackoverflow.com/a/4671868/461887
C-x o
It closes the left hand side buffer/split when doing this. I just want to hop between the splits not close the current split.
How do I do this?

Make sure you are hitting the letter 'o', not the number 0. 0 will close the current window, and 'o' will switch to other window. ('window' in emacs terminology is what you are referring to as a 'buffer' or 'split')
If that doesn't work, try loading emacs with '-q' at the command line which will disable loading of any customizations in your initialization file that might be interfering with emacs' default keybindings.
emacs -q
You can also try C-h b which will pop up a buffer which describes all of your keybindings - search this for C-x o to see what it is bound to.

C-x o It should not close any window, by default.
What does C-h k C-x o say that key is bound to? Can you see what, in your init file binds that command?
If not then recursively bisect your init file to find out what you are doing that causes the closing-window behavior you do not like.
You can use comment-region to comment out 1/2 of your init file, then 3/4, 7/8, 15/16,... until you have narrowed it down to the culprit. You can use C-u with comment-region to uncomment.

Related

How can I open multiple minibuffers in emacs?

Say I'm entering a command in the minibuffer, and I realize that I need to remember the path to some file as a param to my command. Can I instead of cancelling the command I started entering to do C-x d or to go to a shell, click (click? what's that?) on a secondary mini buffer to run such command?
You are looking for "recursive editing", specifically the bit discussed in the Recursive Minibuffer docs:
(setq enable-recursive-minibuffers t)
(minibuffer-depth-indicate-mode 1)
The latter line makes things the recursive editing less confusing, by showing the level of recursion. E.g C-x C-f then C-x b will appear like this:

emacs with nrepl.el for Clojure - how to hide a popup buffer?

I'm using emacs 23 (acquamacs) and have installed nrepl.el.
I've evaluated some Clojure code with
C-c C-p
(this key combo is to Evaluate the form preceding point and display the result in a popup buffer.)
Running it has produced a nice popup buffer for me to see the results.
How do I hide this popup buffer? (I don't want to kill it - just get my fullscreen back).
FYI Re this command - I've run this with
C-h k C-c C-p
and got
^C ^P runs the command nrepl-pprint-eval-last-expression, which is an interactive compiled Lisp function in `nrepl.el'.
It is bound to ^C ^P, <menu-bar> <nREPL> <Eval last expression in popup buffer>.
(nrepl-pprint-eval-last-expression)
Evaluate the expression preceding point and pprint its value in a popup buffer.
You haven't provided enough information for anyone to test (that's not a standard global binding), and you haven't even indicated whether the new window is selected; but there's a generic solution which will work regardless.
Add (winner-mode 1) to your init file, and then you can always use C-c<left> to undo the most recent window configuration change (or changes plural, if you repeat the command).
Either that or just press q. I just tried it out with the help buffer and it dismisses the window but not the buffer. However, popup buffers in the style of ac-nrepl does for its autocompletion are meant to simply be dismissed
Always, when asking Emacs questions, say what the key sequence does. C-c C-p does nothing here. TO find out what it does press C-h k C-c C-p and report back. In this case we're invoking 'describe-key and then telling it to describe what C-c C-p does.

What are the "Programmer shortcuts" in emacs?

I would like to know what are all the programmer-useful shortcuts that exists in emacs.
I come from a netbeans background and I am trying to make myself comfortable with emacs -text only environment. So I am looking at shortcuts for "refactoring" the code, "auto-completion", "go to definition" etc.
How can all these be achieved in emacs ? What are other programmer-useful shortcuts ?
I'll be using emacs basically for LAMP, javascript, C, C++.
ps - you can safely assume that I know how to open a file, save a file, navigate and whatever is in the tutorial in emacs.
For auto-completion, use etags with M-xtags-search or M-xetags-select-find-tag. I use macros often to do repetitive tasks. C-x(<string of useful tasks>C-x). Also, M-xalign-regexp to beautify the code and make it more readable.
You should find most of the most used features by Emacs users in this question's answers here at Stackoverflow.
Check this site
Some the important keybindings that are not there in the tutorial are:
Previous matching bracket: C-M-b (if it doesn't work, try ESC followed by C-b)
Next matching bracket: C-M-f (or ESC C-f)
Go to start of block: C-M-u
Go to end of block: C-M-d
Start of function: C-M-a
End of function: C-M-e
Outline mode: C-u 1 C-x $ (C-x $ to revert)
Newspaper mode: C-x 3 M-x follow-mode (especially useful with today's wide-screen monitors!)
Vertical Copy
Sometimes you will need to copy a vertical patch of data, e.g. one column in a table. First press C- where you want to start copying. Then go to the end of the column and press C-x r k. To paste the column press C-x r y. (If you don't want to delete original column, just press C-_ there once to restore it and then press C-x r y at target.)
To start, here is one :
Meta - / -> does code completion
M-x diff-buffer-with-file
M-x revert-buffer
When working with versioning (I use git), M-x diff-buffer-with-file is really useful. When you have a file open in a buffer in emacs, then you do a git checkout or some other action that touches that file, emacs will complain at you when you try to edit the buffer. M-x diff-buffer-with-file is helpful to see if you will break anything by keeping what's in the buffer. If something has changed and you want to grab the file from disc and put it in the buffer, do M-x revert-buffer.

In Emacs, how to go back to previous line position after using semantic Jump to Symbol?

I know how to go to a variable definition in Emacs using semantic-mode. It works well in a single file (I think it doesn't work if the definition is in another file). Using C-c , j, I can go to the definition of the variable, but, how do I jump back to the previous line? Currently I use display Symref C-c , g, and select the displayed symref.
Is there any straight method?
Use:
C-u C-space or C-u C-#
If you want to navigate back between buffers, you can use:
C-x C-space or C-x C-#
This makes Emacs jump to the mark (and set the mark from position popped off the local mark ring) which has usually been set by a previous jump command.

A few Emacs noob questions

Sorry if these are obvious answers but I've googled around and can't seem to find what I'm looking for.
When I have multiple files open in split screen mode using C-x C-3 how do I close JUST the window I'm currently in and no other?
I'm using Ruby and it doesn't seem to auto indent my def end correctly.. is there a Ruby plugin that will fix this?
Is there a command to go to a specific line?
How do I interpret ruby from within emacs?
1. When I have multiple files open in split screen mode using C-x C-3 how do I close JUST the window I'm currently in and no other?
To close current view C-x 0. (Btw, I think you're referring to C-x 3.)
2. I'm using Ruby and it doesn't seem to auto indent my def end correctly.. is there a Ruby plugin that will fix this?
Have a look at
ruby-mode for emacs
RubyMode
3. Is there a command to go to a specific line?
Sure, M-g g (or M-x goto-line)
4. How do I interpret ruby from within emacs?
Don't know. You could try rubydebug.
You can also see C-h b which will give you key binding for the current-buffer to give you a lot of additional things that you might need. Once you install any Ruby Mode, you can also use C-h m to see key binding for that specific modes in your current buffer, including ruby mode.
for Q3) in addition you might want to know
C-h w COMMAND
will always show you the key binding for a funcion
C-h w goto-line RET
goto-line is on M-g g, M-g M-g, <menu-bar> <edit> <goto> <go-to-line>
for Q4) you could start a shell in a buffer, either M-x eshell or M-x shell and the simply run your script there.
Using the eshell configuration in [1] you can easily switch between the shell and your script source (pressing C-z).
[1] http://www.emacswiki.org/alex/2008-08-19_Emacs_on_Windows