3.2. Xemacs

Table of Contents

3.2.1. Background
3.2.2. Features
3.2.3. Basic Usage
3.2.4. Buffers and Files
3.2.5. Important Commands
3.2.6. Demo Basic Commands
3.2.7. Enough Lisp to be Dangerous
3.2.8. Basic Customization
3.2.8.1. Modes
3.2.8.2. auto fill mode
3.2.8.3. Mouse Wheel
3.2.8.4. Line and Column Numbers
3.2.8.5. Font Lock Mode (syntax highlighting)
3.2.9. Adding A Date Insertion Function
3.2.10. CC mode
3.2.11. The Most Current AUCTEX
3.2.12. TRAMP
3.2.13. Other Useful Modes
3.2.14. Resources

3.2.1. Background

  • Emacs developed by Richard Stallman

  • The name is short for Editor Macros

  • XEmacs split to enhance GUI elements

  • Very similar but some packages work with one or the other

3.2.2. Features

  • Console and Graphical modes

  • Core written in C

  • Core includes ELisp Interpreter

    Note

    For the remainder of this presentation, I will refer to ELisp simply as Lisp.

  • Most of the functionality is written in lisp

  • Customize with lisp

3.2.3. Basic Usage

  • Idea is to make command mnemonic

  • Chording commands

  • Ctrl written as C

  • Meta Written as M

  • Esc works as Meta but sometimes Alt does as well

  • Either love or hate chording

  • Chording works same in console and gui mode

3.2.4. Buffers and Files

  • XEmacs separates buffers from files

  • Buffers are transient and in memory

  • Editing is done on buffers

  • Buffers are saved to files

  • Can have a buffer without a file

  • Can have multiple buffers open simultanously

  • XEmacs starts in the buffer <code>*scratch*</code>

3.2.5. Important Commands

Find File, Open or create a file

C-x C-f

Save Current Buffer

C-x C-s

Save All Bufferes

C-x s

Kill to end of line

C-k

Yank

C-y

Exit Xemacs

C-x C-c

Help Apropos

C-h a

Quit, Interrupt current command

C-g

Interactive command

M-x (interactive function)

M-x help

3.2.6. Demo Basic Commands

Find a file, open another buffer evaluate an interactive command.

3.2.7. Enough Lisp to be Dangerous

