2013-05-04

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

emacs: convert hex rgb color to hsl format

more improved. Emacs: Xah CSS Mode. You can now convert RGB hex color under cursor to HSL format (⁖ #aabbcchsl(210,25%,73%)). Call xcm-hex-color-to-hsl.

why should you convert? because, #rrggbb is one of the hack from history. HSL model isn't perfect, but is much more intuitive. You can change the hue, saturation, and lightness. For some explanation of HSL model and color samples, see: CSS3 HSL (Hue, Saturation, Lightness) Color Samples.

2013-05-02

Emacs: new major modes for HTML, CSS, PHP, ELISP, and Lean Emacs LISP Manual

Emacs: project proposal.

Vote which one you want me to work on. Tell your friends please. http://pledgie.com/campaigns/19973