Open several buffers on start-up - emacs

Is it possible to force Emacs to open several buffers when I open a file (for example, in js-mode)?
emacs
You can see on the screenshot what I mean:
My JS-file on the left;
REPL on the top-right ("indium-run-node" command);
Inspector on the bottom-right ("C-c M-i" shortcut).
It would be great if I could do the same for Clojure-mode with another buffers (my file on the left and cider on the right).
Thanks in advance!

Related

How to open files and sub-folders in the same window in emacs?

I would like to open files/sub-folders in the same window which is already established in my emacs(I understand the difference between Emacs frames and windows).
Currently when I jump into Emacs I typically use C-x f in order to navigate to the folder I will be working inside of; once there I can look at the folder and its contents in Dired nicely.
However, when I then try and open a file or a sub-folder within this, by clicking or selecting it through navigating with my keyboard, it then spawns a new window beside my current one, making my screen extremely cluttered when I only wanted one window open.
How canI tell Emacs that when I am navigating in Dired I want new files and folders I move into to be opened in the window I am already working in so that I do not have to keep closing and re-opening random windows?
Apologies if this is a newbie question I am a fairly new emacs user and couldn't find this question posed elsewhere.
Try this:
(with-eval-after-load "dired"
(define-key dired-mode-map (kbd "<mouse-2>") #'dired-mouse-find-file)
(define-key dired-mode-map (kbd "<RET>") #'dired-find-file))
It behaved normally for me when I pressed <RET>, but the mouse click indeed opened another window. I used C-h k to see what the commands were named.

Emacs ElScreen only shows one tab

I have installed ElScreen using list-packages, and I have the below in the init.el file:
(require 'elscreen)
(elscreen-start)
but then when I open a file file-a.txt, it will only show me the current filename in tab bar. I open a another file file-b.txt, that the tab bar will only show one tab for file-b.txt - file-a.txt is not listed.
Is there any method of showing all open buffers - with the exception of * Messages * and * scratch *?
You're asking if there is a method to show all open buffers: here is a very easy one :D
you see the "Buffer" menu ? Click on it and click on the line of dashes
----------- <--- click here
buffer foo
*scratch*
We can detach the menu like this and have it floating around and staying always on top. You've got your answer !
Now my commentary on elscreen: with elscreen you have to ask to open a new tab with elscreen-create. See http://www.wikemacs.org/wiki/Elscreen for the commands and a discussion about some tweaks, like isolating buffers in their tab or per project
Last notes:
If you never want the scratch buffer:
Automatically closing the scratch buffer

Menu bar flashes for a moment when Emacs starts

With (menu-bar-mode 0) in my .emacs-file, Emacs (in a terminal) seems to be starting with the menu bar visible, and then within a fraction of a second, the bar disappears.
Is there a way to make Emacs not show the menu bar at all?
No: Emacs first starts by setting up its "frame" (which includes some initial display), then reads the .emacs file. That's why you see this flashing of the menu-bar. Emacs could read the .emacs first, but if the .emacs outputs any message or signals an error, there'd only be stderr to display it, whereas with the current setup, those messages are displayed in the minibuffer and the error can be caught in the "normal" way.
If you're runinng Linux (and I guess any system where Emacs runs in an X server), you can use X resources to tell Emacs you don't want the menu bar. Just put this in your ~/.Xresources file:
emacs.menuBar: off
These resources are used to customize frames appearance and are therefore read by Emacs at the very beginning.
See also:
Emacs manual: Menu Bars
Emacs manual: Table of Resources
man xrdb(1)

Open windows and load specific buffers in emacs lisp

I'm working on my .emacs configuration for clojure development.
What I want to happen is whenever I open a file called "project.clj" if there is no open buffer called "swank", split the window first horizontally then split the right side vertically. Then from the project.clj buffer run (clojure-jack-in) to start the REPL and (shell) to load a bash shell. When all of this is done I'd like the project.clj file to be in the left window, the shell to be in the top right window, and the REPL to be in the bottom right window.
Also if there's a way to get speedbar to open in a specified window rather than in a new frame, that would be awesome.
I guess my question is: is there a way to specify which window new buffers are opened in?
Ok, how about this answer via ibuffer or via grid-files-sq or GridLayout and (more unrelatedly) desktop remembering suggestions

How do I see the list of open files within Emacs? Or browse a directory within Emacs?

Most text editors have a navigation pane that lets you see all the files you currently have open. Or a pane that lets you browse a file directory.
How do I do this in Emacs?
Try Ctrl-x followed by Ctrl-b (in Emacs terminology C-x C-b) to list buffers.
C-x C-b will open the *Buffer List* buffer. In that buffer, you can navigate with the usual keys C-p, C-n, up-arrow, down-arrow, etc.
Browsing a directory is as simple as editing a file. Just open the directory instead of the file. On my Linux machine, C-x C-f /tmp ENTER opens a directory while C-x C-f /tmp/myfile ENTER opens a file.
C-x d accesses the directory editor. C-x C-f will do it as well if you give it a directory instead of a file.
There's also ibuffer-mode, which lets you deal with your open buffers in a very similar fashion to Dired: http://www.emacswiki.org/cgi-bin/wiki/IbufferMode
It's included with recent versions of Emacs, so you may not have to download it separately: try M-x ibuffer first.
M-x speedbar (speedbar website) will pop up an emacs frame that lists the contents of the current directory depending on the buffer you're in. The frame is small and stays out of the way so you can always glance at it while you're editing files. It also can filter this display based on file type using the variable speedbar-supported-extension-expressions. To see all the speedbar options, type M-x customize-group RET speedbar RET.
If you are interested in seeing a tree like structure for your directories, sources, methods etc try using emacs code browser http://ecb.sourceforge.net/.
C-x b TAB will give you an auto complete with all open buffers. Alternatively, click on the Buffers menu item if you are in a windowed version (not sure if there is a terminal equivalent of that).
EDIT: Also C-x C-f will let you open a file, and you can use TAB for autocomplete, then TAB again to view files/directories in that current directory (assuming the first tab did not autocomplete something).
When browsing directories with diredit, consider using a instead of RET to change directory.
Otherwise, each new directory is visited in a new buffer, which will clutter up you buffer list pretty quickly.
M-x shell opens a shell where you can browse directories
If you are just looking for files and not for any other buffers, look a the file-history.el
https://github.com/akicho8/file-history
I just discovered neotree package which displays the tree of all files from a root directory. Visiting the files in the neotree buffer opens them of switches to the buffer if already opened.
neotree can be installed either by
M-x package-install Ret neotree
or from its gitbub repository.
You could try the sidebar package
I often need to find another file in the "current directory", ie. the directory of the file I'm editing.
To quickly open this directory in diredit, I use:
C-x C-f C-j
You can also try http://code.google.com/p/emacs-nav/
Also, if you want to get rid of the list of open buffers, type C-x 1.