Merge pull request #96 from VlachJosef/master

gdscript-docs-browse-api - online browsing fix
This commit is contained in:
Nathan Lovato
2020-10-24 08:26:15 -06:00
committed by GitHub

View File

@@ -44,7 +44,7 @@
(defun gdscript-docs-browse-api (&optional force-online)
"Open the main page of Godot API. Use the universal prefix (C-u) to force browsing the online API."
(interactive)
(if (and (or gdscript-docs-force-online-lookup current-prefix-arg force-online) (not (string= gdscript-docs-local-path "")))
(if (and (or gdscript-docs-force-online-lookup current-prefix-arg force-online) (string= gdscript-docs-local-path ""))
(gdscript-docs-open "https://docs.godotengine.org/en/stable/classes/index.html?#godot-api")
(let ((file (concat (file-name-as-directory gdscript-docs-local-path) "classes/index.html")))
(if (file-exists-p file)
@@ -63,12 +63,12 @@ If a page is already open, switch to its buffer. Use local docs if gdscripts-doc
(lambda (current-buffer)
(with-current-buffer current-buffer
(when (derived-mode-p 'eww-mode)
(string-suffix-p symbol(string-remove-suffix ".html" (plist-get eww-data :url)) t)
))) (buffer-list)))))
(string-suffix-p symbol (string-remove-suffix ".html" (plist-get eww-data :url)) t))))
(buffer-list)))))
(if buffer (pop-to-buffer-same-window buffer)
(if (string= "" symbol)
(message "No symbol at point or open API reference buffers.")
(if (and (not gdscript-docs-force-online-lookup)(not (or current-prefix-arg force-online)) (not (string= gdscript-docs-local-path "")))
(if (and (not gdscript-docs-force-online-lookup) (not (or current-prefix-arg force-online)) (not (string= gdscript-docs-local-path "")))
(let ((file (concat (file-name-as-directory gdscript-docs-local-path) (file-name-as-directory "classes") "class_" symbol ".html")))
(if (file-exists-p file)
(gdscript-docs-open file)