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

Safer convert to filename #65

Merged
merged 2 commits into from
Jan 8, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions markdown-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -5489,14 +5489,16 @@ and [[test test]] both map to Test-test.ext."
(file-name-extension (buffer-file-name))))))
(current default))
(catch 'done
(cl-loop
(if (or (file-exists-p current)
(not markdown-wiki-link-search-parent-directories))
(throw 'done current))
(if (string-equal (expand-file-name current)
(concat "/" default))
(throw 'done default))
(setq current (concat "../" current)))))))
(condition-case nil
(cl-loop
(if (or (not markdown-wiki-link-search-parent-directories)
(file-exists-p current))
(throw 'done current))
(if (string-equal (expand-file-name current)
(concat "/" default))
(throw 'done default))
(setq current (concat "../" current)))
(error default))))))

(defun markdown-follow-wiki-link (name &optional other)
"Follow the wiki link NAME.
Expand Down Expand Up @@ -5543,7 +5545,7 @@ and highlight accordingly."
(file-name
(markdown-convert-wiki-link-to-filename
(markdown-wiki-link-link))))
(if (file-exists-p file-name)
(if (condition-case nil (file-exists-p file-name) (error nil))
(markdown-highlight-wiki-link
highlight-beginning highlight-end markdown-link-face)
(markdown-highlight-wiki-link
Expand Down