Subject: 23.2; Crash in x_draw_image_glyph_string (also in 24.0)

From: Anders Waldenborg <[email-masked]>
Date: Mon, 14 Jun 2010 21:56:34 +0200

Emacs crashes in x_draw_image_glyph_string when running the script below
(which creates lots of images and image-refresh calls of said images)
and forcing X-window exposures (which is easily done by moving the frame
halfway out of the screen and moving it around there so parts reexposed
- after 10-20 times or so it crashes here). s->img is NULL. Removing the
call to image-refresh in the script below makes the crash disappear (but
instead the pixmap mem used in the X server increases a lot - see bug
#6230).

The same thing happens in a fresh git checkout (GNU Emacs 24.0.50.1
(i686-pc-linux-gnu, GTK+ Version 2.20.1) of 2010-06-14 on
leonov). Compiling it with -DXASSERTS=1 it triggers the xassert
(s->img); in fill_image_glyph_string, with the following backtrace:

(gdb) bt
#0  abort () at emacs.c:437
#1  0x0806c534 in fill_image_glyph_string (s=0xbfffb130) at xdisp.c:21063
#2  0x0806f556 in draw_glyphs (w=<value optimized out>,
     x=<value optimized out>, row=<value optimized out>, area=TEXT_AREA,
     start=<value optimized out>, end=1, hl=DRAW_NORMAL_TEXT, overlaps=0)
     at xdisp.c:21640
#3  0x08070b3a in expose_area (w=<value optimized out>,
     row=<value optimized out>, r=0x7c, area=TEXT_AREA) at xdisp.c:25516
#4  0x08070ce1 in expose_line (w=0x8706648, row=0x8695d60, r=0xbfffb380)
     at xdisp.c:25544
#5  0x08073abd in expose_window (w=0x8706648, fr=<value optimized out>)
     at xdisp.c:25770
#6  0x08073e52 in expose_window_tree (w=0x8706648, r=<value optimized out>)
     at xdisp.c:25843
#7  0x0807efea in expose_frame (f=0x87064c8, x=123, y=0, w=0, h=595)
     at xdisp.c:25900
#8  0x080ed01e in handle_one_xevent (dpyinfo=0x85ebc30,
     eventp=<value optimized out>, finish=<value optimized out>,
     hold_quit=0xbfffc114) at xterm.c:6224
#9  0x080ee3f9 in event_handler_gdk (gxev=0xbfffbbe0, ev=0x88f1190, 
data=0x0)
     at xterm.c:5845
#10 0xb7bb4cf0 in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#11 0xb7bb6992 in ?? () from /usr/lib/libgdk-x11-2.0.so.0
---Type <return> to continue, or q <return> to quit---
#12 0xb7bb6daf in ?? () from /usr/lib/libgdk-x11-2.0.so.0
#13 0xb77f72f5 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#14 0xb77fafd8 in ?? () from /lib/libglib-2.0.so.0
#15 0xb77fb1b8 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#16 0xb7d2dc24 in gtk_main_iteration () from /usr/lib/libgtk-x11-2.0.so.0
#17 0x080e98ca in XTread_socket (terminal=0x1, expected=1, 
hold_quit=0x86bbd38)
     at xterm.c:7218
#18 0x0812b030 in read_avail_input (expected=1) at keyboard.c:7015
#19 0x0812b16a in handle_async_input () at keyboard.c:7330
#20 0x0812b335 in process_pending_signals () at keyboard.c:7346
#21 0x081cd0b6 in Fbyte_code (bytestr=136456417, vector=136456437, 
maxdepth=28)
     at bytecode.c:535
#22 0x08195b04 in funcall_lambda (fun=<value optimized out>,
     nargs=<value optimized out>, arg_vector=0x0) at eval.c:3260
#23 0x08193933 in Ffuncall (nargs=3, args=0xbfffc310) at eval.c:3130
#24 0x081cc801 in Fbyte_code (bytestr=136456417, vector=136456437, 
maxdepth=28)
     at bytecode.c:680
#25 0x08195b04 in funcall_lambda (fun=<value optimized out>,
     nargs=<value optimized out>, arg_vector=0x0) at eval.c:3260
#26 0x08193933 in Ffuncall (nargs=3, args=0xbfffc490) at eval.c:3130
#27 0x081cc801 in Fbyte_code (bytestr=136456417, vector=136456437, 
maxdepth=28)
     at bytecode.c:680
#28 0x08195b04 in funcall_lambda (fun=<value optimized out>,
---Type <return> to continue, or q <return> to quit---
     nargs=<value optimized out>, arg_vector=0x0) at eval.c:3260
