unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* better kill line
@ 2013-06-21 13:25 Emanuel Berg
  0 siblings, 0 replies; only message in thread
From: Emanuel Berg @ 2013-06-21 13:25 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-06-21 13:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-21 13:25 better kill line Emanuel Berg

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