Function: comment-kill

comment-kill is an interactive and byte-compiled function defined in newcomment.el.gz.

Signature

(comment-kill ARG)

Documentation

Kill the first comment on this line, if any.

With prefix ARG, kill comments on that many lines starting with this one.

View in manual

Probably introduced at or before Emacs version 21.1.

Key Bindings

Aliases

kill-comment

Source Code

;; Defined in /usr/src/emacs/lisp/newcomment.el.gz
;;;###autoload
(defun comment-kill (arg)
  "Kill the first comment on this line, if any.
With prefix ARG, kill comments on that many lines starting with this one."
  (interactive "P")
  (comment-normalize-vars)
  (dotimes (_i (prefix-numeric-value arg))
    (save-excursion
      (beginning-of-line)
      (let ((cs (comment-search-forward (line-end-position) t)))
	(when cs
	  (goto-char cs)
	  (skip-syntax-backward " ")
	  (setq cs (point))
	  (comment-forward)
	  (kill-region cs (if (bolp) (1- (point)) (point)))
	  (indent-according-to-mode))))
    (if arg (forward-line 1))))