From becce1a4ba12ac8da02517839248f5de6057551d Mon Sep 17 00:00:00 2001 From: Nicolas Petton Date: Wed, 17 Apr 2024 15:46:01 +0200 Subject: [PATCH] Fix #142: Add missing function `gdscript-mark-defun' --- gdscript-mode.el | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gdscript-mode.el b/gdscript-mode.el index df5b683..df3f094 100644 --- a/gdscript-mode.el +++ b/gdscript-mode.el @@ -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."