;;; -*- Mode:LISP; Base:10 -*- zwei: (defcom com-count-chips "Count chips" () (let (start-bp end-bp) ;;find start of form where we typed C-Sh-E (setq start-bp (FORWARD-DEFUN (POINT) -1)) (when (null start-bp) (barf "Point in wrong place.")) ;;find end of form (setq end-bp (forward-list start-bp 1)) (when (null end-bp) (barf "Can't find end of form")) ;;C-K on next line (let ((next-bp (BEG-LINE end-bp 1 T))) (KILL-INTERVAL next-bp (END-LINE next-bp) T T) (multiple-value-bind (chips error-p) (ignore-errors (eval (read (zwei:interval-stream start-bp end-bp)))) (when error-p (barf "Can't parse chip list.") ) (insert next-bp (format nil "Total: ~d" chips)))) dis-text )) zwei:(COMMAND-STORE 'com-count-chips #/c-c *COMTAB*)