Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #142: Add missing function `gdscript-mark-defun' #146

Merged
merged 1 commit into from
Apr 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions gdscript-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,22 @@ the last command event was a string delimiter."
(save-excursion
(insert (make-string 2 last-command-event)))))

(defun gdscript-mark-defun ()
"GDScript-specific version of `mark-defun'.

Put mark at end of this defun, point at beginning.
The defun marked is the one that contains point or follows point.

If the mark is active, it marks the next defun after the one
already marked."
(interactive)
(if (use-region-p)
(gdscript-nav-forward-defun)
(save-excursion
(gdscript-nav-backward-defun)
(set-mark (point))))
(gdscript-nav-end-of-defun))

;;;###autoload
(define-derived-mode gdscript-mode prog-mode "gdscript"
"Major mode for editing Godot GDScript files."
Expand Down
Loading