defunkt / gist.el

Yet another Emacs paste mode, this one for Gist.
550 stars 90 forks source link

gist-region results in `menu-bar-update-yank-menu: Wrong type argument: stringp, nil` #99

Closed jwiegley closed 7 years ago

jwiegley commented 7 years ago

I just upgraded gh.el, and now when I attempt to gist a region I get:

menu-bar-update-yank-menu: Wrong type argument: stringp, nil

It turns out that the object passed to gist-created-callback is returning nil when (oref gist :html-url) is called.

sigma commented 7 years ago

that seems to indicate a malformed gist object, since the html-url field is never optional in the github api responses. Any chance you can provide a dump of the gist object as given to gist-created-callback ? Preferably a public gist, so that I can try to make sense of whatever discrepancy there might be.

jwiegley commented 7 years ago

Sure, how do I dump such an object?

sigma commented 7 years ago

just edebug the gist-created-callback function, and that should dump the object in the *edebug-trace* buffer

jwiegley commented 7 years ago

OK, I had to enable edebug tracing. The output is:

{ gist-created-callback args: ([eieio-class-tag--gh-gist-gist nil nil nil nil nil nil nil nil nil nil nil
   [eieio-class-tag--gh-user unbound unbound unbound unbound unbound] nil nil])
jwiegley commented 7 years ago

That seems like a pretty empty object; it makes me wonder why the callback was even invoked.

sigma commented 7 years ago

yeah that's odd. could you run the following to see if you get something similar?

(oref (gh-gist-get (make-instance 'gh-gist-api) "4b951b73220fb355887f6fd404f756b5") :data)

I'm also going to add some more type-checking in gh.el. Hopefully that should make such issues generate errors earlier

jwiegley commented 7 years ago

For that command I get back a fully elaborated object:

[eieio-class-tag--gh-gist-gist "4b951b73220fb355887f6fd404f756b5" "https://api.github.com/gists/4b951b73220fb355887f6fd404f756b5" "https://gist.github.com/4b951b73220fb355887f6fd404f756b5"
                               ([eieio-class-tag--gh-gist-gist-file "*scratch*.el" 4 "https://gist.githubusercontent.com/sigma/4b951b73220fb355887f6fd404f756b5/raw/b6601b5f799d6851b5501181abd2f58b3c77259b/*scratch*.el" "plop"])
                               nil "" "2016-11-12T01:48:52Z" "2016-11-12T06:39:26Z" "https://gist.github.com/4b951b73220fb355887f6fd404f756b5.git" "https://gist.github.com/4b951b73220fb355887f6fd404f756b5.git" 1
                               [eieio-class-tag--gh-user 16090 "https://api.github.com/users/sigma" "https://github.com/sigma" "sigma" nil]
                               ([eieio-class-tag--gh-gist-history-entry
                                 [eieio-class-tag--gh-user 16090 "https://api.github.com/users/sigma" "https://github.com/sigma" "sigma" nil]
                                 "8bc658b86fd8d81b0f27063d3a693e3c36102464" "2016-11-12T01:48:52Z"
                                 [eieio-class-tag--gh-gist-history-change 1 1 0]
                                 "https://api.github.com/gists/4b951b73220fb355887f6fd404f756b5/8bc658b86fd8d81b0f27063d3a693e3c36102464"])
                               nil]
jwiegley commented 7 years ago

@sigma Further thoughts? I'm really missing effortless gist integration, powered by gh.el. :) Sending pastes to co-workers takes much longer now.

sigma commented 7 years ago

so, the thing is I'm unable to reproduce this issue (on GNU Emacs 25.1.1). Which I suppose is good news cause there should be a way to make this work :)

From there, there are a few things that might help (and shouldn't hurt anyway):

jwiegley commented 7 years ago

@sigma Try updating all the dependencies, and removing all pcache directories, but still get the same problem. I'm not using any proxies, since I'm trying this from home.

sigma commented 7 years ago

@jwiegley which version(s) of Emacs did you try that with?

jwiegley commented 7 years ago

I'm using 25.2pre, basically.

sigma commented 7 years ago

hmm that's really odd, I just built the tip of the emacs-25 branch (3f2b497cdddcf1f124f1c9f94354d5f457a4070f), started from an empty $HOME, installed gist.el from melpa, and still can't reproduce

jwiegley commented 7 years ago

@sigma Thanks for reminding me that I should have isolated it that way from the beginning. I'll narrow it down.

jwiegley commented 7 years ago

@sigma I've pared down to just this init.el, with no other settings, and I'm still getting the same problem, even after deleting all cache products relating to any of these libraries. Here's the entirety of my configuration now:

(add-to-list 'load-path "~/emacs/lisp/use-package")
(require 'use-package)
(use-package dash           :defer t :load-path "lib/dash-el")
(use-package gh             :defer t :load-path "lib/gh-el")
(use-package ht             :defer t :load-path "lib/ht-el")
(use-package logito         :defer t :load-path "lib/logito")
(use-package marshal        :defer t :load-path "lib/marshal-el")
(use-package pcache         :defer t :load-path "lib/pcache")
(use-package s              :defer t :load-path "lib/s-el")
(use-package tablist        :defer t :load-path "lib/tablist")
(use-package gist
  :load-path "site-lisp/gist"
  :bind ("C-c G" . gist-region-or-buffer))

I'm not loading any customization settings, or any other file besides use-package and these libraries, all of which I updated just now.

jwiegley commented 7 years ago

If you can't reproduce, I won't leave this open. I've restored my ability to gist by using a command-line gist utility that integrates nicely with Emacs.