[Top][All Lists]

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

Re: delete buffer content from the point

From: Tassilo Horn
Subject: Re: delete buffer content from the point
Date: Tue, 13 Jul 2021 13:40:34 +0200
User-agent: mu4e 1.5.13; emacs 28.0.50

Luca Ferrari <> writes:

> 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.

The following should do the trick.  Bind it to a key of your liking.

--8<---------------cut here---------------start------------->8---
(defun my/delete-from-point-to-end ()
  ;; Or kill-region if you want the text in the kill-ring.
  ;; Maybe (1+ (point)) if you don't want the char at point to be removed.
  (delete-region (point) (buffer-end 1)))
--8<---------------cut here---------------end--------------->8---


reply via email to

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