#29 0x08193933 in Ffuncall (nargs=3, args=0xbfffc610) at eval.c:3130
#30 0x081cc801 in Fbyte_code (bytestr=136456417, vector=136456437, 
maxdepth=28)
     at bytecode.c:680
#31 0x08195b04 in funcall_lambda (fun=<value optimized out>,
     nargs=<value optimized out>, arg_vector=0x0) at eval.c:3260
#32 0x08193933 in Ffuncall (nargs=2, args=0xbfffc790) at eval.c:3130
#33 0x081cc801 in Fbyte_code (bytestr=136456089, vector=136456109, 
maxdepth=8)
     at bytecode.c:680
#34 0x08195b04 in funcall_lambda (fun=<value optimized out>,
     nargs=<value optimized out>, arg_vector=0x0) at eval.c:3260
#35 0x08193933 in Ffuncall (nargs=2, args=0xbfffc958) at eval.c:3130
#36 0x08195193 in Fapply (nargs=2, args=0xbfffc958) at eval.c:2516
#37 0x081951dd in apply1 (fn=136456053, arg=143290134) at eval.c:2840
#38 0x08195577 in Feval (form=143290150) at eval.c:2472
#39 0x0819597d in Fprogn (args=142206486) at eval.c:416
#40 0x08195bf9 in funcall_lambda (fun=<value optimized out>,
     nargs=<value optimized out>, arg_vector=0x0) at eval.c:3253
#41 0x08195d03 in apply_lambda (fun=143290246, args=143288870, eval_flag=1)
     at eval.c:3184
#42 0x081953e4 in Feval (form=143288878) at eval.c:2474
#43 0x08195cd1 in apply_lambda (fun=142209102, args=143288886, eval_flag=1)
     at eval.c:3171
---Type <return> to continue, or q <return> to quit---
#44 0x081953e4 in Feval (form=143288894) at eval.c:2474
#45 0x08195830 in Fsetq (args=143288902) at eval.c:518
#46 0x08195762 in Feval (form=143288910) at eval.c:2361
#47 0x0819597d in Fprogn (args=143288918) at eval.c:416
#48 0x08195bf9 in funcall_lambda (fun=<value optimized out>,
     nargs=<value optimized out>, arg_vector=0x0) at eval.c:3253
#49 0x08195d03 in apply_lambda (fun=143288830, args=142139110, eval_flag=1)
     at eval.c:3184
#50 0x081953e4 in Feval (form=142139166) at eval.c:2474
#51 0x0819597d in Fprogn (args=144336182) at eval.c:416
#52 0x08195762 in Feval (form=144336190) at eval.c:2361
#53 0x0819597d in Fprogn (args=144336198) at eval.c:416
#54 0x081964f0 in Flet (args=144336206) at eval.c:1088
#55 0x08195762 in Feval (form=144336214) at eval.c:2361
#56 0x0819557f in Feval (form=142139174) at eval.c:2472
#57 0x0819597d in Fprogn (args=144340742) at eval.c:416
#58 0x08196300 in Fwhile (args=144340822) at eval.c:1110
#59 0x08195762 in Feval (form=144340830) at eval.c:2361
#60 0x0819597d in Fprogn (args=144340846) at eval.c:416
#61 0x08196693 in FletX (args=144340870) at eval.c:1032
#62 0x08195762 in Feval (form=144340878) at eval.c:2361
#63 0x0819597d in Fprogn (args=144340910) at eval.c:416
#64 0x08192f41 in internal_catch (tag=140671826, func=0x8195950 <Fprogn>,
---Type <return> to continue, or q <return> to quit---
     arg=144340910) at eval.c:1246
