The emacs tabbar.el package adds (buffer)tabs to each window and comes standard with aquamacs and can be added to emacs23 with the emacs-goodies-el package.
Are any of you hardcore emacs users actually using tabbar? I'm sort of used to having tabs, but I would like to know if working without them could be more productive, and if there are other ways besides checking your bufferlist (C-x C-b) to get an overview of your current project files.
As a side note, I really like textmate's project drawer (and tabs), but anything similar in emacs looks just plain hideous.
I've tried using it, but I felt it constraint my workflow rather than improve it. There are a lot of excellent Emacs modes to help with the organization of many buffers and I simply don't feel mapping buffers to tabs is one of those ways.
Just think about the most basic scenario - a lot of tabs. How different programs deal with it - limit the maximum tabs(IntelliJ IDEA); enable tabs bar scrolling(Firefox); infinitely reducing the tabs size(Google Chrome); creating rows of tabs(IntelliJ IDEA)... None of this solutions is that great and by not having tabs in Emacs we have one less problem to worry about. At least this is my subjective opinion - others will most certainly disagree... I personally need nothing more than ido and and iswitchb.
A video of ido in action: http://www.youtube.com/watch?v=lsgPNVIMkIE
Ya, I use tabbar, along with sr-speedbar.
I customize tabbar to show files in specific groups, and mod some keybindings to make navigating the files easier.
FWIW, here's the relevant section from my ~/.emacs:
(require 'tabbar)
; turn on the tabbar
(tabbar-mode t)
; define all tabs to be one of 3 possible groups: “Emacs Buffer”, “Dired”,
;“User Buffer”.
(defun tabbar-buffer-groups ()
"Return the list of group names the current buffer belongs to.
This function is a custom function for tabbar-mode's tabbar-buffer-groups.
This function group all buffers into 3 groups:
Those Dired, those user buffer, and those emacs buffer.
Emacs buffer are those starting with “*”."
(list
(cond
((string-equal "*" (substring (buffer-name) 0 1))
"Emacs Buffer"
)
((eq major-mode 'dired-mode)
"Dired"
)
(t
"User Buffer"
)
)))
(setq tabbar-buffer-groups-function 'tabbar-buffer-groups)
(global-set-key [M-s-left] 'tabbar-backward)
(global-set-key [M-s-right] 'tabbar-forward)
There's lot's of other tips on emacswiki:
http://www.emacswiki.org/emacs/TabBarMode
no.
I use iswitch-b
C-x b "first few letters of buffer", then C-s to rotate to the specific file I want takes me under 2 seconds without me having to move hand to mouse.
No. I could possibly be convinced to try it again with the right customisation, but by default it's pretty useless for me, as I habitually have in excess of 100 buffers open. ibuffer with its filtering and grouping is the best way for managing large numbers of buffers that I've tried.
I like to use speedbar for quick buffer navigation. I have in my .emacs
(speedbar-change-initial-expansion-list "buffers")
(global-set-key [f8] 'speedbar-get-focus)
so when I hit F8, a new frame pops up with a list of open buffers, there you can move point over the buffer you want to select and to activate it. One more F8 goes back to the main frame.
tabs are not reserved for mouse users. look at vim possible workflow: gt to go next tab, or gT to go previous. Say you've one dedicated window for vim: you might easily switch from one buffer to another. Yes, tabs are probably for users with few buffers. if you have hundreds, this won't work.
Quite frankly, you'll find better editors than emacs when speaking of tabs, menus and toolbar. Emacs clearly encourages you to use your keyboard and leave your mouse asleep.
Tabbar or any other tab management tool will have difficulties when you'll have lots of buffers opened. You also don't want to show all your buffers in tabs. Having to remove your hand from the keyboard to grasp the mouse and click on a tab and then remove your hand from the mouse and put it onto the keyboard is clearly a waste of time when a simple keystroke could be used instead.
The best thing you could do to your emacs and to you is to have the following configuration in your .emacs :
(menu-bar-mode -1) ;hide menu-bar
(scroll-bar-mode -1) ;hide scroll-bar
(tool-bar-mode -1) ;hide tool-bar
That will force you to forget the old way of doing things using a mouse (like using tabbar, or menus...), and to use your fingers instead.
Up until now, I haven't tried it, but before I switched back to GNU Emacs from XEmacs, I used the XEmacs tabs very heavily. I found that when I had many source files open, it was one of the fastest ways to jump to the correct file.
Now that I know about tabbar, I am trying it; and so far, I like it.
John
Tabs are really only useful if you use the mouse, and one of the main benefits (to me) of Emacs is that I can avoid the mouse.
So, no, tabbar isn't useful in general.
I did find the tabs useful when I was browsing web pages (using w3m), but I was using the mouse in that case...
Tabbar looks like it is godforsaken
So what about elscreen?
Can be found via http://melpa.milkbox.net/#/elscreen - or installed emacs-elpa (or melpa).
Elscreen is very useful for me.
C-x b<RET> always gives you the last edited buffer. And what do you do with tabs ? Mostly switch back & forth between two files. There you go.
Related
Really new programming student here, and I'm trying to get tabs in emacs (browser style, like Aquamacs has).
So, how do you get tabs in emacs? A strip of labels showing me which buffers I have open, and clicking on one of them selects that buffer.
I have googled this extensively, but not being fluent in elisp makes it really hard to understand. I have installed the tabbar package, but I do not know where to go from here.
What do I want? Just tabs, and a command to open new tabs, for example C-t (or whatever is best).
I have installed the tabbar package, but I do not know where to go from here.
The tabbar library provides a global minor mode named tabbar-mode, so you will want to enable that in your init file. If it's installed somewhere in your load-path then the following will work:
(when (require 'tabbar nil t)
(tabbar-mode 1))
There is lots of documentation in the library's Commentary, which you can visit like so:
M-x find-library RET tabbar RET
Try this, it's called tabbar and should allow you to do what you're looking for.
As the other answers, tabbar is what you're looking for.
You need to copy it to wherever you keep your emacs files (if you don't have such a place - make one, tabbar will not be the last add-on you'll use :) ), load the file and start the tabbar-mode.
In the below code, the emacs files dir is .emacs.files and it is in my home dir.
(setq tabbar-file
(expand-file-name "tabbar.el"
(expand-file-name ".emacs.files" "~")))
(load-file tabbar-file)
(tabbar-mode 1)
(define-key global-map "\M-[" 'tabbar-backward)
(define-key global-map "\M-]" 'tabbar-forward)
In the above code, I also added binding of scrolling through the tabs to Alt-[ and Alt-].
As to opening new tabs - every time you'll open a new file, it will be opened in a new tab, so don't worry...
When using tools like Org-mode and Magit the mode will sometimes show help menus. For instance, org-mode export will show a nice menu that accept single keys and then executes some command. In Magit, when looking at the status view it will accept tabs to expand the staged and commit areas.
These areas, for both Git and Org, are nicely placed to take up some portion of the emacs frame that is mostly convenient. How does emacs do choose this?
Additionally, these views are read-only, up until the user presses tab in the case of Magit and the status view. Is there a best practice when creating these views which control editing, but allows the mode to edit the file and present alternative text?
Perhaps the answer is take a look at these function A, B, and C. Which is fine, I'm just learning and experimenting on my own.
Magit in particular is not the simplest introduction to popup buffers in Emacs, but it certainly is sophisticated and a good read. Find magit-popup.el on your machine, for example M-x find-function RET magit-popup-mode-setup. To me, that function looks like a good candidate to start reading that file. You can see the macro magit-define-popup in use for example in magit-push-popup in the file magit-remote.el
In the end, it boils down to opening a new buffer in a new window and give it a dedicated major mode which has all the key-bindings.
Another good candidate is the family of temp-buffer-* functions.
Hope, that gives some pointers to start reading.
An easy way to show menus/help screens à la Magit and org-mode is with Hydras:
http://wikemacs.org/wiki/Discoverability#Hydra
https://github.com/abo-abo/hydra/
https://github.com/abo-abo/hydra/wiki
It's a short elisp method to write and it will give you a menu like org-mode. For example:
(defhydra hydra-zoom (global-map "<f2>")
"zoom"
("g" text-scale-increase "in")
("l" text-scale-decrease "out"))
ps: it's not what org-mode and magit use. Magit's system wasn't re-usable until recently and I don't know how it compares with Hydra. A nice feature of Hydras is that you can tell it to not disappear after a keypress, so than you can press many keys in a row.
I am new to Emacs and presently I am using it heavily for LaTeXing.
Please help me out with the following customizations:
How to scroll continuously in doc-view-mode? I have
(setq doc-view-continuous t)
in my .emacs file. This enables scrolling through the pages, however, the pages "jump" to the next one. I do not like reading to the bottom of the screen. Is it possible to resolve it?
I invoke doc-view using C-c C-c and the PDF loads into a new window. Is it possible to load it in a new frame?
I have used
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
in my .emacs file. This works fine. However, the first line is just below the top screen. Can I create some margin ONLY on top?
How do I copy/paste from Emacs to other application, like a browser? I couldn't copy the code above using C-w in Emacs and then Ctrl-v in Iceweasel (browser). I had to use Kate, sadly. (This I realized while typing this question!)
Regards,
Saurav Agarwal
You should be able to scroll "line by line" with C-n and C-p.
I do not know that mode (I use tex-mode), but what you probably want is to find out how C-c C-c is invoking doc-view and use it with other-window, for example:
(defun new-frame-dvi-file ()
(interactive)
(split-window-right)
(other-window 1)
(tex-view))
I could not find anything that sets a top margin ONLY, but found this:
(set-frame-parameter nil 'internal-border-width 10)
You can share clipboards with this:
(setq x-select-enable-clipboard t)
Anyway, even if it sounds really boring, sometimes it is really useful to take a look at the manual. Sometimes you don't need to read it all and you can find the answer quickly ;-)
Hope it helps!
I recently switched to using GNU Emacs 24 from 23, and I notice that whenever I enter gud the *input/output* buffer is open. I have close it manually with C-x 0 everytime I debug. Can anyone point me to the correct variable which needs to be configured in order to stop displaying this buffer by default?
There is a 'gud-gdb' in new emacs releases that implement the old behavior of gdb/emacs interaction (no dedicated-windows and no I/O buffer). If you don't want to call M-x gud-gdb when you use it you can define an alias for M-x gdb
I have this problem as well. After a quick look at the source code, the problem appears to be that GUD dedicates most of its windows (that is, it calls set-window-dedicated-p on them). A dedicated window is one that cannot be switched away from. I guess more and more young guns are using GUD in many windows mode and want GUD to manage their window layout, and those of us that like to do that manually are in the minority. There doesn't seem to be anything obvious in gdb-mi.el that disables this behavior (for example, gdb-set-window-buffer seems to always do a set-window-dedicated-p to t for all windows it manages).
For now, this solution is more or less the one I'm using -- I manually deactivate the window dedication. This seems suboptimal, though. There ought to be some way to get GUD to let you manually manage the window layout. This question is related.
You can disable window dedication altogether like this: (in Emacs 24.4+)
(defun set-window-undedicated-p (window flag)
"Never set window dedicated."
flag)
(advice-add 'set-window-dedicated-p :override #'set-window-undedicated-p)
Note that this doesn't affect already dedicated windows.
Background:
I'm primarily a Javascript developer. Espresso mode rocks.
I work on a team where other people touch my code (and I theirs). Different folks have different preferences for tab width. I like mine at four, a coworker likes his at two.
JSLint complains if you mix tabs and spaces (yes, I realize you can turn it off - but it helps keep me sane).
I'm staring at my buffer in whitespace-mode, and can clearly see that when I newline and tab, it inserts a bunch of tabs and then.. four spaces.
How can I prevent this behavior? The only whitespace before the first visible character of a line should be tabs...
You need to adjust a couple settings in your emacs configuration.
(setq tab-width 4) ;; set your desired tab width
(setq indent-tabs-mode t) ;; use tabs for indentation
You may also need to adjust the indentation offset in your javascript mode so that each indent is a multiple of your tab width (for C-based modes it's called c-basic-offset).