mirror of
https://github.com/godotengine/emacs-gdscript-mode.git
synced 2025-12-31 21:48:34 +03:00
Rename gdscript-documentation to gdscript-docs, update README
This commit is contained in:
@@ -8,7 +8,7 @@ _Currently in development._
|
||||
|
||||
### Features
|
||||
|
||||
- Added convenient way how to browse Godot API with eww
|
||||
- Added commands to open the API reference in eww
|
||||
- Added missing built in functions
|
||||
- Added missing puppet and remotesync keywords
|
||||
- Added a command to insert a path to a project file, either using `project-find-file` if `projectile` is available, otherwise with `find-file`.
|
||||
|
||||
@@ -22,6 +22,7 @@ This mode already features all the essentials:
|
||||
[gdformat](https://github.com/scony/godot-gdscript-toolkit/).
|
||||
- Auto-completion for all the keywords in the `gdscript-keywords.el` file.
|
||||
- Run or open the project and files with Godot.
|
||||
- Browsing the API reference in Emacs.
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -148,11 +149,11 @@ command in your shell to install it:
|
||||
pip3 install gdtoolkit
|
||||
```
|
||||
|
||||
### Browsing Godot API with [eww](https://www.gnu.org/software/emacs/manual/html_node/emacs/EWW.html)
|
||||
### Browsing the Godot API with eww
|
||||
|
||||
With a point on build-in class you can press `C-c C-r C-o` to open [eww](https://www.gnu.org/software/emacs/manual/html_node/emacs/EWW.html) browser with an api documentation for that class.
|
||||
With the point on a built-in class you can press `C-c C-r C-o` to open the code reference for that class in the text browser [eww](https://www.gnu.org/software/emacs/manual/html_node/emacs/EWW.html).
|
||||
|
||||
Using `C-c C-r C-a` opens main Godot API page in eww.
|
||||
To open the main API reference page and browse it, press `C-c C-r C-a`.
|
||||
|
||||
## Customization
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
;;; gdscript-documentation.el --- Open documntation in Godot -*- lexical-binding: t; -*-
|
||||
;;; gdscript-docs.el --- Open documntation in Godot -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (C) 2020 GDQuest and contributors
|
||||
;;
|
||||
@@ -34,12 +34,12 @@
|
||||
(require 'eww)
|
||||
|
||||
;;;###autoload
|
||||
(defun gdscript-documentation-api ()
|
||||
(defun gdscript-docs-browse-api ()
|
||||
"Open main page of Godot API in eww browser."
|
||||
(interactive)
|
||||
(eww-browse-url "https://docs.godotengine.org/en/stable/classes/index.html?#godot-api"))
|
||||
|
||||
(defun gdscript-documentation-open ()
|
||||
(defun gdscript-docs-browse-symbol-at-point ()
|
||||
"Open documention for symbol at point in eww browser.
|
||||
If a page is already open, it will switch to its buffer."
|
||||
(interactive)
|
||||
@@ -54,7 +54,7 @@ If a page is already open, it will switch to its buffer."
|
||||
(if buffer (pop-to-buffer-same-window buffer)
|
||||
(eww-browse-url (format "https://docs.godotengine.org/en/stable/classes/class_%s.html#%s" symbol symbol) t))))
|
||||
|
||||
(defun gdscript-documentation-rename-eww-buffer ()
|
||||
(defun gdscript-docs-rename-eww-buffer ()
|
||||
"Rename eww buffer visiting Godot documentation.
|
||||
It will rename eww buffer from generic name to name including page title."
|
||||
(when (derived-mode-p 'eww-mode)
|
||||
@@ -62,7 +62,7 @@ It will rename eww buffer from generic name to name including page title."
|
||||
(when (string-match "Godot Engine" title)
|
||||
(rename-buffer (format "*eww - %s*" title) t)))))
|
||||
|
||||
(defun gdscript-documentation-show-main-only ()
|
||||
(defun gdscript-docs-show-main-only ()
|
||||
"View the main part of the Godot web page.
|
||||
|
||||
This is re-implementation of `eww-readable'."
|
||||
@@ -84,7 +84,7 @@ This is re-implementation of `eww-readable'."
|
||||
(plist-get old-data elem)))
|
||||
(eww-update-header-line-format)))
|
||||
|
||||
(defun gdscript-documentation-follow-link (orig-fun &rest args)
|
||||
(defun gdscript-docs-follow-link (orig-fun &rest args)
|
||||
"Remember url when following local link on a page.
|
||||
|
||||
ORIG-FUN is function we wrap around. ARGS are argument to ORIG-FUN function."
|
||||
@@ -93,15 +93,15 @@ ORIG-FUN is function we wrap around. ARGS are argument to ORIG-FUN function."
|
||||
(plist-put eww-data :url url)
|
||||
res))
|
||||
|
||||
(defun gdscript-documentation-setup ()
|
||||
(defun gdscript-docs-setup ()
|
||||
"Convenience setup for pages with Godot documentation."
|
||||
(setq multi-isearch-next-buffer-function nil)
|
||||
(gdscript-documentation-rename-eww-buffer)
|
||||
(gdscript-documentation-show-main-only))
|
||||
(gdscript-docs-rename-eww-buffer)
|
||||
(gdscript-docs-show-main-only))
|
||||
|
||||
(add-hook 'eww-after-render-hook #'gdscript-documentation-setup)
|
||||
(add-hook 'eww-after-render-hook #'gdscript-docs-setup)
|
||||
|
||||
(advice-add 'eww-follow-link :around #'gdscript-documentation-follow-link)
|
||||
(advice-add 'eww-follow-link :around #'gdscript-docs-follow-link)
|
||||
|
||||
(provide 'gdscript-documentation)
|
||||
;;; gdscript-documentation.el ends here
|
||||
(provide 'gdscript-docs)
|
||||
;;; gdscript-docs.el ends here
|
||||
@@ -31,7 +31,7 @@
|
||||
;;; Code:
|
||||
|
||||
(require 'gdscript-customization)
|
||||
(require 'gdscript-documentation)
|
||||
(require 'gdscript-docs)
|
||||
(require 'gdscript-syntax)
|
||||
(require 'gdscript-indent-and-nav)
|
||||
(require 'gdscript-imenu)
|
||||
@@ -72,8 +72,8 @@
|
||||
(define-key map "\C-c\C-r\C-q" 'gdscript-godot-run-current-scene-debug)
|
||||
(define-key map "\C-c\C-r\C-e" 'gdscript-godot-edit-current-scene)
|
||||
(define-key map "\C-c\C-r\C-x" 'gdscript-godot-run-current-script)
|
||||
(define-key map "\C-c\C-r\C-a" 'gdscript-documentation-api)
|
||||
(define-key map "\C-c\C-r\C-o" 'gdscript-documentation-open)
|
||||
(define-key map "\C-c\C-r\C-a" 'gdscript-docs-browse-api)
|
||||
(define-key map "\C-c\C-r\C-o" 'gdscript-docs-browse-symbol-at-point)
|
||||
map)
|
||||
"Keymap for `gdscript-mode'.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user