#65 0x081957ed in Fcatch (args=144340942) at eval.c:1214
#66 0x08195762 in Feval (form=144340950) at eval.c:2361
#67 0x08195520 in Feval (form=144340966) at eval.c:2399
#68 0x0819557f in Feval (form=144340902) at eval.c:2472
#69 0x0819557f in Feval (form=142140454) at eval.c:2472
#70 0x0819597d in Fprogn (args=144508550) at eval.c:416
#71 0x08195762 in Feval (form=142131022) at eval.c:2361
#72 0x0819597d in Fprogn (args=142131158) at eval.c:416
#73 0x08195762 in Feval (form=142141446) at eval.c:2361
#74 0x08195db2 in Funwind_protect (args=142141518) at eval.c:1352
#75 0x08195762 in Feval (form=142141526) at eval.c:2361
#76 0x0819597d in Fprogn (args=142141622) at eval.c:416
#77 0x08188a76 in Fsave_current_buffer (args=142141622) at editfns.c:1040
#78 0x08195762 in Feval (form=142141630) at eval.c:2361
#79 0x0819557f in Feval (form=142141550) at eval.c:2472
#80 0x0819597d in Fprogn (args=142141558) at eval.c:416
#81 0x081964f0 in Flet (args=142141566) at eval.c:1088
#82 0x08195762 in Feval (form=142141574) at eval.c:2361
#83 0x0819557f in Feval (form=142131086) at eval.c:2472
#84 0x0819557f in Feval (form=142140646) at eval.c:2472
#85 0x08195830 in Fsetq (args=142140654) at eval.c:518
#86 0x08195762 in Feval (form=142140662) at eval.c:2361
---Type <return> to continue, or q <return> to quit---
#87 0x0819597d in Fprogn (args=144508766) at eval.c:416
#88 0x08188a76 in Fsave_current_buffer (args=144508766) at editfns.c:1040
#89 0x08195762 in Feval (form=144508758) at eval.c:2361
#90 0x0819557f in Feval (form=142140766) at eval.c:2472
#91 0x0819597d in Fprogn (args=142040494) at eval.c:416
#92 0x08196693 in FletX (args=142140774) at eval.c:1032
#93 0x08195762 in Feval (form=142141014) at eval.c:2361
#94 0x0819597d in Fprogn (args=144511126) at eval.c:416
#95 0x08195762 in Feval (form=144511118) at eval.c:2361
#96 0x08195762 in Feval (form=144510990) at eval.c:2361
#97 0x0819557f in Feval (form=142141030) at eval.c:2472
#98 0x0819597d in Fprogn (args=142040510) at eval.c:416
#99 0x081964f0 in Flet (args=142141038) at eval.c:1088
#100 0x08195762 in Feval (form=142141094) at eval.c:2361
#101 0x0819597d in Fprogn (args=142040518) at eval.c:416
#102 0x08195bf9 in funcall_lambda (fun=<value optimized out>,
     nargs=<value optimized out>, arg_vector=0x0) at eval.c:3253
#103 0x08193933 in Ffuncall (nargs=2, args=0xbfffe334) at eval.c:3130
#104 0x08195193 in Fapply (nargs=2, args=0xbfffe334) at eval.c:2516
#105 0x08193ba6 in Ffuncall (nargs=3, args=0xbfffe330) at eval.c:3054
#106 0x081cc801 in Fbyte_code (bytestr=137058993, vector=137059021,
     maxdepth=16) at bytecode.c:680
#107 0x081956da in Feval (form=137058982) at eval.c:2420
---Type <return> to continue, or q <return> to quit---
#108 0x08196212 in internal_lisp_condition_case (var=138367146,
     bodyform=137058982, handlers=136459006) at eval.c:1455
#109 0x081cba5a in Fbyte_code (bytestr=137058849, vector=137058869,
     maxdepth=20) at bytecode.c:870
#110 0x08195b04 in funcall_lambda (fun=<value optimized out>,
     nargs=<value optimized out>, arg_vector=0x0) at eval.c:3260
#111 0x08193933 in Ffuncall (nargs=2, args=0xbfffe6e8) at eval.c:3130
#112 0x08194c65 in call1 (fn=138391962, arg1=144071445) at eval.c:2868
#113 0x0812cdb6 in timer_check_2 (do_it_now=1) at keyboard.c:4561
#114 timer_check (do_it_now=1) at keyboard.c:4612
#115 0x0812d07b in readable_events (flags=1) at keyboard.c:3547
#116 0x0812feff in get_input_pending (flags=1, addr=<value optimized out>)
     at keyboard.c:6887
#117 0x08130127 in detect_input_pending_run_timers (do_display=1)
     at keyboard.c:10597
#118 0x081d41e5 in wait_reading_process_output (time_limit=30, microsecs=0,
     read_kbd=-1, do_display=1, wait_for_cell=138367146, wait_proc=0x0,
     just_wait_proc=0) at process.c:5002
#119 0x08059620 in sit_for (timeout=120, reading=1, do_display=1)
     at dispnew.c:6274
#120 0x08131eea in read_char (commandflag=1, nmaps=2, maps=0xbfffee00,
     prev_event=138367146, used_mouse_menu=0xbfffeeb8, end_time=0x0)
     at keyboard.c:2819
---Type <return> to continue, or q <return> to quit---
#121 0x08132e6e in read_key_sequence (keybuf=<value optimized out>,
     bufsize=<value optimized out>, prompt=<value optimized out>,
     dont_downcase_last=0, can_return_switch_frame=1, fix_current_buffer=1)
     at keyboard.c:9402
#122 0x081351b3 in command_loop_1 () at keyboard.c:1636
#123 0x08192e61 in internal_condition_case (bfun=0x8134fe0 
<command_loop_1>,
     handlers=138398010, hfun=0x812f030 <cmd_error>) at eval.c:1510
