From b9735cf7d3dbe63591ece625429b977d6fd71a85 Mon Sep 17 00:00:00 2001 From: Ning Sun Date: Mon, 7 Oct 2024 11:37:49 -0700 Subject: [PATCH] fix: use beginning-of-defun-raw for current test --- cargo-mode.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cargo-mode.el b/cargo-mode.el index 5fff3c0..745dc15 100644 --- a/cargo-mode.el +++ b/cargo-mode.el @@ -184,12 +184,10 @@ If PROMPT is non-nil, modifies the command." "Return the current test." (save-excursion (unless (cargo-mode--defun-at-point-p) - (cond ((fboundp 'rust-beginning-of-defun) - (rust-beginning-of-defun)) - ((fboundp 'rustic-beginning-of-defun) - (rustic-beginning-of-defun)) - (t (user-error "%s needs either rust-mode or rustic-mode" - this-command)))) + (if beginning-of-defun-function + (beginning-of-defun-raw) + (user-error "%s needs a supported major mode like rust-mode or rustic-mode" + this-command))) (beginning-of-line) (search-forward "fn ") (let* ((line (buffer-substring-no-properties (point)