Enough Lisp to be Dangerous

  • Atoms

  • Lists

  • Symbols

  • Symbolic expression, S-expressions, sexp

  • <code>(function arg1 arg2 ... )</code>

  • <code>(print "hello world" (get-buffer "*scratch*"))</code>

    How many functions are in this list?

  • Quoting prevents evaluation

    (setq default-major-mode 'text-mode 1 )
                 

    1

    The quote operator (<code>'</code>) prevents <code>text-mode</code> from being evaluated.

  • Functions can also be arguments

  • This leads to a highly dynamic form of programming

  • All functions can be evaluated from a buffer.

  • Some Functions can be entered interactively.

3.2.8. Basic Customization

Table of Contents

3.2.8.1. Modes
3.2.8.2. auto fill mode
3.2.8.3. Mouse Wheel
3.2.8.4. Line and Column Numbers
3.2.8.5. Font Lock Mode (syntax highlighting)

3.2.8.1. Modes

  • Major Mode -- There can be only one

  • Minor Mode -- Adjustments

3.2.8.2. auto fill mode

M-x auto-fill-mode

To make it automatic you need to edit init file ~/.xemacs or ~/.emacs, and can add auto fill to other modes like cc mode.

(setq default-major-mode 'text-mode)
(setq text-mode-hook 'turn-on-auto-fill)
Can restart XEmacs or evaluate lisp code interactively by positioning the cursor at the end of each sexp you want to evaluate then chording <code>C-x C-e</code>

See XEmacs FAQ Q5.0.5

3.2.8.3. Mouse Wheel

(global-set-key '(button4) 'scroll-down-command)
(global-set-key '(button5) 'scroll-up-command)

See Wheel mouse setting

3.2.8.4. Line and Column Numbers

(line-number-mode 1)
(column-number-mode 1)

See XEmacs FAQ Q3.3.2

3.2.8.5. Font Lock Mode (syntax highlighting)

(require 'font-lock)
(setq-default font-lock-maximum-decoration t)  ;; Highest level of coloration

See XEmacs FAQ Q5.0.1 and XEmacs FAQ Q5.0.3

3.2.9. Adding A Date Insertion Function

Suppose we want to enter the current date frequently.

  • The function <code>current-time-string</code> provides the required information. If it is evaluated with <code>eval-print-last-sexp</code> it inserts the information, but with quotes.

    (current-time-string)C-j
    "Wed May 31 09:41:29 2006"
    
  • We can write a function to do what we want, which is insert rather than print

    (defun insert-current-time-string ()
      "Insert the current time at point"
      (insert (current-time-string)))C-x C-e
    
    (insert-current-time-string)C-x C-e Wed May 31 09:58:31 2006
    
  • Now if we want call the function interactivly we need to add the <code>interactive</code> declaration.

    (defun insert-current-time-string ()
      "Insert the current time at point"
      (interactive)
      (insert (current-time-string)))C-x C-e
    
    M-x insert-current-time-string
    
  • Lets bind it to a key to reduce typing

    (global-set-key 'f5 insert-time-string)C-x C-e
    
  • If interactivity is not required we can do it all in one step with a <code>lambda</code> (anonymous) function.

    (global-set-key 'f5 
         (lambda () (insert (current-time-string)))C-x C-e
    

3.2.10. CC mode

  • Works for C and C++

  • Highly customizable

  • M-x compile

  • Jump to next compile error C-x `

  • Can identify syntax errors

  • Try M-x function-menu

  • To add the function menu permantly put this in your .emacs file.

    (require 'func-menu)
    (add-hook 'find-file-hooks 'fume-add-menubar-entry)
    

3.2.11. The Most Current AUCTEX

  • AUCTEX is a sopistocated document editing system for TEX systems. It is available from the AUCTEX Homepage

  • The most current version is not yet available for automatic installation. So this is how to install it manually.

  • Download and verify the XEmacs package

    $ cd $HOME/dist
    $ wget -nv http://ftp.gnu.org/pub/gnu/auctex/auctex-11.82-pkg.tar.gz
    14:51:47 URL:http://ftp.gnu.org/pub/gnu/auctex/auctex-11.82-pkg.tar.gz [870092/870092] -> \
      "auctex-11.82-pkg.tar.gz" [1]
    
    $  wget -nv http://ftp.gnu.org/pub/gnu/auctex/auctex-11.82-pkg.tar.gz.sig
    14:52:35 URL:http://ftp.gnu.org/pub/gnu/auctex/auctex-11.82-pkg.tar.gz.sig [65/65] -> \
      "auctex-11.82-pkg.tar.gz.sig" [1]
    
    $ gpg --verify auctex-11.82-pkg.tar.gz.sig
    gpg: Signature made Mon Jan 16 10:03:42 2006 EST using DSA key ID 3C6B854E
    gpg: Good signature from "Reiner Steib <reiner.steib@gmx.de>"
    gpg: WARNING: This key is not certified with a trusted signature!
    gpg:          There is no indication that the signature belongs to the owner.
    Primary key fingerprint: FDC7 BB69 6D06 D80F 4412  BFD0 E222 255A 3C6B 854E
    

  • Default Package Heirarchies

    • Local and 3rd party packages <code>$prefix/lib/xemacs/site-packages</code>

    • MULE-enabled XEmacsen <code>$prefix/lib/xemacs/mule-packages</code>

    • Normal packages <code>$prefix/lib/xemacs/xemacs-packages</code>

    • User packages <code>$HOME/.xemacs/xemacs-packages</code>

  • Unpack the package

    $ cd $HOME/.xemacs
    $ mkdir xemacs-packages
    $ gunzip -c $HOME/dist/auctex-11.82-pkg.tar.gz | tar -xf -
    $ ls
    etc  info  lisp  man  pkginfo
    
    For more information see the XEmacs Manual

  • Make the LaTeX files available.

    $ cd $HOME/texmf/tex/latex
    $ ln -s /home/gdowdin/.xemacs/xemacs-packages/etc/auctex/latex auctex
    

  • Open a LaTeX File for some Eye Candy

3.2.12. TRAMP

3.2.13. Other Useful Modes

  • JDE Java

  • Python

  • Perl

  • Gnus

  • Mail

3.2.14. Resources