unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: delete buffer content from the point
Date: Tue, 13 Jul 2021 13:49:23 +0200	[thread overview]
Message-ID: <877dhujuws.fsf@zoho.eu> (raw)
In-Reply-To: CAKoxK+4A-w0o7gVmBJ8NjqhKnNbhvm4zDZ_h=jW5-KgzEviORQ@mail.gmail.com

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




  parent reply	other threads:[~2021-07-13 11:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13 11:32 delete buffer content from the point Luca Ferrari
2021-07-13 11:40 ` Tassilo Horn
2021-07-13 11:44 ` Philip Kaludercic
2021-07-13 11:51   ` Robert Pluim
2021-07-13 11:49 ` Emanuel Berg via Users list for the GNU Emacs text editor [this message]
2021-07-13 11:49 ` Óscar Fuentes
2021-07-13 11:50 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-07-13 12:08 ` Joost Kremers
2021-07-14  8:45   ` Luca Ferrari
2021-07-13 13:40 ` [External] : " Drew Adams
2021-07-30 10:49   ` Luca Ferrari
2021-07-30 15:59     ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877dhujuws.fsf@zoho.eu \
    --to=help-gnu-emacs@gnu.org \
    --cc=moasenwood@zoho.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).