seagle0128 / grip-mode

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

grip server not starting after activating grip-mode #33

Closed tjtrabue closed 3 weeks ago

tjtrabue commented 4 weeks ago

Hello @seagle0128 ,

First of all, thank you so much for creating this awesome plugin! I have used it for years, and I just adore it. For some reason, I just started experiencing a new error where I am met with the following browser message after I activate M-x grip-mode in a Markdown buffer:

image

It looks like the server simply isn't starting, and when I run a ps command to list active processes, there is no grip process listed.

Here is my grip-mode configuration:

  (use-package grip-mode
    :after (markdown-mode org)
    :commands
    ;; Need to list all grip commands to be autoloaded
    (grip-browse-preview grip-restart-preview grip-start-preview grip-stop-preview)
    :custom
    ;; Path to the grip executable
    (grip-binary-path (executable-find "grip"))
    ;; Whether to refresh the preview after a change to the source file
    (grip-update-after-change t)
    ;; The host to use for previewing
    (grip-preview-host "localhost")
    ;; Whether to use embedded webkit to preview.  Requires GNU/Emacs version >=
    ;; 26 and compiled with `--with-xwidgets` option.
    (grip-preview-use-webkit (if (functionp 'xwidgetp) t nil))
    (grip-use-mdopen nil)
    ;; Number of seconds to wait before opening the preview to ensure the server starts
    (grip-sleep-time 2)
    ;; The preview color theme to use.
    ;; Should be one of: 'light, 'dark
    (grip-theme 'light)
    :init
    (require 'auth-source)
    ;; Set up list of authinfo files to check.
    (setq auth-sources my/authinfo-files)
    ;; Get user's GitHub credentials from ~/.authinfo
    (let ((credential (auth-source-user-and-password "api.github.com")))
      (setq grip-github-user (car credential)
            grip-github-password (cadr credential)))
    ;; Set keybindings for functions listed in the :commands block.
    (my/set-grip-keys-for-modes '(markdown-mode org-mode)))

I have tried upping my grip-sleep-time value to 8 seconds just in case the issue was the grip-mode trying to open the preview before the grip server had started, but I still get the same error. I have also cd'd into my repository's root directory where my README.md file is located and run the grip command manually, and this works just as expected, so grip is definitely working.

Emacs version: 31.0.50 development version 1e3d72d962b8 on master branch

Thank you so much, and please let me know if I can provide any additional information for you.

-tjtrabue

seagle0128 commented 4 weeks ago

Please check the output of the *grip-xxx* buffer. It seems the grip process is not started successfully.

tjtrabue commented 4 weeks ago

Strange. When I check my buffers list, I don't see a *grip-xxx* buffer anywhere. I also tried restarting Emacs with no custom grip-mode configuration and activating grip-mode, and I get the same issue I mentioned above, and I still don't see a *grip-xxx* buffer.

seagle0128 commented 4 weeks ago

Does grip exist in exec-path? Check with M-! which grip RET.

tjtrabue commented 3 weeks ago

Yes, my exec-path variable includes ~/.local/bin which is where grip is located.

My python version is: 3.13.0 Would this impact things at all?

seagle0128 commented 3 weeks ago

After enable grip-mode in the markdown buffer, please check grip-binary-path, grip--port and grip--process. Also check the messages and errors in the *Messages* buffer.

tjtrabue commented 3 weeks ago

Ok, after I activate grip-mode, this is what I see:

In the *Messages* buffer, the only message I see related to grip is:

Preview ‘/home/****/workspace/dotfiles/README.md’ on http://localhost:30118

I censored my username for privacy reasons, but other than that, the message is accurate.

seagle0128 commented 3 weeks ago

Can you visit http://localhost:30118 now? According to the information you provided, the grip process should be there, and the hidden buffer *grip-xxx* also should exist. Notice, one prefix space is in the buffer name.

tjtrabue commented 3 weeks ago

Unfortunately, no. When I go to http://localhost:30118 I get that "This site cannot be reached" page I originally posted.

seagle0128 commented 3 weeks ago

I think I found the root cause. In buffer *grip-xxx*, there are some messages like below. What OS are you using? I am testing on bot Linux and Windows. The latest grip (4.6.2) works on Linux, while not on Windows, since --theme argument is unsupported.

Usage:
  grip [options] [<path>] [<address>]
  grip -V | --version
  grip -h | --help

Process grip-10605 exited abnormally with code 1