Update package headers, fix flycheck errors

This commit is contained in:
Nathan Lovato
2020-02-15 20:25:10 -06:00
parent b6b864e3bf
commit b7584fe1dc
9 changed files with 96 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
;;; gdscript-completion.el --- Autocompletion for GDScript. -*- lexical-binding: t -*-
;;; gdscript-completion.el --- Autocompletion for GDScript -*- lexical-binding: t -*-
;; Copyright (C) 2020 GDQuest, Free Software Foundation, Inc.

View File

@@ -1,8 +1,8 @@
;;; gdscript-customization.el --- Customizable variables for the GDScript language support. -*- lexical-binding: t; -*-
;;; gdscript-customization.el --- Customizable variables for the GDScript language support -*- lexical-binding: t -*-
;; Copyright (C) 2020 GDQuest, Free Software Foundation, Inc.
;; Author: Nathan Lovato <nathan@gdquest.com>, Fabián E. Gallina <fgallina@gnu.org>
;; Author: Nathan Lovato <nathan@gdquest.com>
;; URL: https://github.com/GDQuest/emacs-gdscript-mode/
;; Version: 0.1.0
;; Package-Requires: ((emacs "26.0"))
@@ -10,18 +10,26 @@
;; Created: Jan 2020
;; Keywords: languages
;; This program is free software; you can redistribute it and/or modify
;; This file is not part of GNU Emacs
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;; For a full copy of the GNU General Public License
;; see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Contains all the defcustom for gdscript-mode
;;; Code:
@@ -32,16 +40,16 @@
:link '(emacs-commentary-link "gdscript"))
(defcustom gdscript-use-type-hints t
"If t, inserted snippets contain type hints"
"If t, inserted snippets contain type hints."
:group 'gdscript
:type 'boolean)
;; gdscript-indent
(defcustom gdscript-use-tab-indents t "Use tabs (t) or spaces (nil)"
(defcustom gdscript-use-tab-indents t "Use tabs (t) or spaces (nil)."
:type 'boolean
:group 'gdscript)
(defcustom gdscript-tab-width 4 "Indentation width"
(defcustom gdscript-tab-width 4 "Indentation width."
:type 'integer
:group 'gdscript)
@@ -68,21 +76,21 @@
:type '(repeat symbol):group'gdscript)
;; gdscript-fill-paragraph.el
(defcustom gdscript-fill-comment-function 'gdscript-fill-comment
(defcustom gdscript-fill-comment-function 'gdscript-fill-paragraph-fill-comment
"Function to fill comments.
This is the function used by `gdscript-fill-paragraph' to
fill comments."
:type 'symbol
:group 'gdscript)
(defcustom gdscript-fill-string-function 'gdscript-fill-string
(defcustom gdscript-fill-string-function 'gdscript-fill-paragraph-fill-string
"Function to fill strings.
This is the function used by `gdscript-fill-paragraph' to
fill strings."
:type 'symbol
(defcustom gdscript-fill-paren-function 'gdscript-fill-paren
:group 'gdscript)
(defcustom gdscript-fill-paren-function 'gdscript-fill-paragraph-fill-paren
@@ -90,3 +98,5 @@ fill parens."
This is the function used by `gdscript-fill-paragraph' to
fill parens."
:type 'symbol
:group 'gdscript)

View File

@@ -1,8 +1,8 @@
;;; gdscript-fill-paragraph.el --- Major mode to add support for Godot's GDScript programming language. -*- lexical-binding: t; -*-
;;; gdscript-fill-paragraph.el --- GDScript fill paragraph functions -*- lexical-binding: t; -*-
;; Copyright (C) 2020 GDQuest, Free Software Foundation, Inc.
;; Author: Nathan Lovato <nathan@gdquest.com>, Fabián E. Gallina <fgallina@gnu.org>
;; Author: Nathan Lovato <nathan@gdquest.com>
;; URL: https://github.com/GDQuest/emacs-gdscript-mode/
;; Version: 0.1.0
;; Package-Requires: ((emacs "26.0"))
@@ -10,22 +10,31 @@
;; Created: Jan 2020
;; Keywords: languages
;; This program is free software; you can redistribute it and/or modify
;; This file is not part of GNU Emacs
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;; For a full copy of the GNU General Public License
;; see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Code to fill paragraphs, fill strings and comments up to the fill-column.
;;; Code:
(require 'gdscript-customization)
(require 'gdscript-indent-and-nav)
;; NOTE: this and the fill docstring function can be simplified. They're
;; originally from the Python package, which supports multiple docstrings fill
@@ -62,12 +71,12 @@ Optional argument JUSTIFY defines if the paragraph should be justified."
(funcall gdscript-fill-paren-function justify))
(t t))))
(defun gdscript-fill-comment (&optional justify)
(defun gdscript-fill-paragraph-fill-comment (&optional justify)
"Comment fill function for `gdscript-fill-paragraph'.
JUSTIFY should be used (if applicable) as in `fill-paragraph'."
(fill-comment-paragraph justify))
(defun gdscript-fill-string (&optional justify)
(defun gdscript-fill-paragraph-fill-string (&optional justify)
"String fill function for `gdscript-fill-paragraph'.
JUSTIFY should be used (if applicable) as in `fill-paragraph'."
(let* ((str-start-pos
@@ -119,7 +128,7 @@ JUSTIFY should be used (if applicable) as in `fill-paragraph'."
;; Again indent only if a newline is added.
(indent-according-to-mode))))) t)
(defun gdscript-fill-paren (&optional justify)
(defun gdscript-fill-paragraph-fill-paren (&optional justify)
"Paren fill function for `gdscript-fill-paragraph'.
JUSTIFY should be used (if applicable) as in `fill-paragraph'."
(save-restriction
@@ -147,10 +156,12 @@ JUSTIFY should be used (if applicable) as in `fill-paragraph'."
(goto-char (line-end-position))))
t)
(defun gdscript-do-auto-fill ()
(defun gdscript-fill-paragraph-do-auto-fill ()
"Like `do-auto-fill', but bind `fill-indent-according-to-mode'."
;; See Bug#36056.
(let ((fill-indent-according-to-mode t))
(do-auto-fill)))
(provide 'gdscript-fill-paragraph)
;;; gdscript-fill-paragraph.el ends here

View File

@@ -1,4 +1,4 @@
;;; gdscript-format.el --- Format a buffer containing GDScript code with the `gdformat' GDScript formatter. -*- lexical-binding: t; -*-
;;; gdscript-format.el --- GDScript formatting with gdformat -*- lexical-binding: t; -*-
;; Copyright (C) 2020 GDQuest, Pawel Lampe
@@ -23,12 +23,16 @@
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; This code is derived from gdtoolkit, see https://github.com/Scony/godot-gdscript-toolkit
;;; Commentary:
;; Format a buffer containing GDScript code with the gdformat GDScript formatter.
;; This code is derived from gdtoolkit, see https://github.com/Scony/godot-gdscript-toolkit
;;; Code:
(defun gdscript-run-gdformat (buffer-input buffer-output buffer-error)
"Call gdformat process"
(defun gdscript-format--run-gdformat (buffer-input buffer-output buffer-error)
"Call gdformat process."
(with-current-buffer buffer-input
(let ((process (make-process :name "gdformat"
:command (list "gdformat" "-"):buffer
@@ -51,7 +55,7 @@
(process-exit-status process))))
(defun gdscript-format-buffer ()
"Formats current buffer using 'gdformat'"
"Formats current buffer using 'gdformat'."
(interactive)
(let* ((buffer-start (current-buffer))
(point-start (point))
@@ -62,9 +66,9 @@
(with-current-buffer buf
(erase-buffer)))
(condition-case err
(if (/= 0 (gdscript-run-gdformat buffer-start buffer-temp
(if (/= 0 (gdscript-format--run-gdformat buffer-start buffer-temp
buffer-error))
(error "gdscript formatter: failed, see buffer %s for details"
(error "GDSCript formatter: failed, see buffer %s for details"
(buffer-name buffer-error))
(if (/= 0 (compare-buffer-substrings buffer-temp nil
nil buffer-start nil nil))
@@ -85,3 +89,5 @@
(pop-to-buffer buffer-error)))))
(provide 'gdscript-format)
;;; gdscript-format.el ends here

View File

@@ -1,4 +1,4 @@
;;; gdscript-imenu.el --- Adds imenu support for Godot GDScript. -*- lexical-binding: t; -*-
;;; gdscript-imenu.el --- Imenu support for GDScript -*- lexical-binding: t; -*-
;; Copyright (C) 2020 GDQuest, Free Software Foundation, Inc.
@@ -23,6 +23,11 @@
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Populates imenu with a list of headings: functions and subclasses in the
;; current GDScript buffer.
;;; Code:
(defvar gdscript-imenu-format-item-label-function
@@ -177,3 +182,5 @@ To this:
(gdscript-imenu-create-index))))))
(provide 'gdscript-imenu)
;;; gdscript-imenu.el ends here

View File

@@ -1,4 +1,4 @@
;;; gdscript-syntax.el --- Syntax highlighting and table for GDScript. -*- lexical-binding: t; -*-
;;; gdscript-syntax.el --- Syntax highlighting for GDScript -*- lexical-binding: t; -*-
;; Copyright (C) 2020 GDQuest, Free Software Foundation, Inc.
@@ -23,6 +23,11 @@
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Sets up the syntax table and font-faces for GDScript.
;;; Code:
(require 'gdscript-utils)
@@ -1466,3 +1471,5 @@ position, else returns nil."
(ignore (goto-char point)))))
(provide 'gdscript-indent-and-nav)
;;; gdscript-indent-and-nav.el ends here

View File

@@ -1,5 +1,4 @@
;;; gdscript-mode.el --- Major mode to add support for Godot's GDScript
;;; programming language. -*- lexical-binding: t; -*-
;;; gdscript-mode.el --- Major mode for Godot's GDScript language -*- lexical-binding: t; -*-
;; Copyright (C) 2020 GDQuest, Free Software Foundation, Inc.
@@ -26,7 +25,8 @@
;;; Commentary:
;; Support for the Godot GDScript programming language in Emacs.
;; Adds support for the GDScript programming language from the Godot game
;; engine. This is a domain-specific language dedicated to game programming.
;;; Code:
@@ -168,7 +168,7 @@ the last command event was a string delimiter."
(setq-local paragraph-start "\\s-*$")
(setq-local fill-paragraph-function
#'gdscript-fill-paragraph)
(setq-local normal-auto-fill-function #'gdscript-do-auto-fill)
(setq-local normal-auto-fill-function #'gdscript-fill-paragraph-do-auto-fill)
(setq-local beginning-of-defun-function
@@ -212,4 +212,5 @@ the last command event was a string delimiter."
(when gdscript-indent-guess-indent-offset
(gdscript-indent-guess-indent-offset)))
(provide 'gdscript-mode)

View File

@@ -1,4 +1,4 @@
;;; gdscript-syntax.el --- Syntax highlighting and table for GDScript. -*- lexical-binding: t; -*-
;;; gdscript-syntax.el --- Syntax highlighting for GDScript -*- lexical-binding: t; -*-
;; Copyright (C) 2020 GDQuest, Free Software Foundation, Inc.
@@ -23,6 +23,11 @@
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Adds syntax highlighting and builds the syntax table for GDScript.
;;; Code:
(defun gdscript--get-package-file-content-as-string (file-path)
@@ -188,3 +193,5 @@ is used to limit the scan."
It makes underscores and dots word constituent chars.")
(provide 'gdscript-syntax)
;;; gdscript-syntax.el ends here

View File

@@ -1,4 +1,4 @@
;;; gdscript-utils.el --- Utility functions for the gdscript package. -*- lexical-binding: t; -*-
;;; gdscript-utils.el --- Utility functions for gdscript-mode -*- lexical-binding: t; -*-
;; Copyright (C) 2020 GDQuest, Free Software Foundation, Inc.
@@ -23,6 +23,11 @@
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Misc utility functions for GDScript mode.
;;; Code:
(defun gdscript--util-goto-line (line-number)
@@ -84,3 +89,5 @@ allowed files."
(directory-files dir-name)))))
(provide 'gdscript-utils)
;;; gdscript-utils.el ends here