From: Eshel Yaron Date: Sat, 18 Jan 2025 17:09:45 +0000 (+0100) Subject: (refactor-backend-read-scoped-identifier): Fail loudly X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e0a5dcef31d588a98d9537b66444d92d8e9469fc;p=emacs.git (refactor-backend-read-scoped-identifier): Fail loudly --- diff --git a/lisp/progmodes/refactor-elisp.el b/lisp/progmodes/refactor-elisp.el index f04bbd4dff9..172476741f7 100644 --- a/lisp/progmodes/refactor-elisp.el +++ b/lisp/progmodes/refactor-elisp.el @@ -31,18 +31,16 @@ (cl-defmethod refactor-backend-read-scoped-identifier ((_backend (eql elisp))) (let* ((pos (point))) - (when pos - (save-excursion - (goto-char pos) - (beginning-of-defun) - (catch 'var-def - (scope (lambda (_type beg len bin) - (when (and bin (<= beg pos (+ beg len))) - (throw 'var-def - (list (propertize - (buffer-substring-no-properties beg (+ beg len)) - 'pos beg)))))) - nil))))) + (save-excursion + (beginning-of-defun-raw) + (catch 'var-def + (scope (lambda (_type beg len bin) + (when (and bin (<= beg pos (+ beg len))) + (throw 'var-def + (list (propertize + (buffer-substring-no-properties beg (+ beg len)) + 'pos beg)))))) + (user-error "No local variable to rename at point"))))) (cl-defmethod refactor-backend-rename-edits ((_backend (eql elisp)) old new (_scope (eql nil)))