Skip to content

Latest commit

 

History

History
206 lines (162 loc) · 7.54 KB

ome-gui.org

File metadata and controls

206 lines (162 loc) · 7.54 KB

Oh My Emacs GUI

This is part of oh-my-emacs.

El-get packages

PackageStatusDescription
solarized-emacsRequiredAdopt this as the default color-theme.
emacs-powerlineRequiredEye candy for Emacs mode line.
linum-relativeRequiredEye candy for Emacs linum-mode.

Basic GUI Settings

;; show column number and line number
(dolist (mode '(column-number-mode line-number-mode))
  (when (fboundp mode) (funcall mode t)))

(dolist (mode-hook '(text-mode-hook prog-mode-hook conf-mode-hook))
  (add-hook mode-hook
            (lambda ()
              (linum-mode 1))))

;; make the fringe thinner (default is 8 in pixels)
(fringe-mode 4)

;; show parenthesis match
(show-paren-mode 1)
(setq show-paren-style 'expression)

;; Toggle line highlighting in all buffers
(global-hl-line-mode t)

;; http://stackoverflow.com/questions/27758800/why-does-emacs-leave-a-gap-when-trying-to-maximize-the-frame
(setq frame-resize-pixelwise t)

Choose Monaco as the Default English Font

Choosing a good and comfortable font is quite important in your whole coding life. Although the default font of emacs is good enough, I believe there’re better choices. And you can refer to TOP 10 PROGRAMMING FONTS and 10 of the Best Programming Fonts to get some feel of various programming fonts.

And I prefer Monaco. However, I’ve googled a lot to prove that Monaco is free to use on non-Mac platforms, but found nothing about the official warrant. So I pretend that it is free. If you found any illegal issues, please tell me and I’ll choose another free font. Thanks.

Finally, about how to install Monaco fonts in Linux, see https://github.com/cstrap/monaco-font. If you didn’t install Monaco, oh-my-emacs will fallback to the default font. Yeah, the so-called self-adapting.

;; frame font
;; Setting English Font
(if (member "Monaco" (font-family-list))
    (set-face-attribute
     'default nil :font "Monaco 12"))

Full screen support

By default, oh-my-emacs won’t bind any shortcut to function keys. There’re two reasons:

  • Some special keyboards(such as HHKB) lacks function keys.
  • Some function keys are occupied by system, either by the windows manager, the operating system, or something else which you have no idea to know it before.

Of course you can overrides this convention as you like, oh-my-emacs is just a starting point.

;; http://www.emacswiki.org/emacs/FullScreen
(defun ome-toggle-fullscreen ()
  "Toggle full screen"
  (interactive)
  (set-frame-parameter
   nil 'fullscreen
   (when (not (frame-parameter nil 'fullscreen)) 'fullboth)))

;; (global-set-key (kbd "<f11>") 'ome-toggle-fullscreen)

Solarized Color Theme

Solarized is my favourite color theme. it is available for multiple applications, not only for emacs. I’ll set this as the default theme for oh-my-emacs.

There’re multiple el-get/elpa packages for solarized theme, and the original oh-my-emacs adopts color-theme-solarized package, which requires color-theme package as a dependency, which failed to install sometimes. So oh-my-emacs now adopts solarized-emacs package. One thing you should be aware of is, you should use M-x load-theme instead of color-theme-xxxx to change current color theme.

(defadvice load-theme (around ome-load-theme disable)
  ad-do-it

  ;; Remove boxes from Powerline arrows
  (set-face-attribute 'mode-line nil :box nil)
  (set-face-attribute 'mode-line-inactive nil :box nil))

(defun ome-solarized-emacs-setup ()
  ;; make the fringe stand out from the background
  (setq solarized-distinct-fringe-background t)
  ;; make the modeline high contrast
  (setq solarized-high-contrast-mode-line t)
  ;; Use less bolding
  (setq solarized-use-less-bold t)
  ;; Use more italics
  (setq solarized-use-more-italic t)
  ;; Use less colors for indicators such as git:gutter, flycheck and similar.
  (setq solarized-emphasize-indicators nil)

  (setq x-underline-at-descent-line t)

  (ad-enable-advice 'load-theme 'around 'ome-load-theme)
  (ad-activate 'load-theme)

  (load-theme 'solarized-dark t))

(ome-install 'solarized-emacs)

Q&A

Q: How to change the default solarized color theme for ome?

A: Just untangle the related code block by convert #+BEGIN_SRC emacs-lisp to #+BEGIN_SRC emacs-lisp :tangle no, and choose any color-theme as you like. Check github issue for detailed discussion.

Powerline

Powerline is an eye candy for emacs mode line. Actually, the emacs-powerline is inspired by vim-powerline. There’re also powerline variants for tmux, shell, etc.

(defun ome-emacs-powerline-setup ())

(ome-install 'emacs-powerline)

Actually, there’re two packages as emacs’s powerline:

I’ve used milkypostman’s powerline for a long time, however, there’re some tiny annoying problem with this package. Check this issue for example. So I’ve now decide to give janathanchu’s powerline a try. Hope it works as expected.

Linum-relative

I think the inspiration of linum-relative comes from numbers.vim. Thanks vimeitor for methoning this for me, I tried and I found it’s really useful. So I made it a default for oh-my-emacs.

(defun ome-linum-relative-setup ()
  (require 'linum-relative))

(ome-install 'linum-relative)

Todo

Speedbar

  • Combine projectile and speedbar to provide a project navigation feature. graphene has a solution, which may be worth a try.

Color-theme