Search This Blog

Wednesday, January 20, 2010

use emacs to generate highlighted code

1. set htmlize-output-type to 'inline-css

2. type the code in emacs, with the appropriate mode;

3. run the command htmlize-buffer, a new buffer will rise

4. replace "<body>" and "</body>" with "<div>" and "</div>", and cut the whole "div" (former "body") into editor of blogger (in html mode)

5. preview it. it looks exactly like in emacs.

Tuesday, January 19, 2010

How to set cursor shape using clx

Actually it's just the same as using xlib.

1. open a font named "cursor", it's a collection of different cursor shapes.

2. create a cursor object which can be used in somewhere like :cursor of window or grab-pointer.

example:

(defun create-cursor (char)
  (let ((cursor-font (xlib:open-font *display* "cursor"))
        (black (xlib:make-color :red 0.0 :green 0.0 :blue 0.0))
        (white (xlib:make-color :red 1.0 :green 1.0 :blue 1.0)))
    (xlib:create-glyph-cursor :source-font cursor-font
                              :source-char char
                              :mask-font cursor-font
                              :mask-char (1+ char)
                              :background black
                              :foreground white)))

(defvar *cursor* (create-cursor 68))

(setf (xlib:window-cursor screen-root) *cursor)

the effect is to make the default cursor shape an arrow (indicated by 68).

the char argument of create-cursor indicated the shape, which can be revealed as the screenshot below by running "xfd -fn cursor" in shell.


Wednesday, January 13, 2010

去死吧,spammer们

之前忙考试,没空收拾你们,这次全清理掉了。

to spammers: go back to hell.