branch: externals/objed commit 6685081f86a6feb911269f789a44b521610a722e Author: Clemens Radermacher <clem...@posteo.net> Commit: Clemens Radermacher <clem...@posteo.net>
Don't throw an error with elisp defun object if not inside a defun --- objed-objects.el | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/objed-objects.el b/objed-objects.el index 9d00ebb..08f595d 100644 --- a/objed-objects.el +++ b/objed-objects.el @@ -2080,19 +2080,20 @@ non-nil the indentation block can contain empty lines." (narrow-to-region (car bounds) (cdr bounds)) (goto-char (car bounds)) (objed--skip-ws) - (cond ((looking-at "(defun") - (down-list 2) - (up-list 1) - (cons (point) - (progn (goto-char (point-max)) - (down-list -1) - (point)))) - (t - (cons (progn (down-list 1) - (point)) - (progn (goto-char (point-max)) - (down-list -1) - (point)))))))))) + (ignore-errors + (cond ((looking-at "(defun") + (down-list 2) + (up-list 1) + (cons (point) + (progn (goto-char (point-max)) + (down-list -1) + (point)))) + (t + (cons (progn (down-list 1) + (point)) + (progn (goto-char (point-max)) + (down-list -1) + (point))))))))))) (objed-define-object nil tag :atp