Function: allout-kill-topic

allout-kill-topic is an interactive and byte-compiled function defined in allout.el.gz.

Signature

(allout-kill-topic)

Documentation

Kill topic together with subtopics.

Trailing whitespace is killed with a topic if that whitespace:

 - would separate the topic from a subsequent sibling
 - would separate the topic from the end of buffer
 - would not be added to whitespace already separating the topic from the
   previous one.

Topic exposure is marked with text-properties, to be used by allout-yank-processing for exposure recovery.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/allout.el.gz
;;;_    > allout-kill-topic ()
(defun allout-kill-topic ()
  "Kill topic together with subtopics.

Trailing whitespace is killed with a topic if that whitespace:

 - would separate the topic from a subsequent sibling
 - would separate the topic from the end of buffer
 - would not be added to whitespace already separating the topic from the
   previous one.

Topic exposure is marked with text-properties, to be used by
`allout-yank-processing' for exposure recovery."

  (interactive)
  (let* ((inhibit-field-text-motion t)
         (beg (prog1 (allout-back-to-current-heading) (beginning-of-line)))
         end
         (depth allout-recent-depth))
    (allout-end-of-current-subtree)
    (if (and (/= (current-column) 0) (not (eobp)))
        (forward-char 1))
    (if (not (eobp))
	(if (and (= (following-char) ?\n)
                 (or (save-excursion
                       (or (not (allout-next-heading))
                           (= depth allout-recent-depth)))
                     (and (> (- beg (point-min)) 3)
                          (string= (buffer-substring (- beg 2) beg) "\n\n"))))
	    (forward-char 1)))

    (allout-annotate-hidden beg (setq end (point)))
    (unwind-protect                     ; for possible barf-if-buffer-read-only.
        (allout-unprotected (kill-region beg end))
      (allout-deannotate-hidden beg end)
      (run-hooks 'allout-after-copy-or-kill-hook)

      (save-excursion
        (allout-renumber-to-depth depth))
      (run-hook-with-args 'allout-structure-deleted-functions depth (point)))))