seagle0128 / grip-mode

Instant Github-flavored Markdown/Org preview using grip
GNU General Public License v3.0
269 stars 6 forks source link

Centeur emacs org preview show internal error #13

Closed ZhengshuaiPENG closed 4 years ago

ZhengshuaiPENG commented 4 years ago

Hi seagle0218,

I am using centaur emacs now and I want to preview my org file. But when I use M-x grip-mode, the web page shows me 500

Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

And I saw there was a md file generated.

I already installed python3 and grip in my system (OSX), is there any way to debug it?

And here are outputs in the message buffer

Saving file /Users/zhengshuai.peng/Workspace/notes/ProductResearch/Hologres/hologres_summary.md...
Wrote /Users/zhengshuai.peng/Workspace/notes/ProductResearch/Hologres/hologres_summary.md
Preview ‘/Users/zhengshuai.peng/Workspace/notes/ProductResearch/Hologres/hologres_summary.org’ on http://localhost:61059
mwheel-scroll: Beginning of buffer
Quit
Process ‘grip-61059’ killed
ZhengshuaiPENG commented 4 years ago

In addition, I saw the command in emacs like image

grip version: 4.5.2 It seems that - Grip is not supported in grip command

seagle0128 commented 4 years ago

The command is incorrect. user and password are not set. I have no idea why they are nil.

;; A GitHub username for API authentication
(setq grip-github-user "")

;; A GitHub password or auth token for API auth
(setq grip-github-password "")
ZhengshuaiPENG commented 4 years ago

Thanks for your reply I added these configurations in custom.el in my centaur config image I also tried to upgrade all centaur configuration and packages to lastest yesterday. The only changed file is custom.el is there any idea?

seagle0128 commented 4 years ago
  1. M-x list-process
  2. Open grip process buffer like *grip-xxxx*.
  3. Check the logs.
ZhengshuaiPENG commented 4 years ago

Hi seagle0128,

I checked the process log image Seems that it's an authorization issue.

So the problem is my configuration is not correct? it doesn't take effect when set them in custom.el

ZhengshuaiPENG commented 4 years ago

I also tried use (setq-default grip-github-user "xxx") and (setq-default grip-github-password "xxx"). No luck with this way.

Tried another way, use customize-group, I saw the grip-github-user is nil, tried to edit it, but I can't apply and save

image

ZhengshuaiPENG commented 4 years ago

Rootcause Found In .emacs.d/lisp/init-markdown.el image

If I changed grip-github-user and grip-github-password here, the preview works.

I don't understand that in this code snipper

(setq grip-github-user (car credential)
     grip-github-password (cadr credential)

how (car credential) to get the user name and the password

seagle0128 commented 4 years ago

Please update Centaur Emacs.

ZhengshuaiPENG commented 4 years ago

Hi, @seagle0128

Thanks for your update.

I create a ~/.authinfo and put login {user_name} password {token}, the grip mode works.

But I found that if I just set the (setq grip-github-user "{user_name}) and (setq grip-github-password "{token}") in my custom.el by following the README, the grip mode still doesn't work.

Is there a way that make grip mode work when I set these in my custome.el?

seagle0128 commented 4 years ago

I believe it works.