Skip to content

Latest commit

 

History

History
340 lines (273 loc) · 13.6 KB

ome-experimental.org

File metadata and controls

340 lines (273 loc) · 13.6 KB

Oh My Emacs GUI

This is part of oh-my-emacs.

This file contains some experimental packages, which may be:

  • not stable enough
  • usable, with some minor annoying problems, however
  • young packages without long time testing and validating.

Load necessary packages as you like.

Prerequisites

PackageWindowsUbuntu/Debian/MintArchLinuxFedoraMac OS XMandatory?
DoxygendoxygenNo

Note:

  • Doxygen, even if you don’t have doxygen installed, you can still use doxymacs to insert doxygen-style comments. So I make this dependency optional. However, so many Mac OS users have problems with this el-get package, so I move

El-get packages

PackageStatusDescription
lacarteRecommendedAccess menubar in minibuffer command loop.
SrSpeedbarExperimentalMake Speedbar show in same frame.
yascrollRequiredEye candy for Emacs scroll bar.
smooth-scrollingRecommendedEmacs smooth scrolling package.
hungry-deleteExperimentalEnables hungry deletion in all modes.
doxymacsExperimentalLiterate comments for cc-mode.
sublimityExperimentalBring sublime’s smooth-scrolling and minimap to emacs
pos-tipExperimentalShow tooltip at point
flycheck-pos-tipExperimentalFlycheck errors display in tooltip
po-modeExperimentalEmacs’s PO File Editor
emacs-dirtreeExperimentalDirectory tree views in Emacs

Note:

  • doxymacs: There’re many Mac OS users having problems building with this package, so I have to move this package from ome-cc module to ome-experimental module. See github issue for details.

Lacarte

By default, oh-my-emacs disables menu-bar-mode. Of course you can turn it on by M-x menu-bar-mode, however, most of the time menubar in Emacs is useless. Unfortunately, there may be some times that we want to access the menubar just to find or execute oblivious command. For example, the prefix key of outline-mode is C-c @, which is quite hard to type, and I often forgot the normal keybindings of outline-minor-mode. The normal workflow for this case is divided into three steps:

  1. turn on the menubar by M-x menu-bar-mode
  2. find/execute the command you want
  3. turn off the menubar again by M-x menu-bar-mode

Ah, a little tedious, isn’t it? Fortunately, with lacarte, I can just M-x lacarte-execute-menu-command, and it will lead me to the right place. Helm also provides a helm-source-lacarte for lacarte support. See helm-misc.el for details.

