From 443a599639f42930a812bbd0da9905ebcd72d076 Mon Sep 17 00:00:00 2001 From: Jason Blevins Date: Fri, 6 May 2016 13:54:14 -0400 Subject: [PATCH] Better backwards compatibility for url-parse --- markdown-mode.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/markdown-mode.el b/markdown-mode.el index b84c6cc..f617b15 100644 --- a/markdown-mode.el +++ b/markdown-mode.el @@ -6197,13 +6197,14 @@ If the link is a complete URL, open in browser with `browse-url'. Otherwise, open with `find-file' after stripping anchor and/or query string." (interactive) (if (markdown-link-p) - (let* ((link (markdown-link-link)) - (struct (and (featurep 'url-parse) (url-generic-parse-url link)))) - (if (or (null struct) (url-fullness struct)) - ;; Open full URLs in browser - (browse-url link) - ;; Strip query string and open partial URLs in Emacs - (find-file (car (url-path-and-query struct))))) + (let* ((link (markdown-link-link)) (struct nil) (full t) (file link)) + ;; Parse URL, determine fullness, strip query string + (when (featurep 'url-parse) + (setq struct (url-generic-parse-url link) + full (url-fullness struct) + file (car (url-path-and-query struct)))) + ;; Open full URLs in browser, files in Emacs + (if full (browse-url link) (find-file file))) (error "Point is not at a Markdown link or URI"))) -- 2.11.4.GIT