Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow rendering for buffers without a name/path #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Allow rendering for buffers without a name/path #8

wants to merge 1 commit into from

Conversation

der-daniel
Copy link

@der-daniel der-daniel commented Aug 22, 2016

Like stated in Issue #7, I was not able to render Markdown in a buffer without or with a strange name.
I made some minor changed to write such buffer to /tmp/ or the setq'd output-dir.

I also removed the file extension check, since it does not provide any sanity. If you render a non Markdown file nothing dramatic happens. 😄

Thanks for this nice Package.
I hope the will make its way into the project.

Feel free to criticize changes I made.

For Frodo,
Daniel

This commit enables renderings of buffers without a name, thus without
a path. Therefore you cannot use '(buffer-file-name)' though it returns
nil if the buffer has not been saved yet.
To be able to use things like 'Edit in Emacs' (Chrome Extensions) you
need to have a mechanism to save such buffers.
@mola-T
Copy link
Owner

mola-T commented Aug 28, 2016

Sorry for late reply.

I think checking for file extension is necessary. "If you render a non Markdown file nothing dramatic happens." That's not accurate because a .md file is still tried to be generated regardless the source constantly.

Generally, you can edit flymd-markdown-file-type to allow other file types. However, I think you problem is you tried to use flymd-flyit in temp buffer (ie. without a saved file). Is it the case? If yes, I could add some workaround.

Having absolute path /tmp/ is not preferred. Windows user may have unexpected error with the path. If you want to change the output path, you can customize flymd-output-directory.

Thanks

@der-daniel
Copy link
Author

Hi,

yes I tried it with a temp buffer.
I am using it with "Edit with Emacs" Chrome Extension.

Please add a Word Around.

For Frodo

@nixjdm
Copy link

nixjdm commented Aug 28, 2017

Unless the act of generating markdown causes some serious side effect that like breaking emacs, I'm inclined to agree with @der-daniel's original statement that it's unnecessary to check the file extension, and actually detrimental. A file's extension is no guarantee of its contents. It's fairly common for markdown files to not have an extension at all, for instance. If flymd tries to render a non-markdown file as markdown, what's the problem? The user has asked for something non-nonsensical, and that's what they'll get. It may look garbled, but that's their fault.

I'm in favor of taking that requirement out. More will be gained from removing this requirement than keeping it, in my opinion. I was just about to post an issue for this, but I discovered this pull request first.

P.S. @der-daniel You should run M-x delete-trailing-whitespace on your code. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants