[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 218/255: call functions when pressing enter on the list
From: |
Eric Schulte |
Subject: |
[elpa] 218/255: call functions when pressing enter on the list |
Date: |
Sun, 16 Mar 2014 01:02:51 +0000 |
eschulte pushed a commit to branch go
in repository elpa.
commit b1c7ad558686a70348238e3c106e2871c97e6799
Author: Eric Schulte <address@hidden>
Date: Wed Aug 7 00:17:39 2013 -0600
call functions when pressing enter on the list
---
list-buffer.el | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/list-buffer.el b/list-buffer.el
index c4503f3..7af6a0b 100644
--- a/list-buffer.el
+++ b/list-buffer.el
@@ -38,13 +38,22 @@
(defvar *buffer-width* nil
"Width associated with the current list buffer.")
-(defun list-buffer-create (buffer list &optional headers)
+(defvar *enter-function* nil
+ "Function used to enter a list element.
+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)
(pop-to-buffer buffer)
(list-mode)
(set (make-local-variable '*buffer-width*) (window-total-width))
(set (make-local-variable '*buffer-list*) list)
(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*))))))
;; refresh every time the buffer changes size
(set (make-local-variable 'window-size-change-functions)
(cons (lambda (b)
@@ -126,7 +135,7 @@
(defun list-enter ()
(interactive)
- (funcall *list-enter-function* (nth (list-current-row) *buffer-list*)))
+ (funcall *enter-function* (list-current-row) (list-current-col)))
(defun list-filter ()
(interactive)
- [elpa] 231/255: refresh message, (continued)
- [elpa] 231/255: refresh message, Eric Schulte, 2014/03/15
- [elpa] 239/255: backend for GTP through arbitrary process, Eric Schulte, 2014/03/15
- [elpa] 232/255: gtp-num-to-char is being called but is undefined, Eric Schulte, 2014/03/15
- [elpa] 234/255: don't truncate lines in go boards, Eric Schulte, 2014/03/15
- [elpa] 221/255: organize notes, Eric Schulte, 2014/03/15
- [elpa] 180/255: scattered changes from a while ago, Eric Schulte, 2014/03/15
- [elpa] 252/255: fix copyright headers, Eric Schulte, 2014/03/15
- [elpa] 251/255: Add 'packages/el-go/' from commit 'd127d39d34392eb54627fee0cfb85a35fc231fb2', Eric Schulte, 2014/03/15
- [elpa] 255/255: adding file-ending comments to all source files, Eric Schulte, 2014/03/15
- [elpa] 249/255: adding `go-dead' to the API, Eric Schulte, 2014/03/15
- [elpa] 218/255: call functions when pressing enter on the list,
Eric Schulte <=
- [elpa] 230/255: optionally ignore IGS shouts, Eric Schulte, 2014/03/15