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

[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)



reply via email to

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