Emacs - mwicat/personal GitHub Wiki

Replace region with command output

C-u M-| command RET

Startup configuration

sudo apt-get install cvs subversion git bzr texinfo slime build-essential
emacs_user_dir=~/.emacs.d/`whoami

Starter-kit

mkdir -p ~/src "$emacs_user_dir"
cd ~/src
git clone https://github.com/technomancy/emacs-starter-kit.git -b master
rsync -Cavz emacs-starter-kit/ ~/.emacs.d/

Kicker

wget -O "$emacs_user_dir/kicker-config.el" https://github.com/mwicat/emacs-kicker/raw/master/init.el

M-x el-get-install RET dired+

CEDET

http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html

mkdir ~/emacs
cd ~/emacs
bzr clone bzr://cedet.bzr.sourceforge.net/bzrroot/cedet/code/trunk cedet

emacs -Q -l cedet-build.el -f cedet-build

~/.emacs.d/$USERNAME/cedet-config.el:

(load-file "~/emacs/cedet/common/cedet.el")
(global-ede-mode t)
(semantic-load-enable-code-helpers)
(require 'semantic-ia)
(require 'semantic-gcc)

sed -i '1 i (load-file "~/emacs/cedet/common/cedet.el")' ~/.emacs.d/init.el

Debugging

Go to the definition of the function, and type M-x edebug-defun. The next time it is called, you'll be able to step through the code as with every other debugger.

  • SPACE to execute until the next stop point
  • b to set a breakpoint at a stop point
  • g to execute until a breakpoint is reached
  • q to exit Edebug and return to the top-level command loop
  • ? to display a list of all Edebug commands.
  • c to continue
  • i edebug-step-in
  • o edebug-step-out
  • f edebug-forward-sexp
  • h edebug-goto-here

GNU Global

cd src/freeswitch
gtags
      (setq c-mode-hook
          '(lambda ()
              (gtags-mode 1)
      ))
  • M-x gtags-find-tag M-.
  • M-x gtags-find-rtag

Set file variables

M-x add-file-local-variable-prop-line

-*- mode: modename; var: value; ... -*-

Flyspell

sudo apt-get install aspell-pl

Set variable ispell-dictionary to select a specific default dictionary for all your documents. Set variable ispell-local-dictionary in the local variables section to select a specific dictionary for a given document.

Tex

sudo apt-get install texlive texinfo texlive-lang-polish dvipng biblatex sudo apt-get --no-install-recommends install texlive-latex-extra

Auctex

M-x el-get-install auctex

Emacs Windows integration

setx HOME c:\cygwin\home%USERNAME%

Pretty print expression

  • pp-macroexpand-expression
  • pp-macroexpand-last-sexp

Split vertically

(setq split-width-threshold nil)

M-x Customize-Group [RET] Windows

There you have Split Window Preferred Function, Split Height Threshold and Split Width Threshold. Set Split Height Threshold to nil and Split Width Threshold to 0

ssh with sudo

(require 'tramp)
(setq tramp-default-method "ssh")
(add-to-list 'tramp-default-proxies-alist '("bs-r" nil "/ssh:[email protected]:"))

Refresh with emacs

(defun refresh-file ()
  (interactive)
  (revert-buffer t t t)
  )

(global-set-key [f5] 'refresh-file)

M-x auto-revert-mode