xah emacs lisp mode

Perm URL with updates: http://ergoemacs.org/emacs/xah-elisp-mode.html

This is the home page of xah-elisp-mode, a major mode for emacs lisp

How's it diff from GNU Emacs's default emacs-lisp-mode?

Right now, the difference is that this package colors almost all elisp keywords.

  • Emacs lisp language words (⁖ defun, setq, let, if, car, cdr, list, …) are colored in one way.
  • Emacs text processing functions (⁖ point, goto-char, search-forward, insert, replace-regexp-in-string, …) are colored in another way.
  • Emacs builtin variables (⁖ hooks, nil, font-lock-defaults, fill-column, exec-path, …) are colored in another way.

The idea of simple keyword coloring is this:

  • If a function/variable name isn't colored, you know it's your own, or you made a typo.
  • Different type of keywords are colored differently. ⁖ elisp language function, emacs text processing functions.
  • disadvantage: this also means you may get colors in text where you may not want it to be. Any word, if it's a emacs lisp keyword, it'll be colored..

that's the basic idea.

Right now the mode is usable, but considered beta. I use it daily since .

Coloring Comparison

(defun mark-sexp (&optional arg allow-extend)
  "Set mark ARG sexps from point. …"
  (interactive "P\np")
  (cond ((and allow-extend
              (or (and (eq last-command this-command) (mark t))
                  (and transient-mark-mode mark-active)))
         (setq arg (if arg (prefix-numeric-value arg)
                     (if (< (mark) (point)) -1 1)))
         (set-mark
          (save-excursion
            (goto-char (mark))
            (forward-sexp arg)
            (point))))
        (t
         (push-mark
          (save-excursion
            (forward-sexp (prefix-numeric-value arg))
            (point))
          nil t))))
(defun mark-sexp (&optional arg allow-extend)
    "Set mark ARG sexps from point. …"
  (interactive "P\np")
  (cond ((and allow-extend
              (or (and (eq last-command this-command) (mark t))
                  (and transient-mark-mode mark-active)))
         (setq arg (if arg (prefix-numeric-value arg)
                     (if (< (mark) (point)) -1 1)))
         (set-mark
          (save-excursion
            (goto-char (mark))
            (forward-sexp arg)
            (point))))
        (t
         (push-mark
          (save-excursion
            (forward-sexp (prefix-numeric-value arg))
            (point))
          nil t))))

See also: Emacs Lisp Mode Syntax Coloring Problem

Features TODO

Download

download here: https://code.google.com/p/ergoemacs/source/browse/packages/xah-elisp-mode.el

elisp mode intro pledge

Want this mode to grow? Voice your support. 〈Emacs: new major modes for HTML, CSS, PHP, ELISP, and Lean Emacs LISP Manual〉 @ http://pledgie.com/campaigns/19973

Popular posts from this blog

Browser User Agent Strings 2012

11 Years of Writing About Emacs

does md5 creates more randomness?