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

markdown-live-preview-mode errors for buffers without file #200

Closed
xiongtx opened this issue Jun 15, 2017 · 1 comment
Closed

markdown-live-preview-mode errors for buffers without file #200

xiongtx opened this issue Jun 15, 2017 · 1 comment

Comments

@xiongtx
Copy link
Contributor

xiongtx commented Jun 15, 2017

Expected behavior

markdown-live-preview-mode should gracefully fail for markdown buffers with no backing file.

Actual behavior

markdown-live-preview-mode throws a wrong-type-argument error.

This is because (markdown-live-preview-get-filename) is nil for such buffers, which causes markdown-live-preview-remove to call file-exists-p on nil.

Steps to reproduce (recipe)

  1. Create a markdown-mode buffer without a backing file.
  2. Call markdown-live-preview-mode

Backtraces if necessary (M-x toggle-debug-on-error)

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-exists-p(nil)
  (if (file-exists-p outfile-name) (progn (delete-file outfile-name)))
  (let ((outfile-name (markdown-live-preview-get-filename))) (if (file-exists-p outfile-name) (progn (delete-file outfile-name))))
  (progn (let ((outfile-name (markdown-live-preview-get-filename))) (if (file-exists-p outfile-name) (progn (delete-file outfile-name)))))
  (if (eq markdown-live-preview-delete-export (quote delete-on-destroy)) (progn (let ((outfile-name (markdown-live-preview-get-filename))) (if (file-exists-p outfile-name) (progn (delete-file outfile-name))))))
  markdown-live-preview-remove()
  (if markdown-live-preview-mode (markdown-display-buffer-other-window (markdown-live-preview-export)) (markdown-live-preview-remove))
  ...  

Describe versions of markdown-mode, Emacs, OS, etc.

  • markdown-mode: 20170614.1152
  • Emacs: 25.1.1
  • OS: Fedora 24
xiongtx added a commit to xiongtx/markdown-mode that referenced this issue Jun 15, 2017
xiongtx added a commit to xiongtx/markdown-mode that referenced this issue Jun 15, 2017
xiongtx added a commit to xiongtx/markdown-mode that referenced this issue Jun 15, 2017
xiongtx added a commit to xiongtx/markdown-mode that referenced this issue Jun 15, 2017
xiongtx added a commit to xiongtx/markdown-mode that referenced this issue Jun 15, 2017
jrblevin pushed a commit that referenced this issue Jun 15, 2017
@jrblevin
Copy link
Owner

Merged. Thanks for the report and patch!

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

No branches or pull requests

2 participants