Show
Ignore:
Timestamp:
03/31/08 22:27:35 (5 years ago)
Author:
miyamuko
Message:

lang/xyzzy/hatena-bookmark-star-viewer: 色をつけた。

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/xyzzy/hatena-bookmark-star-viewer/site-lisp/hatena-bookmark-star-viewer.l

    r7719 r8573  
    66;; 
    77;; Author: MIYAMUKO Katsuyuki <miyamuko@gmail.com> 
    8 ;; Version: 0.1 
     8;; Version: 0.3 
    99;; Keywords: hatena, star, bookmark 
    1010;; 
     
    6565          )) 
    6666 
     67(defmacro with-color ((&rest color) &body body) 
     68  (let ((s (gensym))) 
     69    `(let ((,s (buffer-stream-point *standard-output*))) 
     70       (progn ,@body) 
     71       (set-text-attribute ,s (buffer-stream-point *standard-output*) nil ,@color)))) 
     72(setf (get 'with-color 'ed::lisp-indent-hook) 'with-output-to-buffer) 
     73 
    6774(defmacro puts (fmt &rest args) 
    68   `(format t ,fmt ,@args)) 
     75  `(progn 
     76     (toggle-read-only nil) 
     77     (format t ,fmt ,@args) 
     78     (toggle-read-only t))) 
    6979 
    7080(defmacro $ (item alist) 
     
    107117    (unless (get-buffer-window b) 
    108118      (split-window (- (truncate (/ (window-height) 2)))) 
    109       (set-buffer b)))) 
     119      (set-buffer b) 
     120      (view-mode) 
     121      ))) 
    110122 
    111123(defun render-hatena-star/bookmark (buffer uri entry bookmark) 
     
    146158          (puts "はてなブックマーク数: ~A~%~%" (or ($ "count" bookmark) "0")) 
    147159          (dolist (b ($ "bookmarks" bookmark)) 
    148             (puts "~A ~A ~{[~A]~}~A~%" 
    149                   ($ "timestamp" b) ($ "user" b) 
    150                   ($ "tags" b) ($ "comment" b))) 
     160            (with-color (:foreground 15) 
     161              (puts "~A ~A ~{[~A]~}~%~%" 
     162                    ($ "timestamp" b) ($ "user" b) 
     163                    ($ "tags" b))) 
     164            (let ((c ($ "comment" b))) 
     165              (when (and c (string/= c "")) 
     166                (puts "~A~%~%" c)))) 
    151167          (puts "\n") 
    152168          (when (and ($ "count" bookmark) (string/= ($ "count" bookmark) "0"))