|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
;; cheap-face.el - a cheap way to specify a few faces for ascii screenshots.
;; Copyleft 2007, Eduardo Ochs <eduardoochs@gmail.com>.
;; Current version: 2007mar12.
;; Source: <http://angg.twu.net/elisp/cheap-face.el>
;; Htmlized: <http://angg.twu.net/elisp/cheap-face.el.html>
;; (find-eevfile "eev-glyphs.el")
;; (eval-buffer)
(setq cheap-face-plist '(
"\^A" cheap-face-1
"\^B" cheap-face-2
"\^C" cheap-face-3
"\^D" cheap-face-4
"\^E" cheap-face-5
"\^F" cheap-face-6
))
(defface cheap-face-0 nil "")
(defface cheap-face-1 nil "")
(defface cheap-face-2 nil "")
(defface cheap-face-3 nil "")
(defface cheap-face-4 nil "")
(defface cheap-face-5 nil "")
(defface cheap-face-6 nil "")
;; (find-ecolors)
(set-face-background 'cheap-face-0 "gray10")
(set-face-background 'cheap-face-1 "gray22")
(set-face-foreground 'cheap-face-2 "gold2")
(set-face-foreground 'cheap-face-3 "royalblue1")
(set-face-foreground 'cheap-face-4 "red2")
(set-face-foreground 'cheap-face-5 "green")
(set-face-foreground 'cheap-face-6 "forestgreen")
;; (find-eleimfile "quail/sgml-input.el" "•")
;; (find-eevfile "eev-glyphs.el")
(eev-set-glyph 0 183 'cheap-face-0)
(eev-set-glyph 1 342434 'cheap-face-1)
(eev-set-glyph 2 342434 'cheap-face-2)
(eev-set-glyph 3 342434 'cheap-face-3)
(eev-set-glyph 4 342434 'cheap-face-4)
(eev-set-glyph 5 342434 'cheap-face-5)
(eev-set-glyph 6 342434 'cheap-face-6)
;; (find-efaces)
;; font-lock-function-name-face
;; font-lock-string-face
;; font-lock-variable-name-face
;; font-lock-type-face
;; (find-efunctiondescr 'plist-get)
;; (find-elnode "Other Plists")
;; (find-elnode "Narrowing")
;; (find-elnode "Regexp Search")
(defun cheap-face-apply1 (s e)
(interactive "r")
(let* ((c (buffer-substring-no-properties s (+ s 1)))
(face (lax-plist-get cheap-face-plist c)))
(put-text-property s (+ s 1) 'invisible t)
(put-text-property (+ s 1) e 'face face)))
(setq cheap-face-regexp "[\000-\^F][^\000-\^F]*")
(defun cheap-face-apply (s e)
(interactive "r")
(save-excursion
(save-restriction
(narrow-to-region s e)
(goto-char (min s e))
(while (re-search-forward cheap-face-regexp (point-max) 'noerror)
(cheap-face-apply1 (match-beginning 0) (match-end 0))))))
;; (find-elnode "Prefix Command Arguments")
;; cheap-face: facify or unfacify a region
;;
(defun cheap-face (s e)
(interactive "r")
(if current-prefix-arg
(remove-text-properties s e '(face nil invisible nil))
(cheap-face-apply s e)))
(eeb-define 'cfb 'cheap-face "\n;;*\n" nil t t)
;;*
;; Lua 5.1.1 Copyright (C) 1994-2006 Lua.org, PUC-Rio
;; > print(2 +
;; >> 3, 4)
;; 5 4
;; >
;;*
;; Local Variables:
;; coding: raw-text-unix
;; modes: (emacs-lisp-mode fundamental-mode)
;; End: