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

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

better kill line


From: Emanuel Berg
Subject: better kill line
Date: Fri, 21 Jun 2013 15:25:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

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 via email to

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