help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: delete buffer content from the point


From: Emanuel Berg
Subject: Re: delete buffer content from the point
Date: Tue, 13 Jul 2021 13:49:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Luca Ferrari wrote:

> Is there a short and sweet way to kill the content of the
> current buffer from the point to the end of the buffer
> itself? I do often duplicate files and adjusts the header
> part, then I do 'C-k' until the part of the file I want to
> delete has disappeared, but this has the drawback of being
> slow and inserting a wall of text into the kill ring.

`delete-blank-lines'?

;;; -*- lexical-binding: t -*-
;;;
;;; this file:
;;;   http://user.it.uu.se/~embe8573/emacs-init/kill.el
;;;   https://dataswamp.org/~incal/emacs-init/kill.el

(setq kill-do-not-save-duplicates t)
(setq kill-whole-line             t)
(setq yank-excluded-properties    t)

(defun kill-line-remove-blanks ()
  (interactive)
  (let ((all-blanks "[[:space:]]*$"))
    (if (looking-at all-blanks)
        (progn
          (delete-blank-lines)
          (when (and (= (point-min) (point))
                     (looking-at all-blanks) )
            (kill-line) ))
      (kill-line) )))

(provide 'kill)

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]