Giter Club home page Giter Club logo

Comments (3)

legumbre avatar legumbre commented on August 22, 2024

I'm interested in this feature too. AIUI there's no pagination support in gh.el, so gist-list will abide by the 30 items per page default in the github v3 API. I've hacked together a small workaround, but it's just a kludge. Unfortunately I'm not familiar enough with gh.el to come up with a clean fix, at least not for now.

In case anyone finds it useful, here's the code. You can list the nth page with C-u n M-x gist-list-page

(defmethod gh-gist-list ((api gh-gist-api) &optional username)
  (gh-api-authenticated-request
   api (gh-object-list-reader (oref api gist-cls)) "GET"
   (format "/users/%s/gists" (or username (gh-api-get-username api)))))

(defvar gist-list-items-per-page 40)
(defun gist-list-page (&optional page)
  "Display a list of the gists for the `page' page. Page size is given by `gist-list-items-per-page'"
  (interactive "p")
  (let ((api (gist-get-api nil)))
    (let ((resp (gh-gist-list-page api nil (or page 1))))
      (gh-api-add-response-callback
       resp 'gist-lists-retrieved-callback))))

(defmethod gh-gist-list-page ((api gh-gist-api) &optional username page)
  (gh-api-authenticated-request
   api (gh-object-list-reader (oref api gist-cls)) "GET"
   (format "/users/%s/gists?page=%d&per_page=%d" 
           (or username (gh-api-get-username api)) 
           (or page 1) gist-list-items-per-page)))

from gist.el.

sigma avatar sigma commented on August 22, 2024

thanks for the workaround. I'll try to think of something to introduce generic support for paging in gh.el

from gist.el.

sigma avatar sigma commented on August 22, 2024

this should finally work as expected since version 1.0.3

from gist.el.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.