unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: better kill line
Date: Fri, 21 Jun 2013 15:25:37 +0200	[thread overview]
Message-ID: <87k3lnzjce.fsf@VLAN-3434.student.uu.se> (raw)

What do you think of this?

I mean both the idea, and the implementation of the idea.

;;; kill lines
(setq kill-whole-line t)
(defun kill-line-if-not-empty-then-delete ()
  "If there is text to the right of point on the same line, kill it.
If the current line is blank, and the following line is non-blank,
delete the blank line.
If the current line is blank, *and* part of a block of blank lines,
delete all blank lines except one.
The purpose is to be able to remove blank lines fast,
and without pushing them to the kill ring."
  (interactive)
  (if (looking-at "[ \t]*$")
      (delete-blank-lines)
    (kill-visual-line) ))
(define-key (current-global-map) (kbd "C-k")
  'kill-line-if-not-empty-then-delete)
-- 
Emanuel Berg - programmer (hire me! CV below)
computer projects: http://user.it.uu.se/~embe8573
internet activity: http://home.student.uu.se/embe8573


                 reply	other threads:[~2013-06-21 13:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87k3lnzjce.fsf@VLAN-3434.student.uu.se \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /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).