Emacs: add list of all opened files to mode-line? - emacs

I'd like the mode-line to show names of all opened files (maybe truncated if too long), similar to browser tabs.
I'd like to have this because I have 2 shortcuts for switching to prev/next user buffer, and it would be more convenient if I know the list of opened files (without typing C-x b).
Is there any package available to do that?

Related

Vscode open a file without dialog

Is there a way to quickly open a specific file (Console.R as a example) by a keyboard without the appearance of a dialog (like Ctrl + o or Ctrl + p, which pop up a dialog to select which file)?
I have a specific file and just want to open it quickly. For R language terminal is lack of many useful characteristics (like auto-completion and syntax highlighting), I want to allocate a specific file (like Console.R) as the input of R terminal but I don't find a way to open a specific file quickly.
Sorry, this is duplicated with Keybinding to open a specific file in vscode and vscode keyboard shortcuts to specific files.

How to navigate through a lot of files in Eclipse without opening them

In some popular code editors and IDEs such as Sublime Text and Xcode, we can swiftly navigate through lots of code files by a single click without opening them. This is an advantage when we look into many parts of the code base scattered across the projects but nevertheless want to avoid opening too many tabs, which affects performance on slow machines. Does anyone know such a "navigating-without-opening" functionality in Eclipse?
I understand that Eclipse does provide a lot of useful shortcut keys to switch between opened tabs and classes in the project, but what I am looking for is the functionality whereby I can switch between files without opening them in a new tab by a single click (and preferably open specific files by double clicks when we want to keep them opened in new tabs).
EDIT:
I am not searching specific classes or methods. Rather, I would like to peek project files one by one to grasp the structures of the application which contains hundreds of files. In Sublime Text and Xcode, unlike in Eclipse, when one clicks file names in the project explorer only once, the files get opened in a "temporary tab" which automatically closes when we single-click another file. For example, in the following screenshots, when I single-click ToDoListPane.java in Sublime Text or CNBackgroundView.h in Xcode, the files are opened in new temporary tabs, but once another file such as HelloWorldSpring.java or CNAppDelegate.m is clicked once, then the contents in the temporary tabs are switched to those of HelloWorldSpring.java or CNAppDelegate.m without additional tabs being created.
Use Ctrl+Shift+R to search files by name (pattern).
If you know a string that is inside of the files you seek, you can use Search -> File Search (there is a button in the toolbar for that).
Related:
http://www.vogella.com/tutorials/EclipseShortcuts/article.html
http://eclipse.dzone.com/news/effective-eclipse-shortcut-key
http://www.shortcutworld.com/en/win/Eclipse.html
[EDIT] For exploring unknown code, try the "Java Browsing Perspective", it's optimized for this use case.
As for "slow performance", I have often more than 99+ files open without a big impact on performance.
As a quick way to close tabs, you have several options:
Click anywhere in the tab with the middle mouse button to close it.
Use Ctrl+W to close the current tab
Use the tab's context menu to close it, close all tabs or close all other tabs.

Emacs 24 shows drop-down menu

I use emacs in terminal mode. I know how to get the menu through F10 key. Emacs used to show the menu in terminal mode as text in a separate buffer. Either since a recent update, or I installed some package, I notice emacs starts to create a graphic drop-down list for menu items (see the screenshot). However, I only see it on one of my computer (Mac OS), my other computers still show the menu in "text mode". Can anyone tell me how to enable the graphic dropdown list menu feature? Is this a new feature of latest Emacs 24.3 or it can be enabled via some package?
This is described in the NEWS file for Emacs 24.4:
* Emacs now supports menus on text-mode terminals.
If the terminal supports a mouse, clicking on the menu bar, or on
sensitive portions of the mode line or header line, will drop down the
menu defined at that position. Likewise, clicking C-mouse-2 or
C-mouse-2 or C-mouse-3 on the text area will pop up the menus defined
for those locations.
If the text terminal does not support a mouse, you can activate the
first menu-bar menu by typing F10, which invokes `menu-bar-open'.
If you want the previous behavior, whereby F10 invoked `tmm-menubar',
customize the option `tty-menu-open-use-tmm' to a non-nil value.
(Typing M-` always invokes `tmm-menubar', even if `tty-menu-open-use-tmm'
is nil.)
Looks like a nice feature.

How do I keep Emacs org-mode from splitting windows?

I'm a new emacs user using emacs for the awesome org-mode. I have links to all my org files at the top of my pages but everytime I click a link it splits my window, so I only have half of the screen estate available. How do I set it so that emacs does not split the window horizontally but rather opens up a new window for my links?
I'm assuming you mean you want to open the link in a new frame. (Emacs terminology is a bit different from other GUI apps, because Emacs predates X11. What would be called a "window" in other apps is called a "frame" in Emacs, because "window" already had a specific meaning in Emacs, and was used in the names of lots of functions.) What's happening now is that you have a frame containing one window, and Emacs is splitting that window to form two windows.
You need to customize org-link-frame-setup to use find-file-other-frame instead of the default find-file-other-window.
You can do this by typing M-x customize-variable <ENTER> org-link-frame-setup <ENTER>. Click the Value Menu next to find-file-other-window and select find-file-other-frame, then click Save for future sessions.
One option is to tell Emacs to never split windows, which can be done like so:
(setq same-window-regexps '("."))
This will keep your window from splitting, and then you use your regular commands to switch buffers to get back to what you were looking at.
This is as opposed to what it sounds like you were asking for, which was new frames, which IMO doesn't really help if you have limited screen real estate because you're now having to switch frames (graphical windows).

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.