(defun ome-lacarte-setup ()
  (global-set-key (kbd "C-c M-x") 'lacarte-execute-command)
  (global-set-key (kbd "C-c M-m") 'lacarte-execute-menu-command))

(ome-install 'lacarte)

Sr-speedbar

Speedbar is a program for Emacs which provides a special frame for conveniently navigating in or operating on another frame. The original inpiration comes from the “explorer” feature often used in modern development environments.

By default, speedbar will fork a new frame, which, IMHO, is a bad idea. sr-speedbar solves this problem, however, it brings some new problems:

  • By default, the value of sr-speedbar-right-side is t. And this windows will be occupied by helm when you do things with helm, which is quite boring. So I have to (setq sr-speedbar-right-side nil).
  • By default, the width of sr-speedbar window will change when you resize the Emacs frame, so I have to adopt a code snippet from emacswiki.
  • Even we (setq window-size-fixed 'width), the width of sr-speedbar window still changes in some rare cases. For example, when you delete “window-1” by delete-window in the following layout, sr-speedbar will expand, while “window-2” will keep its width unchanged.
sr-speedbarwindow-1window-2
(defadvice sr-speedbar-open (around ome-sr-speedbar-open disable)
  ad-do-it
  (with-current-buffer sr-speedbar-buffer-name
    (setq window-size-fixed 'width)))

(defun ome-sr-speedbar-setup ()
  ;;keep speed bar window width after resizing
  (ad-enable-advice 'sr-speedbar-open 'around 'ome-sr-speedbar-open)
  (ad-activate 'sr-speedbar-open)
  (setq sr-speedbar-skip-other-window-p t)
  (setq sr-speedbar-right-side nil))

(ome-install 'sr-speedbar)

Yascroll

yascroll.el is Yet Another Scroll Bar Mode for GNU Emacs.

(defun ome-yascroll-setup ()
  (global-yascroll-bar-mode 1))

(ome-install 'yascroll)

Smooth-scrolling

Make emacs scroll smoothly. WARNING: This makes your emacs slow.

(ome-install 'smooth-scrolling)

Hungry-delete

CC-mode does have some good innovations, among which hungry-delete is what I want most. Fortunately, a good guy ported hungry-delete from cc-mode to a independent package.

(defun ome-hungry-delete-setup ()
  (dolist (hook '(text-mode-hook prog-mode-hook comint-mode-hook))
    (add-hook hook 'turn-on-hungry-delete-mode)))

(ome-install 'hungry-delete)

Fill-Column-Indicator

“Many modern editors and IDEs can graphically indicate the location of the fill column by drawing a thin line (in design parlance, a “rule”) down the length of the editing window. Fill-column-indicator implements this facility in Emacs Fill-Column-Indicator.”

This package still has some conflicts with other oh-my-emacs packages, so I put it in ome-experimental module instead of core.

(defun ome-fill-column-indicator-setup ()
  (add-hook 'text-mode-hook 'fci-mode)
  (add-hook 'prog-mode-hook 'fci-mode))

(ome-install 'fill-column-indicator)

Documentation with Doxymacs in CC-mode

Doxygen is the de facto standard tool for generating documentation from annotated C++ sources, but it also supports other popular programming languages such as C, Objective-C, C#, PHP, Java, Python, IDL (Corba, Microsoft, and UNO/OpenOffice flavors), Fortran, VHDL, Tcl, and to some extent D.

http://www.doxygen.org/

Doxymacs brings the power of doxygen to Emacs, you can easily insert Doxygen style comments in emacs. The default keybindings are:

  • C-c d ? look up documentation for the symbol under the point.
  • C-c d r rescan your Doxygen tags file.
  • C-c d f insert a Doxygen comment for the next function.
  • C-c d i insert a Doxygen comment for the current file.
  • C-c d ; insert a Doxygen comment for a member variable on the current line (like M-;).
  • C-c d m insert a blank multi-line Doxygen comment.
  • C-c d s insert a blank single-line Doxygen comment.
  • C-c d @ insert grouping comments around the current region.

If you like, you can even integrate Doxygen to CMake workflow, see here.

(defun ome-doxymacs-setup ()
  (add-hook 'c-mode-common-hook 'doxymacs-mode)
  (add-hook 'c-mode-common-hook 'doxymacs-font-lock))

(ome-install 'doxymacs)

Sublimity

As a long-history editor, emacs lacks some “modern” features established by other “modern” editors, among which sublime is one of the most famous and popular. To tell the truth, the minimap and smooth-scrolling looks really charming and attractive. There’re various attempts trying to bring these features to emacs, such as minimap.el, but none of them work perfectly.

sublimity is just another attemp, it’s not perfect, however, IMHO, it’s better than others.

After installing sublimity, type M-x sublimity-mode to enable it.

WARNING: This makes your emacs slow.

(defun ome-sublimity-setup ()
  (require 'sublimity-scroll)
  (require 'sublimity-map))

(ome-install 'sublimity)

Pos-tip

By default, auto-complete will use popup.el library to display completion list, while popup.el itself can show some tooltip to display annotations of the menu items when available. However, sometimes the layout of the tooltip looks bad when you use the builtin popup.el windows. Fortunately, pos-tip provide a better way to display tooltips in a specified location, and it can be used by other frontend program like popup.el. Auto-complete has a builtin variable ac-quick-help-prefer-pos-tip, which defaults to t, that means when we have pos-tip library installed, we will have a better tooltip window. I tried and it works like a charm. However, some users of ome reported that they have various problem installing pos-tip, see github issue 70 and 71, so I made it a experimental package in ome ome-experimental module, and I hope you have a good luck and able to enjoy it. To get this package, just (ome-load "modules/ome-experimental.org" "pos-tip")

(defun ome-pos-tip-setup ()
  (require 'pos-tip))

(ome-install 'pos-tip)

By default, flycheck show errors in echo area, which is not intuitive. This flycheck-pos-tip extention will display errors under point using pos-tip.

(defun ome-flycheck-pos-tip-setup ()
  (eval-after-load 'flycheck
    '(progn
       (require 'flycheck-pos-tip)
       (setq flycheck-display-errors-function
             #'flycheck-pos-tip-error-messages)
       (setq flycheck-pos-tip-timeout 10))))

(ome-install 'flycheck-pos-tip)

Po-mode

Emacs always bring you some surprises for you daily job. Some day I wanted to do some i18n/l10n work for a python project, and I found PO-Mode, which is really awesome. I even wanted to write a tiny tutorial for this great mode, but I just gave up. Since for any questions in po-mode, you can just type ? or h, and you will get a brief and concise answer.

(defun ome-po-mode-setup ()
  (add-hook 'po-mode-hook
            (lambda ()
              (linum-mode 1)))
  ;; disable evil-mode since some key binding conflicts
  (when (featurep 'evil)
    (add-hook 'po-mode-hook 'turn-off-evil-mode)))

(ome-install 'po-mode)

emacs-dirtree

emacs-dirtree provide a long lost directory browser for Emacs. However, this package didn’t update for a long time, so I only put this in ome-experimental module, and you can load this package by put `(ome-load “modules/ome-experimental.org” “emacs-dirtree”)` in oh-my-emacs startup file.

(defun ome-emacs-dirtree-setup ())

(ome-install 'emacs-dirtree)