Function: combobulate--delete-text
combobulate--delete-text is a natively compiled function defined in
combobulate-manipulation.el.
Signature
(combobulate--delete-text BEG END &optional CORRECT-INDENTATION DELETE-BLANK-LINES)
Source Code
;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-manipulation.el
(defun combobulate--delete-text (beg end &optional correct-indentation delete-blank-lines)
(save-excursion
(let ((text (save-excursion
(prog1 (delete-and-extract-region beg end)))))
(prog1 (if correct-indentation
(combobulate-indent-string-first-line
text
(save-excursion
(goto-char beg)
(current-indentation)))
text)
(save-excursion
;; Only trim lines if there is more than one as
;; `delete-blank-lines', in case there is only one, will
;; delete that blank line. That can have very bad
;; repercussions if the deletion is used as part of a
;; greater chain of operations, like moving text in a
;; refactor
(if (= (combobulate-string-count "\n" text) 0)
(save-restriction
(goto-char end)
(narrow-to-region (line-beginning-position) (point-max))
(when (and delete-blank-lines (or (> (combobulate-count-lines-ahead (point)) 1)
(= (combobulate-string-count "\n" text) 0)))
(delete-blank-lines)))
(save-restriction
(narrow-to-region (line-beginning-position) (point-max))
(when (and delete-blank-lines (or (> (combobulate-count-lines-ahead (point)) 1)
(= (combobulate-string-count "\n" text) 0)))
(delete-blank-lines)))))))))