emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 228/255: refresh the game list buffer


From: Eric Schulte
Subject: [elpa] 228/255: refresh the game list buffer
Date: Sun, 16 Mar 2014 01:02:53 +0000

eschulte pushed a commit to branch go
in repository elpa.

commit 809f1c8dceba40172ce86c031898483b4a1edd4f
Author: Eric Schulte <address@hidden>
Date:   Thu Aug 8 11:41:59 2013 -0600

    refresh the game list buffer
---
 back-ends/igs.el |    4 +++-
 list-buffer.el   |   23 ++++++++++++++++++++---
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/back-ends/igs.el b/back-ends/igs.el
index 2136448..619d9ab 100644
--- a/back-ends/igs.el
+++ b/back-ends/igs.el
@@ -215,7 +215,9 @@ This is used to re-send messages to keep the IGS server 
from timing out.")
      '("#" "white" "rk" "black" "rk" "move" "size" "H" "Komi" "by" "fr" "#")
      (lambda (row col)
        (let ((id (car (nth row *buffer-list*))))
-         (with-igs instance (igs-observe id)))))))
+         (with-igs instance (igs-observe id))))
+     (lambda (row col)
+       (igs-get-games instance)))))
 
 
 ;;; Specific handlers
diff --git a/list-buffer.el b/list-buffer.el
index 2657107..ce65a31 100644
--- a/list-buffer.el
+++ b/list-buffer.el
@@ -44,7 +44,14 @@ The function should take two arguments, the current row and
 column respectively and may access the current buffer list
 through the `*buffer-list*' variable.")
 
-(defun list-buffer-create (buffer list &optional headers enter-function)
+(defvar *refresh-function* nil
+  "Function used to refresh a list element or the whole list.
+The function should take two arguments, the current row and
+column respectively and may access the current buffer list
+through the `*buffer-list*' variable.")
+
+(defun list-buffer-create
+  (buffer list &optional headers enter-function refresh-function)
   (pop-to-buffer buffer)
   (list-mode)
   (set (make-local-variable '*buffer-width*) (window-total-width))
@@ -52,8 +59,13 @@ through the `*buffer-list*' variable.")
   (set (make-local-variable '*buffer-headers*)
        (mapcar (curry #'format "%s") headers))
   (set (make-local-variable '*enter-function*)
-       (or enter-function (lambda (row col)
-                            (message "%S" (nth col (nth row *buffer-list*))))))
+       (or enter-function
+           (lambda (row col)
+             (message "enter %S" (nth col (nth row *buffer-list*))))))
+  (set (make-local-variable '*refresh-function*)
+       (or refresh-function
+           (lambda (row col)
+             (message "refresh %S" (nth col (nth row *buffer-list*))))))
   ;; refresh every time the buffer changes size
   (set (make-local-variable 'window-size-change-functions)
        (cons (lambda (b)
@@ -137,6 +149,10 @@ through the `*buffer-list*' variable.")
   (interactive)
   (funcall *enter-function* (list-current-row) (list-current-col)))
 
+(defun list-refresh ()
+  (interactive)
+  (funcall *refresh-function* (list-current-row) (list-current-col)))
+
 (defun list-filter ()
   (interactive)
   (error "not implemented."))
@@ -168,6 +184,7 @@ through the `*buffer-list*' variable.")
     (define-key map (kbd "<up>")            'list-up)
     (define-key map (kbd "<down>")          'list-down)
     (define-key map (kbd "f")               'list-filter)
+    (define-key map (kbd "r")               'list-refresh)
     (define-key map (kbd "RET")             'list-enter)
     (define-key map (kbd "q")               'bury-buffer)
     map)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]