From 3e46706855dda4c774263b3689676eea998d4f0a Mon Sep 17 00:00:00 2001 From: Nathan Lovato Date: Thu, 28 May 2020 10:06:11 -0600 Subject: [PATCH] Make symbols pseudo-private, update README and CHANGELOG --- CHANGELOG.md | 7 ++++--- README.md | 17 +++++++++-------- gdscript-godot.el | 38 +++++++++++++++++++------------------- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e72fd3..19a412a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,10 @@ _Currently in development._ ### Features -- Added commands to open the API reference in eww -- Added missing built in functions -- Added missing puppet and remotesync keywords +- Added commands to open the API reference in eww. +- Added debug options when running `gdscript-godot-run-project-debug`. +- 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`. - Added a command to format a selected region with `gdformat`. - Added syntax highlighting for function calls. diff --git a/README.md b/README.md index 6432183..94b6b10 100644 --- a/README.md +++ b/README.md @@ -136,17 +136,18 @@ If you don't have `godot` available there, you can set a custom executable name You can also use `customize` to change this path: `M-x customize` and search for "godot". -### Running Godot with debugging options +### Running Godot with visual debug options -When running `gdscript-godot-run-project-debug` (binded by default to `C-c C-r C-d`) you can use prefix argument (ie. `C-u C-c C-r C-d`) to invoke mini-buffer selection with extra options to pass to godot. +When running `gdscript-godot-run-project-debug`, you can use the universal argument C-u to invoke a mini-buffer with extra options to pass to godot. -Available selection options are: - 1) `` _(default)_ - 2) `--debug-collisions` - 3) `--debug-navigation` - 4) `--debug-collisions --debug-navigation` +Here are the available options: -Selected option is remembered for subsequent execution of `gdscript-godot-run-project-debug`, so do not forget to change selection back to `` if you do not need debug options any longer. +1. `` _(default)_ +2. `--debug-collisions` +3. `--debug-navigation` +4. `--debug-collisions --debug-navigation` + +The last selected option is saved for the next time you call `gdscript-godot-run-project-debug`. To remove debug options, you need to call the command with the universal argument again. ### Formatting code with gdformat diff --git a/gdscript-godot.el b/gdscript-godot.el index dcdc965..b79a5f5 100644 --- a/gdscript-godot.el +++ b/gdscript-godot.el @@ -36,9 +36,9 @@ (require 'gdscript-utils) ;;;###autoload -(defvar gdscript-godot-debug-selected-option 1) +(defvar gdscript-godot--debug-selected-option 1) -(defvar gdscript-godot-debug-options-alist +(defvar gdscript-godot--debug-options-alist '((1 . "") (2 . "--debug-collisions") (3 . "--debug-navigation") @@ -80,9 +80,9 @@ When run with prefix argument, it offers extra debug options to choose from." (interactive) (let* ((debug-option-index (if current-prefix-arg - (gdscript-godot-change-debug-options) - gdscript-godot-debug-selected-option)) - (debug-options (cdr (assoc debug-option-index gdscript-godot-debug-options-alist)))) + (gdscript-godot--change-debug-options) + gdscript-godot--debug-selected-option)) + (debug-options (cdr (assoc debug-option-index gdscript-godot--debug-options-alist)))) (gdscript-godot--run-command (concat (gdscript-godot--build-shell-command) " -d " debug-options) t))) @@ -118,31 +118,31 @@ For this to work, the script must inherit either from (concat (gdscript-godot--build-shell-command) " -s " (file-relative-name buffer-file-name)) t)) -(defun gdscript-godot-debug-options-collection () - "List of debug options to choose from by *-read function." +(defun gdscript-godot--debug-options-collection () + "Output a list of debug options to choose from by *-read function." (list - (format "1) [%s] " (if (eq gdscript-godot-debug-selected-option 1) "X" " ")) - (format "2) [%s] %s" (if (eq gdscript-godot-debug-selected-option 2) "X" " ") (cdr (assoc 2 gdscript-godot-debug-options-alist))) - (format "3) [%s] %s" (if (eq gdscript-godot-debug-selected-option 3) "X" " ") (cdr (assoc 3 gdscript-godot-debug-options-alist))) - (format "4) [%s] %s" (if (eq gdscript-godot-debug-selected-option 4) "X" " ") (cdr (assoc 4 gdscript-godot-debug-options-alist))))) + (format "1) [%s] " (if (eq gdscript-godot--debug-selected-option 1) "X" " ")) + (format "2) [%s] %s" (if (eq gdscript-godot--debug-selected-option 2) "X" " ") (cdr (assoc 2 gdscript-godot--debug-options-alist))) + (format "3) [%s] %s" (if (eq gdscript-godot--debug-selected-option 3) "X" " ") (cdr (assoc 3 gdscript-godot--debug-options-alist))) + (format "4) [%s] %s" (if (eq gdscript-godot--debug-selected-option 4) "X" " ") (cdr (assoc 4 gdscript-godot--debug-options-alist))))) -(defun gdscript-godot-read-options () +(defun gdscript-godot--read-debug-options () "Read debug options preference by user from mini-buffer." (cond ((fboundp 'ivy-read) - (ivy-read "Options: " (gdscript-godot-debug-options-collection))) + (ivy-read "Options: " (gdscript-godot--debug-options-collection))) ((fboundp 'ido-completing-read) - (ido-completing-read "Options: " (gdscript-godot-debug-options-collection))) + (ido-completing-read "Options: " (gdscript-godot--debug-options-collection))) (t - (completing-read "Options (hit TAB to auto-complete): " (gdscript-godot-debug-options-collection) nil t)))) + (completing-read "Options (hit TAB to auto-complete): " (gdscript-godot--debug-options-collection) nil t)))) -(defun gdscript-godot-change-debug-options () +(defun gdscript-godot--change-debug-options () "Read debug option and parse it as a number. -Once read it is saved in `gdscript-godot-debug-selected-option' +Once read it is saved in `gdscript-godot--debug-selected-option' variable for later use." - (let* ((option (gdscript-godot-read-options)) + (let* ((option (gdscript-godot--read-debug-options)) (index (string-to-number option))) - (setq gdscript-godot-debug-selected-option index))) + (setq gdscript-godot--debug-selected-option index))) (provide 'gdscript-godot) ;;; gdscript-godot.el ends here