+(defvar lurk-history-index nil)
+
+(defun lurk-history-cycle (delta)
+ (when lurk-history
+ (with-current-buffer "*lurk*"
+ (if lurk-history-index
+ (setq lurk-history-index
+ (max 0
+ (min (- (length lurk-history) 1)
+ (+ delta lurk-history-index))))
+ (setq lurk-history-index 0))
+ (delete-region lurk-input-marker (point-max))
+ (insert (elt lurk-history lurk-history-index)))))
+
+(defun lurk-history-next ()
+ (interactive)
+ (lurk-history-cycle -1))
+
+(defun lurk-history-prev ()
+ (interactive)
+ (lurk-history-cycle +1))