#124 0x0812ecc5 in command_loop_2 () at keyboard.c:1356
#125 0x08192f41 in internal_catch (tag=138396130,
     func=0x812eca0 <command_loop_2>, arg=138367146) at eval.c:1246
#126 0x0812ee7f in command_loop () at keyboard.c:1335
#127 0x0812f21b in recursive_edit_1 () at keyboard.c:950
#128 0x0812f342 in Frecursive_edit () at keyboard.c:1012
#129 0x0812420c in main (argc=<value optimized out>,
     argv=<value optimized out>) at emacs.c:1801

Lisp Backtrace:
"backquote-process" (0xbfffc314)
"backquote-process" (0xbfffc494)
"backquote-process" (0xbfffc614)
"backquote-process" (0xbfffc794)
0x8222775 PVEC_COMPILED
"`" (0xbfffc9d8)
---Type <return> to continue, or q <return> to quit---
"vrend--mtx-rotate" (0xbfffca80)
"vrend--mtx-mul3x3" (0xbfffcc28)
"setq" (0xbfffccd8)
"vrend-rotate" (0xbfffcd80)
"progn" (0xbfffcee8)
"let" (0xbfffcff8)
"vrend-with-saved-matrix" (0xbfffd088)
"while" (0xbfffd158)
"let*" (0xbfffd248)
"catch" (0xbfffd408)
"cl-block-wrapper" (0xbfffd498)
"block" (0xbfffd528)
"loop" (0xbfffd5b8)
"progn" (0xbfffd668)
"progn" (0xbfffd718)
"unwind-protect" (0xbfffd7c8)
"save-current-buffer" (0xbfffd898)
"with-current-buffer" (0xbfffd928)
"let" (0xbfffda38)
"with-temp-buffer" (0xbfffdac8)
"vrend" (0xbfffdb58)
"setq" (0xbfffdc08)
"save-current-buffer" (0xbfffdcd8)
---Type <return> to continue, or q <return> to quit---
"with-current-buffer" (0xbfffdd68)
"let*" (0xbfffde58)
"progn" (0xbfffdf08)
"if" (0xbfffdf98)
"when" (0xbfffe028)
"let" (0xbfffe138)
"vrend-clock-update-buffer" (0xbfffe338)
"apply" (0xbfffe334)
"byte-code" (0xbfffe3f4)
"timer-event-handler" (0xbfffe6ec)

;;;;;;;;;;;
;;;;;;;;;;; START EXAMPLE SCRIPT
;;;;;;;;;;;

;;; Beta quality code - use at own risk

;;; Copyright (C) 2010 Anders Waldenborg
;;; I'll add a GPL header or something like that here later...

;;; Small example on how to use vrend.

;;; Defines the command vrend-clock which creates a new buffer,
;;; Make sure you resize the window/frame and stuff like that.

