Show all possible completitions in Emacs using auto-complete.el - emacs

I have auto-complete.el, using Emacs. When I type something, only part of the suggestion appears, and I want to set a key shortcut or something, to enable the whole thing and show all possible suggestions. Using it in Python mode.
When I first installed it, I used it once, don't remember how (possibly automatically).

Try this:
(add-hook
'python-mode-hook
(lambda()
(define-key python-mode-map "\C-i" 'auto-complete)))

Related

How to get tabs in emacs

is there a mode that gives tabs to emacs. I lost lots of time navigating between buffers. I need to get a view which shows me the different buffers.
For tabs, I recommend tabbar-mode. It is a minor mode that should provide the functionality you're looking for.
IĀ use elscreen for this, even if they are not "real" tabs like in other apps (not draggable, no close button, and not "one buffer per tab" concept, we create tabs when we want). But it's enough for me to organize my work in different views.
I also like the hydra you'll see on the wiki and I bound other keys to switch between tabs more naturally:
(global-set-key (kbd "<C-prior>") 'elscreen-previous)
(global-set-key (kbd "<C-next>") 'elscreen-next)
(global-set-key (kbd "<C-tab>") 'elscreen-next) ;; except in org
(global-set-key (kbd "<C-iso-lefttab>") 'elscreen-previous)
see also Buffer Management and specially ibuffer if your goal is to list all available buffers (which you can do now with the menu).
Try my package centaur-tabs. I tried to make it as modern looking as I could, providing a lot of customization options and theming it in popular theme packages like Kaolin Themes or Atom One Dark Theme. It is keyboard oriented although the tabs work with the mouse. It is available in MELPA, try it out and feel free to contribute or submit any kind of feedback. (https://i.stack.imgur.com/K1N5C.png)
As of 2019 Emacs now has native tabs, so
(global-tab-line-mode t)
I find C-x C-b
(list-buffers)
combined with o (Buffer-menu-other-window, try also
? for detailed help) perfectly adequate.
Others use
Speedbar
which is way more powerful.
You have several choices:
speedbar: M-x speedbar
ibuffer: M-x ibuffer
or even simply using helm: M-x helm-buffer-list

Getting browser-style tabs in emacs

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...

emacs doc-view new frame

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!

How to make the windowing system's focus switch to another application using elisp?

I want to open the currently editing html page in a browser and then switch the
window system focus to the browser on a key press. I am using gnome desktop environment.
Below is the code (except the focus switching)
(defun open-in-browser()
(interactive)
(save-buffer)
; switch the windowing systems focus to the browser
(let ((filename (buffer-file-name)))
(browse-url (concat "file://" filename))))
(global-set-key (kbd "<f5>") 'open-in-browser)
I have tried using the lower-frame function and suspend-frame function,
both hides the emacs-frame which is not desired since i will not be able to see the code,
apart from that i have to type ALT-TAB twice to swith to emacs-frame again.
How to switch to another application (just like emulation of ALT-TAB in gnome) using
elisp.
The function you are looking for is probably unfocus-frame but it is obsolete. You need a cooperating window manager in order to actually do what you ask.
You cannot do what you are asking for. Changing the focus is the responsibility of the window manager and emacs cannot do it. You could
call an external program from emacs to do what you want
create a keybinding that would combine <f5> and ALT-TAB
There are programs which can be used to control window managers from the command line, so that you can call a command from elisp to activate windows and stuff.
One such program is wmctrl. I don't know if it works with Gnome, you should try it.

Emacs: automatically enable Zen Coding mode

How to automatically enable Zen Coding mode (zencoding-mode) everytime I open an HTML file in Emacs?
I don't actually use any of these, but something like this ought to do the trick:
(add-hook 'html-mode-hook (lambda () (zencoding-mode 1)))
[edited to promote phils's comment to the answer]