From 39c06213848caa9cce4f7c3c6e83953bab0088ed Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Fri, 28 Feb 2025 20:18:49 +0100 Subject: [PATCH] Fix 'lisp-kill-line' --- lisp/emacs-lisp/lisp-mode.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index a4e9a88aebf..8069f4ae77a 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -923,9 +923,18 @@ font-lock keywords will not be case sensitive." (kill-line arg) (skip-syntax-forward " -") (while (and (condition-case nil - (progn (forward-sexp) t) + (progn + (forward-sexp) + (skip-syntax-forward " -") + t) (scan-error nil)) - (< (point) eol))) + ;; We've skipped one sexp. + ;; Are we still on the same line? + (< (point) eol) + ;; Does the line end with a comment? + (or (not (equal (char-after) ?\;)) + ;; It does. Stop after the comment. + (prog1 nil (goto-char eol))))) (kill-region beg (point))))))) (defun lisp-tidy-sexp () -- 2.39.5