Thursday, December 11, 2008

A few helpful emacs tweaks

I find them randomly on the web, or in the Emacs manual. Add these line in the .emacs file in your home directory, you'll get the desired feature.
  ;; turn off scroll bar
(toggle-scroll-bar 0)

;; don't show toolbar
(tool-bar-mode 0)

;; disable menu bar
(menu-bar-mode 0)

;; do not display a splash screen on startup
;; only needed for emacs 22+
(setq inhibit-splash-screen t)

;; disable side fringe
;; this only works for emacs 22+
(set-fringe-mode 0)

;; toggle full screen
(defun switch-full-screen ()
(interactive)
(shell-command "wmctrl -r :ACTIVE: -btoggle,fullscreen"))
(global-set-key [f11] 'switch-full-screen)
The last full screen function using the wmctrl utility:
  sudo apt-get install wmctrl
You can also use Emacs' own frame control to go full screen:
  (defun fullscreen ()
(interactive)
(set-frame-parameter nil 'fullscreen
(if (frame-parameter nil 'fullscreen) nil 'fullboth)))
(global-set-key [f11] 'fullscreen)
But the window will be maximized after toggling back.
  ;; define the compile command to be make filename.o, and bind to C-x c
(setq compile-command '(concat "make "
(file-name-sans-extension (file-name-nondirectory buffer-file-name))
".o"))
(global-set-key "\C-xc" 'compile)

By the way, my new Eee 901 died today, after 30 hours being in my hands. Bad luck or bad quality? Luckily TigerDirect allow me to send it back and replace it. We will see how the next one doing.

No comments:

 
Creative Commons License All contents on this page are licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.