Closed krescent closed 1 year ago
I tested on my macbook, and it works well. I don't understand what's your problem.
Thank you for your contribution to open source. =)
Let me elaborate the problem:
Time 0: emacs open .md file, browser opened a page, let say in port 10000.
Time 1: edit .md file, don't need to save, browser refresh the updated content automatically in page with port 10000.
Time 0: Emacs open .org file, browser opened a page, let say in port 10000.
Time 1: edit .org file, and save, browser opened a new page, with port 20000.
No. The port won't be changed unless the grip process is restarted.
Yes, the back end port that serve for org is still the port 10000, but the problem is, each time I press C-x C-s to save org file, it will open a new tab with different port number.
Also an interesting phenomenon I did see is, while I try to open an org file, the browser page will show server unavailable for one second, and then display the content.
I think you should figure out why a new tab will be displayed while saving the org buffers. Can you reproduce the issue with emacs -Q
?
Also an interesting phenomenon I did see is, while I try to open an org file, the browser page will show server unavailable for one second, and then display the content.
It's as expected since grip process may not be started completely at that moment.
With -Q, the browser doesn't even start when I load markdown/org file.
With -Q, you also need to load the necessary packages, like grip-mode, markdown, etc.
I encountered the same issue using hooks, and after I set my init file to
(use-package grip-mode
:ensure t
:after (:any org markdown-mode)
:bind ("C-c g" . grip-mode) ;; Make a keybinding: `C-c g'
:init
(setq grip-binary-path "/Library/Frameworks/Python.framework/Versions/3.7/bin/grip")) ;; I add this just because I have multiple grip
The issue fades away. I experimented a bit, seems that if I use the bind key instead of the hook, the update will be in the same tab for both markdown and org file. Hope this helps.
(Actually I like the bind key better, cuz for reveal and my init.org, I do not really want to preview them.)
@seagle0128 Also may I ask what you mean that
ox-gfm is optional.
in README? How could I combine ox-gfm with this?(sorry I am green in emacs) You seems already used
org-gfm-export-to-markdown
in your code? Is that already something from ox-gfm?
@FloraSun9101 You can install ox-gfm
in your init.el
file and use org-gfm-export-to-markdown
.
My configuration is here: https://github.com/seagle0128/.emacs.d/blob/master/lisp/init-org.el#L171.
@seagle0128 Thanks for the fast reply! The way you organized the emacs config is neat!
I do not think ox-gfm
makes any difference to grip-mode:
I just set up ox-gfm
and rendered the file via org-gfm-export-to-markdown
. Then I compared the markdown file rendered during grip-mode
preview and the markdown file rendered from org-gfm-export-to-markdown
using diff
at terminal, they are pretty much the same except the generated hyperlink ID.
Then I commented out the ox-gfm
set up and restart emacs. Compared the markdown generated from grip-mode
and the org-gfm-export-to-markdown
result(somehow it still runs), and they are still the same.
Then I compared grip-mode
generated markdown with\without ox-gfm
, they are still the same.
My setup for ox-gfm
basing your config file:
(use-package ox-gfm
:ensure t
:defer t
:init
(add-to-list 'org-export-backends 'md)
(with-eval-after-load 'counsel
(bind-key [remap org-set-tags-command] #'counsel-org-tag org-mode-map)))
@FloraSun9101 You should check org-export-to-file
. The backend is different (md vs gfm) although you don't feel any difference in your cases.
macOS 11.6.1, with Emacs 27.2.
When using grip-mode with markdown, everything work smooth and fine.
While using org-mode, the browser will start the preview correctly in opening. After that, each time I press C-x C-s to save the change, it will open another web page with a new random port, but the connection is failed.
The saved content could be checked by manually refreshing the page, which is created when the org file open.