(require 'cl)

; vrend.el inline here...
(defconst vrend-2pi (* 8.0 (atan 1.0)))

(defun vrend--mtx-col (mtx col)
   "Get column col in matrix mtx"
   (mapcar '(lambda (v) (aref v col)) mtx))

(defun vrend--mtx-row (mtx row)
   "Get row row in matrix mtx"
   (mapcar 'identity (aref mtx row)))

(defun vrend--mtx-ref (i j)
   "Get an element in current matrix"
   (aref (aref vrend--curr-mtx i) j))

(defun vrend--dotprod (l r)
   "dot product of l and r"
   (if (or l r)
       (+ (* (car l) (car r)) (vrend--dotprod (cdr l) (cdr r)))
     0))

(defun vrend--mtx-mul3x3 (l r)
   "Matrix multiplication of two 3x3 matrices"
   `[[,(vrend--dotprod (vrend--mtx-row l 0) (vrend--mtx-col r 0)) 
,(vrend--dotprod (vrend--mtx-row l 0) (vrend--mtx-col r 1)) 
,(vrend--dotprod (vrend--mtx-row l 0) (vrend--mtx-col r 2))]
     [,(vrend--dotprod (vrend--mtx-row l 1) (vrend--mtx-col r 0)) 
,(vrend--dotprod (vrend--mtx-row l 1) (vrend--mtx-col r 1)) 
,(vrend--dotprod (vrend--mtx-row l 1) (vrend--mtx-col r 2))]
     [,(vrend--dotprod (vrend--mtx-row l 2) (vrend--mtx-col r 0)) 
,(vrend--dotprod (vrend--mtx-row l 2) (vrend--mtx-col r 1)) 
,(vrend--dotprod (vrend--mtx-row l 2) (vrend--mtx-col r 2))]])

(defun vrend--mtx-translate (dx dy)
   "translationmatrix for dx dy"
   `[[1.0 0.0 ,dx]
     [0.0 1.0 ,dy]
     [0.0 0.0 1.0]])

(defun vrend--mtx-rotate (rot)
   "rotationmatrix for rot radians"
   `[[,(cos rot) ,(- (sin rot)) 0.0]
     [,(sin rot)  ,(cos rot)     0.0]
     [       0.0         0.0    1.0]])

(defun vrend--mtx-scale (sx sy)
   "scalingmatrix"
   `[[,sx 0.0 0.0]
     [0.0 ,sy 0.0]
     [0.0 0.0 1.0]])

(defun vrend--mtx-ident ()
   "identitymatrix"
   [[1.0 0.0 0.0]
    [0.0 1.0 0.0]
    [0.0 0.0 1.0]])

(defun vrend-path-start (x y)
   "Start a new path at specified position"
   (setq vrend--curr-path nil)
   (vrend-path-moveto x y))

(defun vrend-path-moveto (x y)
   "Move point in current path to specified position"
   (add-to-list 'vrend--curr-path (list ?M x y)))

(defun vrend-path-lineto (x y)
   "Add a line segment to specified position."
   (add-to-list 'vrend--curr-path (list ?L x y)))

(defun vrend-path-close ()
   "Close current path"
   (add-to-list 'vrend--curr-path (list ?Z)))

(defun vrend-rotate (deg)
   ""
   (setq vrend--curr-mtx (vrend--mtx-mul3x3 vrend--curr-mtx 
(vrend--mtx-rotate deg))))

(defun vrend-scale (sx sy)
   ""
   (setq vrend--curr-mtx (vrend--mtx-mul3x3 vrend--curr-mtx 
(vrend--mtx-scale (float sx) (float sy)))))

(defun vrend-translate (dx dy)
   ""
   (setq vrend--curr-mtx (vrend--mtx-mul3x3 vrend--curr-mtx 
(vrend--mtx-translate (float dx) (float dy)))))

(defun vrend--render-path-element (e)
   (format "%c %s" (car e) (mapconcat '(lambda (x) (format "%f" x)) (cdr 
e) " ")))

(defun vrend--render-path ()
   (insert " d=\"" (mapconcat 'vrend--render-path-element (reverse 
vrend--curr-path) " ") "\""))

(defun vrend--render-transform ()
   (insert (format " transform=\"matrix(%f %f %f %f %f %f)\"" 
(vrend--mtx-ref 0 0) (vrend--mtx-ref 1 0) (vrend--mtx-ref 0 1) 
(vrend--mtx-ref 1 1) (vrend--mtx-ref 0 2) (vrend--mtx-ref 1 2))))

(defun vrend-path-stroke ()
   (insert "  <path")
   (vrend--render-path)
   (vrend--render-transform)
   (insert " fill=\"none\"")
   (insert " stroke=\"" (car vrend--curr-strokestyle) "\"")
   (insert " stroke-width=\"0.04\"")
   (insert " />\n"))

(defmacro vrend-with-saved-matrix (&rest body)
   (declare (indent 0) (debug t))
   `(let ((vrend-with-saved-matrix-saved-matrix vrend--curr-mtx))
      (progn
        ,@body
        (setq vrend--curr-mtx vrend-with-saved-matrix-saved-matrix))))

(defmacro vrend (width height coordinatetype &rest body)
   (declare (indent 3) (debug t))
   (let ((width (eval width))
	(height (eval height)))
   `(with-temp-buffer
       (set (make-local-variable 'vrend--curr-mtx) (vrend--mtx-ident))
       (set (make-local-variable 'vrend--curr-path) nil)
       (set (make-local-variable 'vrend--curr-strokestyle) '("black" 
:width 1))
       (set (make-local-variable 'vrend--curr-fillstyle) nil)

       (insert "<?xml version=\"1.0\" standalone=\"no\"?>\n"
	      "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n"
	      "  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"
	      (format "<svg width=\"%d\" height=\"%d\"\n" ,width ,height)
	      "     xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\">\n")

       (when ,coordinatetype
	(vrend-translate ,(/ width 2) ,(/ height 2))

	(when (eq ,coordinatetype '1x1fit)
	  (let ((smalldir ,(min width height)))
	    (vrend-scale (/ smalldir 2.0) (/ smalldir 2.0))))

	(when (eq ,coordinatetype '1x1square)
	  (vrend-scale ,(/ width 2.0) ,(/ height 2.0)))

	(vrend-scale -1.0 -1.0))

       (progn
	,@body)

       (insert "</svg>\n")
       (create-image (buffer-string) nil t)
       )))

(provide 'vrend)

(defun vrend-clock-update-buffer (buf)
   (let ((win (get-buffer-window buf t)))
     (when win
       (let* ((X (window-inside-pixel-edges win))
	     (w (- (car (cddr X)) (car X)))
	     (h (- (cadr (cddr X)) (cadr X))))
	(with-current-buffer buf
	  (erase-buffer)
	  (ignore-errors
	   (when vrend-clock-image
	     (image-refresh vrend-clock-image t)))
	  (setq vrend-clock-image
		(vrend w h '1x1fit
			  ;; Make hour markers...
			  (vrend-path-start 0.0 0.8)
			  (vrend-path-lineto 0.0 0.9)
			  (vrend-path-close)

			  ;; ...12 of them
			  (loop for D from 0 to 11 by 1
				do (vrend-with-saved-matrix
				     (vrend-rotate (* D (/ vrend-2pi 12)))
				     (vrend-path-stroke)))

			  ;; and arrows
			  (let* ((ct (current-time))
				 (T (decode-time ct))
				 (h (nth 2 T))
				 (m (nth 1 T))
				 (s (nth 0 T))
				 (ms (/ (nth 2 ct) 1000))
				 (seconds-since-midnight (+ (* (+ (* h 60) m) 60) s))
				 (seconds-since-hour (+ (* m 60) s))
				 (ms-since-minute (+ ms (* s 1000))))
			    (vrend-with-saved-matrix
			      (vrend-path-start 0.0 0.0)
			      (vrend-path-lineto -0.05 0.4)
			      (vrend-path-lineto 0.0 0.6)
			      (vrend-path-lineto 0.05 0.4)
			      (vrend-path-close)
			      (vrend-rotate (* seconds-since-midnight (/ vrend-2pi (* 60 60 
12))))
			      (vrend-path-stroke))
			    (vrend-with-saved-matrix
			      (vrend-path-start 0.0 0.0)
			      (vrend-path-lineto -0.05 0.3)
			      (vrend-path-lineto 0.0 0.90)
			      (vrend-path-lineto 0.05 0.3)
			      (vrend-path-close)
			      (vrend-rotate (* seconds-since-hour (/ vrend-2pi (* 60 60))))
			      (vrend-path-stroke))
			    (vrend-with-saved-matrix
			      (vrend-path-start 0.0 0.0)
			      (vrend-path-lineto 0.0 0.90)
			      (vrend-path-close)
			      (vrend-rotate (* ms-since-minute (/ vrend-2pi 60000.0)))
			      (vrend-path-stroke)))))
		(insert-image vrend-clock-image)
		(redisplay t)
		(redraw-frame (window-frame win)))))))

(defun vrend-kill-buffer-hook ()
   (cancel-timer vrend-clock-timer))

(defun vrend-clock ()
   (interactive)
   (with-current-buffer (generate-new-buffer "*aw-clock*")
     (set-window-buffer nil (current-buffer))
     (make-local-variable 'vrend-clock-timer)
     (make-local-variable 'vrend-clock-image)
     (setq vrend-clock-image nil)
     (add-hook 'kill-buffer-hook 'vrend-kill-buffer-hook nil t)

     (setq vrend-clock-timer (run-at-time nil 0.1 
'vrend-clock-update-buffer (current-buffer)))))

(vrend-clock)

In GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0)
  of 2010-05-16 on raven, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
configured using `configure  '--build' 'i486-linux-gnu' '--build' 
'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' 
'--libexecdir=/usr/lib' '--localstatedir=/var/lib' 
'--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' 
'--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.2/leim' 
'--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 
'build_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 
'CPPFLAGS=''

Important settings:
   value of $LC_ALL: nil
   value of $LC_COLLATE: nil
   value of $LC_CTYPE: nil
   value of $LC_MESSAGES: nil
   value of $LC_MONETARY: nil
   value of $LC_NUMERIC: nil
   value of $LC_TIME: nil
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: nil
   locale-coding-system: utf-8-unix
   default enable-multibyte-characters: t

Major mode: C/l

Minor modes in effect:
   flyspell-mode: t
   shell-dirtrack-mode: t
   which-function-mode: t
   show-paren-mode: t
   tooltip-mode: t
   mouse-wheel-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t
   abbrev-mode: t

Recent input:
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> C-x o <up> <up> <up> <up> <up> <up> <up>
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <help-echo> C-x o C-s C-s C-s C-s <up> C-x o
<prior> C-s b u i l d _ g l y C-s <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <up> <up>
<up> <up> <up> <up> <up> <up> C-s b u i l d _ i m a
g e _ g l C-s C-s <down> <down> <down> C-s f i l l
_ i m a g e _ g l y <help-echo> C-s C-s <down> <down>
<down> <down> <down> C-a C-e C-a C-e C-a C-e C-a C-e
<left> C-a C-e <left> C-a C-e <left> C-e <return> <tab>
C-x o C-s f p r i n t C-s C-a C-SPC <down> <escape>
w C-x o C-y <up> <tab> <C-right> <C-right> <C-right>
<C-right> <left> <left> <backspace> d SPC % d C-e <left>
<left> <C-backspace> <C-backspace> s - > i m g - >
i d , SPC <up> <up> <C-left> <C-left> <C-left> C-k
C-y <down> <down> <backspace> <backspace> C-y C-k <right>
C-x C-s C-x o C-x b x t <return> C-s x a s s e r t
C-s C-s C-s C-s C-s C-r C-r <up> <down> C-c w <down-mouse-1>
<mouse-1> <return> <backspace> C-x C-s C-x 1 C-x b
<return> C-x b <return> C-x b t e r <right> <return>
<return> <backspace> C-x C-s C-x b <return> M-x r e
p <tab> o <tab> r <tab> <tab> <return>

Recent messages:
Mark saved where search started
Mark set [4 times]
Saving file /home/andersg/emacs/src/xdisp.c...
Wrote /home/andersg/emacs/src/xdisp.c
Mark saved where search started
Saving file /home/andersg/emacs/src/xdisp.c...
Wrote /home/andersg/emacs/src/xdisp.c
Saving file /home/andersg/emacs/src/xterm.c...
Wrote /home/andersg/emacs/src/xterm.c
Making completion list... [2 times]

Load-path shadows:
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-history hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-history
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-ratpoison hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-ratpoison
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-alert hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-alert
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-awesome hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-awesome
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-search hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-search
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-time hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-time
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-browse hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-browse
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-socks5 hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-socks5
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-events hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-events
/usr/share/emacs23/site-lisp/emacs-jabber/srv hides 
/usr/share/emacs/site-lisp/emacs-jabber/srv
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-muc-nick-completion 
hides /usr/share/emacs/site-lisp/emacs-jabber/jabber-muc-nick-completion
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-bookmarks hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-bookmarks
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-feature-neg hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-feature-neg
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-logon hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-logon
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-menu hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-menu
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-chatstates hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-chatstates
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-ahc-presence hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-ahc-presence
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-export hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-export
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-festival hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-festival
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-truncate hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-truncate
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-avatar hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-avatar
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-xml hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-xml
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-register hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-register
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-si-client hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-si-client
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-autoaway hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-autoaway
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-conn hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-conn
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-muc hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-muc
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-gmail hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-gmail
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-chat hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-chat
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-widget hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-widget
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-ft-common hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-ft-common
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-ft-client hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-ft-client
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-ahc hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-ahc
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-chatbuffer hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-chatbuffer
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-modeline hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-modeline
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-core hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-core
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-version hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-version
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-si-server hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-si-server
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-private hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-private
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-keymap hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-keymap
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-util hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-util
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-ft-server hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-ft-server
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-activity hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-activity
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-newdisco hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-newdisco
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-xmessage hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-xmessage
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-sasl hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-sasl
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-screen hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-screen
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-vcard-avatars hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-vcard-avatars
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-wmii hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-wmii
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-vcard hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-vcard
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-iq hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-iq
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-watch hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-watch
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-si-common hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-si-common
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-sawfish hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-sawfish
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-disco hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-disco
/usr/share/emacs23/site-lisp/emacs-jabber/fsm hides 
/usr/share/emacs/site-lisp/emacs-jabber/fsm
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-ourversion hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-ourversion
/usr/share/emacs23/site-lisp/emacs-jabber/jabber hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-keepalive hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-keepalive
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-osd hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-osd
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-presence hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-presence
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-compose hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-compose
/usr/share/emacs23/site-lisp/emacs-jabber/jabber-roster hides 
/usr/share/emacs/site-lisp/emacs-jabber/jabber-roster
/usr/share/emacs23/site-lisp/mailcrypt/mc-pgp6 hides 
/usr/share/emacs/site-lisp/mailcrypt/mc-pgp6
/usr/share/emacs23/site-lisp/mailcrypt/expect hides 
/usr/share/emacs/site-lisp/mailcrypt/expect
/usr/share/emacs23/site-lisp/mailcrypt/mc-toplev hides 
/usr/share/emacs/site-lisp/mailcrypt/mc-toplev
/usr/share/emacs23/site-lisp/mailcrypt/mc-pgp5 hides 
/usr/share/emacs/site-lisp/mailcrypt/mc-pgp5
/usr/share/emacs23/site-lisp/mailcrypt/mc-gpg hides 
/usr/share/emacs/site-lisp/mailcrypt/mc-gpg
/usr/share/emacs23/site-lisp/mailcrypt/mc-remail hides 
/usr/share/emacs/site-lisp/mailcrypt/mc-remail
/usr/share/emacs23/site-lisp/mailcrypt/mc-pgp hides 
/usr/share/emacs/site-lisp/mailcrypt/mc-pgp
/usr/share/emacs23/site-lisp/mailcrypt/mc-setversion hides 
/usr/share/emacs/site-lisp/mailcrypt/mc-setversion
/usr/share/emacs23/site-lisp/mailcrypt/mailcrypt hides 
/usr/share/emacs/site-lisp/mailcrypt/mailcrypt
/usr/share/emacs/23.2/site-lisp/debian-startup hides 
/usr/share/emacs/site-lisp/debian-startup
/usr/share/emacs23/site-lisp/semi/pgg-pgp5 hides 
/usr/share/emacs/23.2/lisp/pgg-pgp5
/usr/share/emacs23/site-lisp/semi/pgg-gpg hides 
/usr/share/emacs/23.2/lisp/pgg-gpg
/usr/share/emacs23/site-lisp/semi/pgg-parse hides 
/usr/share/emacs/23.2/lisp/pgg-parse
/usr/share/emacs23/site-lisp/flim/sha1 hides /usr/share/emacs/23.2/lisp/sha1
/usr/share/emacs23/site-lisp/flim/md4 hides /usr/share/emacs/23.2/lisp/md4
/usr/share/emacs23/site-lisp/flim/hex-util hides 
/usr/share/emacs/23.2/lisp/hex-util
/usr/share/emacs23/site-lisp/semi/pgg-def hides 
/usr/share/emacs/23.2/lisp/pgg-def
/usr/share/emacs23/site-lisp/semi/pgg-pgp hides 
/usr/share/emacs/23.2/lisp/pgg-pgp
/usr/share/emacs23/site-lisp/semi/pgg hides /usr/share/emacs/23.2/lisp/pgg
/usr/share/emacs/site-lisp/rst hides 
/usr/share/emacs/23.2/lisp/textmodes/rst
/usr/share/emacs23/site-lisp/dictionaries-common/flyspell hides 
/usr/share/emacs/23.2/lisp/textmodes/flyspell
/usr/share/emacs23/site-lisp/dictionaries-common/ispell hides 
/usr/share/emacs/23.2/lisp/textmodes/ispell
/usr/share/emacs23/site-lisp/flim/sasl hides 
/usr/share/emacs/23.2/lisp/net/sasl
/usr/share/emacs23/site-lisp/flim/hmac-md5 hides 
/usr/share/emacs/23.2/lisp/net/hmac-md5
/usr/share/emacs23/site-lisp/flim/sasl-cram hides 
/usr/share/emacs/23.2/lisp/net/sasl-cram
/usr/share/emacs23/site-lisp/flim/hmac-def hides 
/usr/share/emacs/23.2/lisp/net/hmac-def
/usr/share/emacs23/site-lisp/flim/sasl-ntlm hides 
/usr/share/emacs/23.2/lisp/net/sasl-ntlm
/usr/share/emacs23/site-lisp/flim/sasl-digest hides 
/usr/share/emacs/23.2/lisp/net/sasl-digest
/usr/share/emacs23/site-lisp/flim/ntlm hides 
/usr/share/emacs/23.2/lisp/net/ntlm
/usr/share/emacs23/site-lisp/wl/rfc2368 hides 
/usr/share/emacs/23.2/lisp/mail/rfc2368

Features:
(shadow sort mailcrypt mail-extr message sendmail ecomplete rfc822 mml
mml-sec mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047
rfc2045 qp ietf-drums mailabbrev nnheader mm-util mail-prsvr gmm-utils
wid-edit mailheader canlock sha1 sha1-el hex-util hashcash mail-utils
warnings emacsbug help-mode view thingatpt multi-isearch flyspell ispell
cc-mode cc-fonts easymenu cc-menus cc-cmds tramp-imap assoc tramp-gw
tramp-fish tramp-smb tramp-cache tramp-ftp tramp-cmds tramp auth-source
gnus-util netrc shell password-cache format-spec tramp-compat trampver
newcomment vc-git time-date aw-main aw-ido ido aw-python aw-uniquify
uniquify advice help-fns advice-preload aw-c-mode cc-styles cc-align
cc-engine cc-vars cc-defs regexp-opt aw-key-bindings aw-flymake flymake
aw-woman aw-yankmenu aw-appearance which-func imenu paren compile comint
ring mailcrypt-init jabber-autoloads tooltip ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset
image fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev loaddefs button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process dbusbind
system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)