From e63350ce3940cf673211a25daf2e8858bbe8a7a4 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Mon, 24 Nov 2014 12:39:28 +0000 Subject: Implement paging --- sx-view.el | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'sx-view.el') diff --git a/sx-view.el b/sx-view.el index 69060ea..9a7c3fd 100644 --- a/sx-view.el +++ b/sx-view.el @@ -32,12 +32,18 @@ :type 'string :group 'stack-exchange) -(defmacro sx-view--define-page (page) +(defmacro sx-view--define-page (page &optional printer refresher pager) "Define a stack-exchange page called PAGE. Page is a capitalized string. This defines a command `sx-view-PAGE' for displaying the page, -and a variable `sx-view--PAGE-buffer' for holding the bufer." +and a variable `sx-view--PAGE-buffer' for holding the bufer. + +The arguments PRINTER, REFRESHER, and PAGER, if non-nil, are +respectively used to set the value of the variables +`sx-question-list--print-function', +`sx-question-list--refresh-function', and +`sx-question-list--next-page-function'." (declare (indent 1) (debug t)) (let* ((name (downcase page)) (buffer-variable @@ -69,6 +75,12 @@ If SITE is nil, use `sx-view-default-site'." ;; Fill the buffer with content. (with-current-buffer ,buffer-variable (sx-question-list-mode) + (when printer + (setq sx-question-list--next-page-function printer)) + (when refresher + (setq sx-question-list--refresh-function refresher)) + (when pager + (setq sx-question-list--print-function pager)) (setq sx-question-list--current-site site) (setq sx-question-list--current-page ,page) (sx-question-list-refresh 'redisplay no-update)) -- cgit v1.2.3