Emacs -fs (fullscreen) - emacs

I'm trying to use emacs in fullscreen mode with a decent font. I have an nvidia-based laptop running Ubuntu. When it first loads, the font is huge think 16pt font. I used the menu options to set a decent font (8pt).
Now when I run emacs in fullscreen mode, it adjusts the window sort of for the huge font then loads my 8pt font. Now half of my screen is the minibuffer. How do I correctly set the font so that I can use fullscreen mode.
I have tried specifying displaysize in my x config and X does not start. I hear theres something else you need to do for nvidia drivers... but not sure how that works.

I use the following (from http://www.emacswiki.org/emacs/FullScreen) in my .emacs:
(defun toggle-fullscreen (&optional f)
(interactive)
(let ((current-value (frame-parameter nil 'fullscreen)))
(set-frame-parameter nil 'fullscreen
(if (equal 'fullboth current-value)
(if (boundp 'old-fullscreen) old-fullscreen nil)
(progn (setq old-fullscreen current-value)
'fullboth)))))
(global-set-key [f11] 'toggle-fullscreen)
;; Make new frames fullscreen by default. Note: this hook doesn't do
;; anything to the initial frame if it's in your .emacs, since that file is
;; read _after_ the initial frame is created.
(add-hook 'after-make-frame-functions 'toggle-fullscreen)
Then F11 will toggle fullscreen on/off.

This is tough since I can't replicate the problem on my machine. I just add -fs and it seems to work. If you just want more real estate... do these work for you:
ditch the menu/toolbar
add (menu-bar-mode 0) and (tool-bar-mode 0) to .emacs
start up and maximze
you should just have the regular DE frame but nothing else
toggle from emacs using M-x menu-bar-mode and M-x tool-bar-mode as needed
manually fullscreen emacs
I can just start emacs, right click the window bar and choose fullscreen from xfce
I have F11 set to do this, but it doesn't seem to work from emacs (emacs seems to try and interpret it as a key binding rather than passing the key to the DE)
if this works, perhaps find a binding in your DE that emacs doesn't care about and just maximize normally
combine the two
I start emacs regularly (/usr/bin/emacs)
I disabled both tool-bar-mode and menu-bar-mode disabled
I manually fullscreen with a right mouse click on the window bar
I get THIS
that's the entire screen, not just a shot of the window contents
What do you think of those ideas? Sorry I can't help more with Ubuntu and/or nvidia. No experience and tough if one can't replicate the problem! Maybe if emacs starts regularly for you the above can help achieve close (or fully) what you're hoping for.

Related

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.

Stop emacs from opening window automatically

This question probably applies to other emacs modes than haskell-mode, since I assume emacs has got a general way of opening windows for automatically created buffers:
haskell-mode for emacs enables me to hit C-c C-l to load the contents of the current buffer into a Haskell interactive session, which automatically causes emacs to open the buffer for the session in a split window in the current frame. Since I am running a setup with multiple emacs clients connected to a server, I really don't want to show the buffer in each open frame I've got. Is there a way to prevent emacs from doing this kind of thing?
Ah, I found a solution just after posting this :).
Adding
(setq special-display-buffer-names
'("*haskell*" "*Help*"))
to my .emacs tells emacs to open these buffers in a frame instead of a split.
Edit: But still, an even better solution would be for emacs never to create frames/splits automatically, but just silently create special buffers in the background. I can't figure out how to specify this though.
in init.el
(setq split-height-threshold 5)
(setq split-width-threshold 5)

Emacs custom background color by mode

I use emacs to edit a number of file types, and would like an easy visual queue to tell .c files from .vhd or .py files, for instance. How can I add a custom background color to the major mode for that language?
You can do this via hooks. Among other things you can hook is when a new major mode starts. Put something like this into your .emacs file, and emacs will set your background color to purple every time you go into Python mode.
(add-hook 'python-mode-hook
(lambda ()
(set-background-color "purple")))
Resetting the background color to the default in the case that you switch back to a mode that doesn't have an explicit set-background hook for it is left as an exercise for the reader.
You can also manually set the background color with M-x set-background-color
For posterity, as this thread is 4 years old, it is now possible in Emacs 24.4+ to change faces on a buffer local level. Simply define a face and use (face-remap-add-relative) to swap out whatever face you want with it.
Define a defface:
(defface my-special-face '((t :background "aqua")))
Then add a hook to the mode of your choice:
(add-hook 'python-mode-hook
(lambda ()
(face-remap-add-relative 'default 'my-special-face)))
You cannot set the background color on a buffer-by-buffer basis. See the SU question How can I change the background colour of a single emacs buffer?.
The first answer there shows how you can change the background for a single Emacs frame, which might work for you if you have one frame per file (or per mode).