Function: org-kill-line

org-kill-line is an interactive and byte-compiled function defined in org.el.gz.

Signature

(org-kill-line &optional ARG)

Documentation

Kill line, to tags or end of line.

The behavior of this command depends on the user options org-special-ctrl-k and org-ctrl-k-protect-subtree (which see).

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org.el.gz
(defun org-kill-line (&optional _arg)
  "Kill line, to tags or end of line.

The behavior of this command depends on the user options
`org-special-ctrl-k' and `org-ctrl-k-protect-subtree' (which
see)."
  (interactive)
  (cond
   ((or (not org-special-ctrl-k)
	(bolp)
	(not (org-at-heading-p)))
    (when (and (org-invisible-p (line-end-position))
	       org-ctrl-k-protect-subtree
	       (or (eq org-ctrl-k-protect-subtree 'error)
		   (not (y-or-n-p "Kill hidden subtree along with headline? "))))
      (user-error
       (substitute-command-keys
	"`\\[org-kill-line]' aborted as it would kill a hidden subtree")))
    (call-interactively
     (if (bound-and-true-p visual-line-mode) 'kill-visual-line 'kill-line)))
   ((org-match-line org-tag-line-re)
    (let ((end (save-excursion
		 (goto-char (match-beginning 1))
		 (skip-chars-backward " \t")
		 (point))))
      (if (<= end (point))		;on tags part
	  (kill-region (point) (line-end-position))
	(kill-region (point) end)))
    ;; Only align tags when we are still on a heading:
    (if (and (org-at-heading-p) org-auto-align-tags) (org-align-tags)))
   (t (kill-region (point) (line-end-position)))))