Emacs notes

From DiLab
Revision as of 19:17, 27 November 2009 by Leo (talk | contribs) ('''Pretty fonts for Emacs editor''')
Jump to: navigation, search

Run lisp in emacs

You can run a builtin or loaded lisp module command in Emacs like this (example - starting the speedbar):

M-x speedbar

You can also try things out in *scratch* buffer. For example:

  • Bring to front the *scratch* buffer
  • Type your lisp. e.g. (+ 2 3)
  • Press Ctrl+X Crtl+E
  • Watch the result in the bottom (echo) part of the Emacs window/screen

How to open new files in already open Emacs window (using gnuserv)

http://www.debian-administration.org/articles/257

Shortcut:

apt-get install gnuserv

Add to your .emacs configuration file the following:

;;
;;  Start GNUServe process when starting up.  This lets us send new files
;; to previously spawned emacs process.
;;
(load "gnuserv-compat")
(load-library "gnuserv")
(gnuserv-start)

;; When loading files reuse existing frames.
(setq gnuserv-frame (car (frame-list)))

;; Stop annoying prompt on kill buffer but member of gnuserv
(setq kill-buffer-query-functions nil)

Create a shortcut script to call emacs and alias emacs command with this:

#!/bin/sh
# ~/bin/emacs

# "apt-get install lsof" - if you're missing "lsof".
lsof /usr/bin/emacs-snapshot | grep $USER >/dev/null 2>&1

if [ "$?" -eq "1" ]; then
    /usr/bin/emacs-snapshot $* &
else
    /usr/bin/gnuclient $* &
fi

Pretty fonts for Emacs editor

How to replace built-in emacs fonts. http://peadrop.com/blog/2007/01/06/pretty-emacs/

Shorcut:

sudo aptitude update
sudo aptitude install emacs-snapshot emacs-snapshot-el

echo "Emacs.font: Monospace-10" >> ~/.Xresources
xrdb -merge ~/.Xresources

Note, if you get the "No fonts match `Monospace-10'" message, make sure you are running the emacs-snapshot and not your previous emacs version.