|
1 | | -;;; gdscript-syntax.el --- Syntax highlighting for GDScript -*- lexical-binding: t; -*- |
| 1 | +;;; gdscript-indent-and-nav.el --- Syntax highlighting for GDScript -*- lexical-binding: t; -*- |
2 | 2 |
|
3 | 3 | ;; Copyright (C) 2020 GDQuest, Free Software Foundation, Inc. |
4 | 4 |
|
5 | 5 | ;; Author: Nathan Lovato <nathan@gdquest.com>, Fabián E. Gallina <fgallina@gnu.org> |
6 | 6 | ;; URL: https://github.com/GDQuest/emacs-gdscript-mode/ |
7 | 7 | ;; Version: 1.0.0 |
8 | | -;; Package-Requires: ((emacs "26.0")) |
| 8 | +;; Package-Requires: ((emacs "26.3")) |
9 | 9 | ;; Maintainer: nathan@gdquest.com |
10 | 10 | ;; Created: Feb 2020 |
11 | 11 | ;; Keywords: languages |
|
26 | 26 |
|
27 | 27 | ;;; Commentary: |
28 | 28 |
|
29 | | -;; Sets up the syntax table and font-faces for GDScript. |
| 29 | +;; Functions copies from Emacs 27's built-in python.el to handle indents, |
| 30 | +;; querying info about the language's symbols or the context at point, and for |
| 31 | +;; navigation. |
| 32 | +;; There are dependencies between the *indent*, *info*, and *nav* functions that prevent us from splitting them into separate .el files at the moment. |
30 | 33 |
|
31 | 34 | ;;; Code: |
32 | 35 |
|
33 | 36 | (require 'gdscript-utils) |
34 | 37 | (require 'gdscript-rx) |
| 38 | +(require 'gdscript-syntax) |
| 39 | +(require 'cl-lib) |
35 | 40 |
|
36 | 41 |
|
37 | 42 | ;;; Indentation |
@@ -1448,29 +1453,6 @@ This command assumes point is not in a string or comment." |
1448 | 1453 | (or arg (setq arg 1)) |
1449 | 1454 | (gdscript-nav-up-list (- arg))) |
1450 | 1455 |
|
1451 | | -(defun gdscript-nav-if-name-main () |
1452 | | - "Move point at the beginning the __main__ block. |
1453 | | -When \"if __name__ == \\='__main__\\=':\" is found returns its |
1454 | | -position, else returns nil." |
1455 | | - (interactive) |
1456 | | - (let ((point (point)) |
1457 | | - (found (catch 'found |
1458 | | - (goto-char (point-min)) |
1459 | | - (while (re-search-forward |
1460 | | - (gdscript-rx line-start |
1461 | | - "if" (+ space) |
1462 | | - "__name__" (+ space) |
1463 | | - "==" (+ space) |
1464 | | - (group-n 1 (or ?\" ?\')) |
1465 | | - "__main__" (backref 1) (* space) ":") |
1466 | | - nil t) |
1467 | | - (when (not (gdscript-syntax-context-type)) |
1468 | | - (beginning-of-line) |
1469 | | - (throw 'found t)))))) |
1470 | | - (if found |
1471 | | - (point) |
1472 | | - (ignore (goto-char point))))) |
1473 | | - |
1474 | 1456 | (provide 'gdscript-indent-and-nav) |
1475 | 1457 |
|
1476 | 1458 | ;;; gdscript-indent-and-nav.el ends here |
0 commit comments